Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Using python for a CAD program

Reply
Thread Tools

Using python for a CAD program

 
 
Harry George
Guest
Posts: n/a
 
      05-16-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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 **** 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
 
Reply With Quote
 
 
 
 
63q2o4i02@sneakemail.com
Guest
Posts: n/a
 
      05-16-2006
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 **** 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

 
Reply With Quote
 
 
 
 
BartlebyScrivener
Guest
Posts: n/a
 
      05-16-2006
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

 
Reply With Quote
 
skip@pobox.com
Guest
Posts: n/a
 
      05-16-2006

Someone in hiding wrote:

> Hi, I'm interested in using python to start writing a CAD program for
> electrical design.


Google for PythonCAD.

Skip
 
Reply With Quote
 
63q2o4i02@sneakemail.com
Guest
Posts: n/a
 
      05-16-2006
Cool. thanks for the links. I've already looked around quite a bit,
and am very hesitant to just write more **** on top of other ****. 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.

 
Reply With Quote
 
Paddy
Guest
Posts: n/a
 
      05-16-2006
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.

 
Reply With Quote
 
Hannu Krosing
Guest
Posts: n/a
 
      05-16-2006
Ühel kenal päeval, E, 2006-05-15 kell 23:49, kirjutas
(E-Mail Removed):

> 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


 
Reply With Quote
 
skip@pobox.com
Guest
Posts: n/a
 
      05-16-2006

Someone anonymous wrote:

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


That seems like a gratuitously unkind way to refer to tools you haven't
tried. Have you checked out PythonCAD? <http://www.pythoncad.org/>. 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
 
Reply With Quote
 
63q2o4i02@sneakemail.com
Guest
Posts: n/a
 
      05-16-2006
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.

 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      05-16-2006
On 2006-05-16, (E-Mail Removed) <(E-Mail Removed)> 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 --
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CAD tool development using python Madhurijkd Software 0 02-29-2012 01:33 PM
python for EE CAD program chewie54 Python 8 06-04-2007 05:40 PM
python for EE CAD program chewie54 Python 0 06-04-2007 01:58 PM
Using python for a CAD program Dan Fabrizio Python 0 05-26-2007 10:46 PM



Advertisments