473,722 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using python for a CAD program

Hi, I'm interested in using python to start writing a CAD program for
electrical design. I just got done reading Steven Rubin's book, I've
used "real" EDA tools, and I have an MSEE, so I know what I *want* at
the end of this; I just have never taken on a programming task of this
magnitude. I've seen that some are using python as a utility language
for existing CAD environments, and I've also found some guy who's
writing a 2d drafting tool with python, which is cool. I've been
playing with python recently and so far have a SPICE parser
half-written (it'll do production rules, but no syntax trees yet...)
I'm wondering if the python experts can provide some opinion on
python's efficiency/utility in the following areas, and perhaps where
some things will need to be in C++ and/or pyrex:

1. Databases. I don't mean sql type database, but design databases,
which contain all the components for any given design, including
schematics, layout, simulation parameters, etc. I'm not concerned
about python's ability to do fancy data structures, but I'm wondering
how it'll go in terms of efficiency when things get really big. If the
alternative is home-brewed C++ linked-lists, attributes, arrays, binary
trees, memory management, etc., it looks like python's ability to do
all this neatly without all the bugs waiting to happen if I did this
myself are well worth the efficiency loss that may result from its
uber-generality.

2. GUI. Yes, I know you can do guis with qt, gtk, tkinter, etc. I'm
talking of fancy guis that do alpha blending, animations, nice
shading/gradients, etc. in a quick, smooth, and slick way, such that
moving a scroll bar or jiggling the mouse yields fast game-like
response time, and which gives this program the feeling that you're
actually in the 21st century... ie this is an *interactive*
environment, and I f***king hate crass-hatching, so real colors is a
must. Can this be portable between linux and windows? Is it possible
to "do the whole thing" in opengl, even the 2d stuff? I guess I dont
know enough about guis here. My fear is that my app will turn into
x-hell if I try to do more than 8-bit colors in linux, with flashing
background windows and complaints from the server about bit planes.
Maybe I need to play with linux a bit more from the development side
before commenting on this, since I get the feeling I'm working on old
information here...

3. Computational stuff. I imagine the really heavy computing needs to
be done in c++, especially if I'm stupid enough to write my own
simulator, which my brain seems to want to do (I'm imagining a small
homer simpson brain with a mind of its own telling me what to do...).
But what about other things like rules and constraints about layout,
routing, compaction, undo/redo, etc? These aren't really
computationally expensive, I don't think, but do munge about quite a
bit with the database. Is it likely I'll write something faster in
C++? (answer: no).

4. Programmability . I imagine this is a slam-dunk, relatively
speaking, to have a python interpreter as part-and-parcel of the design
system. But how do I customize the command window to do custom things
like adding special shortcuts (eg '?' brings up help, or help on
commands a la Matlab), or making an API into the CAD program? I'm not
sure conceptually how to merge an embedded python interpreter into the
rest of the CAD program in an intelligent way, so some stuff is
exposed, but not all, and which interacts dynamically with the
graphical portion so that, for instance, context-sensitive help is
available in the console window, or so you can access information about
the currently selected object, or so you can do stuff from the command
line that is based on your current graphical context.

5. Threads and parallelism. One of the things about this is that I'd
like there to be some real-time simulator running so when you change
the values of parts, the output changes, and I'd like to be able to
take advantage of mulitple processors, or dual-core, or whatever. I've
seen fake multi-threading in python (read about it, but I haven't done
it), but that doesn't really use any extra cycles from a separate
processor.

So why am I thinking about this? I've used a few "real" CAD systems,
and from using them, it's obvious the modus is to kludge shit together
over 20 years and screw the user experience. So basically I'd like to
take over the world with my nifty new python-based cad system because
it's so beautiful and fun to use, and so flexible that my time to
market for any given new idea is 5x shorter than the existing tools.

Any comments on the above from people who've actually written stuff
would be greatly appreciated! :)

thanks
ms

May 16 '06 #1
29 16561
Art Haas posts from time to time regarding a program called PythonCad
that he maintains:

http://tinyurl.com/o36t8

Also, here is a search of this forum on "Cad":

http://tinyurl.com/nuobe

May 16 '06 #2
63*******@sneak email.com writes:
Hi, I'm interested in using python to start writing a CAD program for
electrical design. I just got done reading Steven Rubin's book, I've
used "real" EDA tools, and I have an MSEE, so I know what I *want* at
the end of this; I just have never taken on a programming task of this
magnitude. I've seen that some are using python as a utility language
for existing CAD environments, and I've also found some guy who's
writing a 2d drafting tool with python, which is cool. I've been
playing with python recently and so far have a SPICE parser
half-written (it'll do production rules, but no syntax trees yet...)
I'm wondering if the python experts can provide some opinion on
python's efficiency/utility in the following areas, and perhaps where
some things will need to be in C++ and/or pyrex:

1. Databases. I don't mean sql type database, but design databases,
which contain all the components for any given design, including
schematics, layout, simulation parameters, etc. I'm not concerned
about python's ability to do fancy data structures, but I'm wondering
how it'll go in terms of efficiency when things get really big. If the
alternative is home-brewed C++ linked-lists, attributes, arrays, binary
trees, memory management, etc., it looks like python's ability to do
all this neatly without all the bugs waiting to happen if I did this
myself are well worth the efficiency loss that may result from its
uber-generality.

2. GUI. Yes, I know you can do guis with qt, gtk, tkinter, etc. I'm
talking of fancy guis that do alpha blending, animations, nice
shading/gradients, etc. in a quick, smooth, and slick way, such that
moving a scroll bar or jiggling the mouse yields fast game-like
response time, and which gives this program the feeling that you're
actually in the 21st century... ie this is an *interactive*
environment, and I f***king hate crass-hatching, so real colors is a
must. Can this be portable between linux and windows? Is it possible
to "do the whole thing" in opengl, even the 2d stuff? I guess I dont
know enough about guis here. My fear is that my app will turn into
x-hell if I try to do more than 8-bit colors in linux, with flashing
background windows and complaints from the server about bit planes.
Maybe I need to play with linux a bit more from the development side
before commenting on this, since I get the feeling I'm working on old
information here...

3. Computational stuff. I imagine the really heavy computing needs to
be done in c++, especially if I'm stupid enough to write my own
simulator, which my brain seems to want to do (I'm imagining a small
homer simpson brain with a mind of its own telling me what to do...).
But what about other things like rules and constraints about layout,
routing, compaction, undo/redo, etc? These aren't really
computationally expensive, I don't think, but do munge about quite a
bit with the database. Is it likely I'll write something faster in
C++? (answer: no).

4. Programmability . I imagine this is a slam-dunk, relatively
speaking, to have a python interpreter as part-and-parcel of the design
system. But how do I customize the command window to do custom things
like adding special shortcuts (eg '?' brings up help, or help on
commands a la Matlab), or making an API into the CAD program? I'm not
sure conceptually how to merge an embedded python interpreter into the
rest of the CAD program in an intelligent way, so some stuff is
exposed, but not all, and which interacts dynamically with the
graphical portion so that, for instance, context-sensitive help is
available in the console window, or so you can access information about
the currently selected object, or so you can do stuff from the command
line that is based on your current graphical context.

5. Threads and parallelism. One of the things about this is that I'd
like there to be some real-time simulator running so when you change
the values of parts, the output changes, and I'd like to be able to
take advantage of mulitple processors, or dual-core, or whatever. I've
seen fake multi-threading in python (read about it, but I haven't done
it), but that doesn't really use any extra cycles from a separate
processor.

So why am I thinking about this? I've used a few "real" CAD systems,
and from using them, it's obvious the modus is to kludge shit together
over 20 years and screw the user experience. So basically I'd like to
take over the world with my nifty new python-based cad system because
it's so beautiful and fun to use, and so flexible that my time to
market for any given new idea is 5x shorter than the existing tools.

Any comments on the above from people who've actually written stuff
would be greatly appreciated! :)

thanks
ms


As a BSEE, MSCS, and developer using Lisp and Prolog for
Knowledge-Based Engineering (KBE) of structures and systems, I'm
interested in where you are going. Nothing wrong with reinventing a
few wheels, but I always like to start with a literature search. It
wasn't clear if you had done so. At a minimum, take a look at:

1. OSS EE suites:
http://www.opencollector.org/
http://www.geda.seul.org/

I don't see rewriting ngspice or Icarus Verilog -- people of people
doing that. Putting a good DBMS behind gscheme on the other hand
makes sense. Also, I write Python scripts around geda and there has
been discussion of embedding Python.
2. Databases:

Locally, we have struggled with various DBMSs. It seems OO is
mandatory, so I look to Postgresql with inheritance, or (smaller
scale) ZODB. I really wouldn't want to grow one from B+ trees.

http://www.postgresql.org/
http://www.zope.org/Products/StandaloneZODB

3. 2D CAD and game engines:
http://directory.fsf.org/PythonCAD.html
http://pygame.seul.org/news.html

4. 3D CAD

Locally we write Python code against several commercial CAD packages
(I agree with your assessment). For an OSS effort, the only game in
town seems to be:
http://www.opencascade.org/
http://free-cad.sourceforge.net/

5. Knowledge Based Engineering (KBE) inference engines:

Python already gives you lazy evaluation and memoizing, but a
prolog-based backward chaining engine helps too. We wrote
CAD-engine-calls-python-and-prolog and
python-and-prolog-calls-CAD-engine scripts.

http://sourceforge.net/projects/pyprolog/
http://christophe.delord.free.fr/en/pylog/
http://arts.anu.edu.au/linguistics/P...pyfrompro.html
http://aspn.activestate.com/ASPN/Coo.../Recipe/303057

6. Simulation

http://simpy.sourceforge.net/

Also need FEM for electromagnetic analysis, and CFD for heat
dissapation.
--
Harry George
PLM Engineering Architecture
May 16 '06 #3

Someone in hiding wrote:
Hi, I'm interested in using python to start writing a CAD program for
electrical design.


Google for PythonCAD.

Skip
May 16 '06 #4
Cool. thanks for the links. I've already looked around quite a bit,
and am very hesitant to just write more shit on top of other shit. The
idea behind this is it's completely mine. So yes, I have a tendency to
want to reinvent a few wheels, but I think it'll give me greater
satisfaction. The problem with geda, etc., is that it's taking the
unix approach -- a buncha little command line tools that somehow make a
"system", using text files as communication medium. I hate that,
largely because it allows the infectious spread of little files all
over your system, encourages people to write scripts from outside the
system that probably won't work for you, and exposes the user
unnecessarily to the implementation of where you keep files,
directories, blabla. I'm more of the windows approach, where you have
one integrated environment, and any text you type is from within the
application itself, and most application-related data is hidden from
the user unless he *really* wants to get at it. (disclosure: I've
never actually installed geda, but I tried icarus once and couldn't get
it to compile -- another bane of open source stuff I can't stand. I'm
not a CS person, so when I download something, I just want it to work,
and I don't get off trying to *make* it work...). Another reason for
doing this on my own is that I'd like a general-purpose CAD/design
framework, of which electrical/IC design is only one part. Also, I
think geda simulations are spice-based, which is batch, which is sooo
your-father's buick, which I hate as much as text files... aaand
another thing is I'm very big on user-experience. I'd like my program
to *look* slick, like it belongs in a movie or something. I think that
means starting from scratch, since I've not seen any CAD program take
any artistic/human/psychological approach to its design.

May 16 '06 #5
Unfortunately, Cadence got their first with their DFII environment for
Schematic based design and their Lisp based language SKILL
(http://www-mtl.mit.edu/users/xiaolin...nguserTOC.html)

I used their environment several years ago and can only say that it was
all you have stated above, and probably more. The environment seems to
be totally accessable by SKILL, from the Schematic database to dash
patterns for drawing lines. Their stuff is optimised for working with
todays Electronics designs.

I too have played what-if games about this and thought wouldn't it be
great to tie Python for the language together with SVG for the graphics
and ??? for the database but it remains a dream for me as it is a BIG
job.

Before you set out on this path, you might waant to see if you can be
shown around Cadence Virtuoso and SKILL?

- Pad.

May 16 '06 #6

Someone anonymous wrote:
Cool. thanks for the links. I've already looked around quite a bit,
and am very hesitant to just write more shit on top of other shit.


That seems like a gratuitously unkind way to refer to tools you haven't
tried. Have you checked out PythonCAD? <http://www.pythoncad.o rg/>. I
don't use it, but the guy's been trickling out new releases periodically for
the past four years or so (30 so far). Might be worth a peek.

Skip
May 16 '06 #7
Ühel kenal päeval, E, 2006-05-15 kell 23:49, kirjutas
63*******@sneak email.com:
2. GUI. Yes, I know you can do guis with qt, gtk, tkinter, etc. I'm
talking of fancy guis that do alpha blending, animations, nice
shading/gradients, etc. in a quick, smooth, and slick way, such that
moving a scroll bar or jiggling the mouse yields fast game-like
response time, and which gives this program the feeling that you're
actually in the 21st century... ie this is an *interactive*
environment, and I f***king hate crass-hatching, so real colors is a
must. Can this be portable between linux and windows? Is it possible
to "do the whole thing" in opengl, even the 2d stuff? I guess I dont
know enough about guis here. My fear is that my app will turn into
x-hell if I try to do more than 8-bit colors in linux, with flashing
background windows and complaints from the server about bit planes.
Maybe I need to play with linux a bit more from the development side
before commenting on this, since I get the feeling I'm working on old
information here...


for a nice fast corel-draw clone written in python see http://www.skencil.org/

-------------
Hannu
May 16 '06 #8
Yes, I figured I should be pretty expert at what's out there first
before redoing something and making in inferior to the existing
solution. I took a quick peek at cadence courses, and they're out of
my personal price range. I have a new job coming up which should lead
into IC design after some time, and I should probably ask them to send
me to the course.

May 16 '06 #9
On 2006-05-16, 63*******@sneak email.com <63*******@snea kemail.com> wrote:
Yes, I figured I should be pretty expert at what's out there
first before redoing something and making in inferior to the
existing solution.


Eagle from Cadsoft.de is a pretty decent (and free for
educational/hobby use) integrated schematic capture and board
layout package (including a quite usable auto-router). It
doesn't have integrated simulation, but after messing about
with both gEDA and Eagle for an hour or two the you get a good
feel for the difference between an integrated tool-set and
something cobbled together from disparate utilities.

--
Grant Edwards grante Yow! Of course, you
at UNDERSTAND about the PLAIDS
visi.com in the SPIN CYCLE --
May 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8805
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any feedback on how I might do things differently to make it either more consice, readable, or faster. ie... are there better ways to do it in Python? It won't break any records for calculating pi, that wasn't my goal, learning Python was. But it might...
3
5179
by: Kenneth McDonald | last post by:
After looking around at various editors, I've finally decided on (I think :-) ) Vim for my future work. (jed is a great editor, but doesn't do neat things like allow me to write python code to add to the editor functionality. Emacs is just too bloated these days. jEdit is one of the best GUI editors I've seen, but I've still not seen a GUI editor with the power of those with a non-GUI ancestry. etc. etc.) However, I can't quite figure...
0
1663
by: Jeffrey Barish | last post by:
I have been developing a Python program with two intercommunicating (using sockets) parts, one of which runs on a desktop and the other on a PDA. For ease of development, I developed them both on a desktop. Now that I have them working on the desktop, I need to move the part destined for a PDA to a PDA. I had originally planned to use a Sharp Zaurus because it runs Linux (the OS of my desktop system) and I had found a Python port that...
17
4006
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to sleep for 1 second after indexing a couple of files. I'm wondering if anyone knows of a way that I could make so that the program will run at full speed only runs after the computer has been idle for a while. I've looked at the "nice" command...
4
3050
by: vagrantbrad | last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the dns records at my dns provider, zoneedit. So basically, I've setup dynamic dns using python. Once the ip compare and/or update is complete, I log the results to a text file called update.log. When I run the program in a bash shell with the...
1
2328
by: Jim Langston | last post by:
Windows. Situation: Using a Python program called OpenRPG. I have a program that displays form data (a character sheet) in C++. I am able in the C++ program to build a string and copy it into the clipboard, then paste it into the input in the running Python program. I would like to somehow automate this, that is, have the python instance communicate with the C++ instance and vice versa. I'm still trying to think of a way to do this. ...
14
7316
by: Nathan Pinno | last post by:
How do I factor a number? I mean how do I translate x! into proper Python code, so that it will always do the correct math? Thanks in advance, Nathan P.
8
3287
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to my pc. But, it is not getting installed and is failing by throwing the below errors. Should i need to configure / install any specific files for resolving this issue ?
13
3919
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type Chinese characters, but neverthelss is unable to show them up on screen. The follow is some of the error message I received after I logged off the program: "Could not write output: <type "exceptions: UnicodeEncodeError'>, 'ascii' codec can't...
0
8738
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9234
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9151
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6680
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5994
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2146
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.