By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,522 Members | 1,770 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,522 IT Pros & Developers. It's quick & easy.

CAD.py

P: n/a
r
Hello
I am currently looking to create a small CAD program with python.
This has been a major challenge for some like myself with very
limited math skills, and only a year of self taught programming
experience.
But being the kind of hard headed, determined person I am, I won't
give up. ;^)

A little History...
Right now I use SketchUp and Blender, both great programs but each has
a
very specific use. Blender is great for modeling/rendering complex
shapes
but not for the exactness of a CAD program. SketchUp on the other
hand is lighting fast at creating architectural stuff, unfortunately
it is
proprietary and uses RUBY for scripting :P" BUMMER, and also has
poor
rendering and material properties.

For CAD drawing, Blender is missing some very important tools:
Precise measurement of entities
Line entity
Easy manipulation of faces
Offset of faces
Dimensions

So my idea to create a very simple CAD program similar to SketchUP's
design.
The main use for this program is to create simple models like
buildings, homes,
park benches, toilets, whatever and then import them into blender for
texture/color/rendering, etc...

I know Python is not best suited for CAD, but i think with the
simplicity I am looking
for this could work, and I could always optimize with C where needed
later on.
I really want to push Python to the edge to see what it can do.

Here is my basic model of the program.
The Main Parts Are:

-Very simple UI: (done-2d)
no problem here

-Export to Blender compatible format: (not done)
whatever is easy

-Entities: (done-2d)
lines, polygons, circles, curves... very basic stuff, nothing more
Faces would be needed for 3d
Grouping of entities

-Manipulations: (done-2d)
rotation, offset, scale, translation, extrusion... normal stuff

-Visualization: (not done, 3d-specific)
Real time rendering of basic Entities. Wire frame to
start, but defiantly
would need surface representation and shading later
on...
Nothing fancy, just enough to help convey the 3d
look.
And of course 3d projection...could be ortho, perspective, or both

I started out originally to write this from scratch but have only an
incomplete 2d version.
Making the "3D jump" is a stumbling block for me at this time.
I am open to using a graphics library now, until i learn more about
this subject.
I would like to get something going that i can build from fairly
quickly, but that also has good speed(of course).
I know exactly what i want as far as design is concerned, I just
cannot get past the math part.
My current 2d version uses Tkinter.Canvas... probably not the best
choice but it works.

So now to the point. (whew...finally)

In the end, my goal is to produce a fully funtional CAD
program and release it as open software,
because as far as i know no such thing exsist. That will
definetly have to be coded in C, but i will
make sure Python is there for scripting purposes.(because
Python is so damn cool).
This project will be a jumping off point to that end.

I have googled extensively on this subject yet found nothing
of use,
mostly just people asking the same questions as me.
So if any body has any suggestions where i should go to learn more
about this subject,
or any good graphics library's or whatever, Please let me know.

Any suggestions, ideas, or anything is greatly appreciated.
I am very serious about this project, and very determined to
make it happen.
Something like this would be of great benefit to me and a lot of
other Blender/python folks.

Thanks
Oct 31 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a

rI am currently looking to create a small CAD program with python.

Instead of starting from scratch how about extending PythonCAD instead:

http://www.pythoncad.org/

Skip
Oct 31 '08 #2

P: n/a


s...@pobox.com wrote:
rI am currently looking to create a small CAD program with python.

Instead of starting from scratch how about extending PythonCAD instead:

http://www.pythoncad.org/

Skip
ThanCAD might have a few ideas too.
Carl T.
Nov 2 '08 #3

P: n/a
r
On Nov 1, 7:13*pm, infixum <ctrac...@gmail.comwrote:
s...@pobox.com wrote:
rI am currently looking to create a small CAD program with python.
Instead of starting from scratch how about extending PythonCAD instead:
* *http://www.pythoncad.org/
Skip

ThanCAD might have a few ideas too.
Carl T.
Thanks for the replies:
I tried pythoncad but all links to source are broken
I even contacted devoloper and he gave me a link that also is
broken...hmm
I also tried thancad, did get it to download but cant run it yet...
but anyway thanks again i will keep trying.
Nov 3 '08 #4

P: n/a
r wrote:
On Nov 1, 7:13 pm, infixum <ctrac...@gmail.comwrote:
>s...@pobox.com wrote:
>>rI am currently looking to create a small CAD program with python.
Instead of starting from scratch how about extending PythonCAD instead:
http://www.pythoncad.org/
Skip
ThanCAD might have a few ideas too.
Carl T.

Thanks for the replies:
I tried pythoncad but all links to source are broken
I even contacted devoloper and he gave me a link that also is
broken...hmm
I also tried thancad, did get it to download but cant run it yet...
but anyway thanks again i will keep trying.
you can use git to get the source of pythoncad

git clone git://repo.or.cz/pythoncad.git

-nop
Nov 3 '08 #5

P: n/a
Hello,

I have pondered this notion of a 3d sketcher a bit myself. Before I go
on, here is a quote from writer Neil Gaiman, author of some very good books:

"Every Published writer has had it - the people who come up to you and
tell you that they've Got An Idea. And boy, is it a Doozy. It's such a
Doozy that they want to Cut You In On It. The proposal is always the
same - they'll tell you the idea (the hard bit), you write it down and
turn it into a novel (the easy bit), the two of you split the money
fifty-fifty"

In this spirit, let me offer the following observations/suggestions:
Mayavi, the open source data visualization system from enthought.com,
does a very nice job of high-level wrapping of The Visualization
Toolkit. VTK has both high-level wrappings of OpenGL for display, as
well as many modules to import/export various 3D file formats, merging
or clipping 3D objects, constructive solid geometry, etc. All of the
lower-level VTK routines can be accessed through the traited VTK wrapper
(TVTK) from enthought. Once you have a Mayavi scene, it is a simple
matter to add anything to it, or to modify any of the objects in the scene.

Although Mayavi has evolved to be reasonably backend independent, the
current version interacts most easily with the wxpython GUI toolkit.
Given that they work well together, I would say that a combination of
wxpython, Mayavi, and enthought Traits (recent stable versions and
Python 2.5) could lead to a very interesting 3d sketching application.

If you install the wxpython demos and samples (an absolute necessity if
you program with wxpython), you can dig through the installation
directory and find a "samples" subdirectory, and in there you can find
another folder called "pySketch." This app is a nice 2D sketching
program with everything I really need for simple 2D sketches, except
rotating objects (and I had to hack it to get a button to save an image
and copy to clipboard) - it could probably also use buttons for various
common drawing objects. If nothing else, this example might give an idea
of a possible layout, and source for how to set it up.

For the 3d sketching, you would have to have some buttons for object
creation (various polyhedra, sphere, ellipse, arbitrary explicit
function, implicit function, constructive solid geometry surface, maybe
a library of predefined widgets), extruding, surfaces of rotations,
button or menu for importing/exporting an object, some buttons for
clipping and merging objects (additive and subtractive merges), some
buttons for object transformations (scaling, rotations, precise
placement in a scene, parametric stretching, twisting/turning, mirroring
objects), button for duplications, and buttons for setting object
materials/colors/properties.

There are many examples of embedding a mayavi scene in other
applications given in the examples directory at the mayavi/tvtk
developer repository.

Also, I have come to appreciate very much the wxpython AUI managed
frame, which lets you move panels, toolbars, whatever, to pretty much
any location within your frame. This means that anyone using your
application can customize their layout with trivial effort.

I doubt that I can get around to any of this until late next year, but I
would be happy to assist if you want to take a shot at it...

Cheers,
Eric Carlson

Nov 3 '08 #6

P: n/a
r
On Nov 3, 8:29*am, Eric Carlson <ecarl...@eng.ua.eduwrote:
Hello,

I have pondered this notion of a 3d sketcher a bit myself. Before I go
on, here is a quote from writer Neil Gaiman, author of some very good books:

"Every Published writer has had it - the people who come up to you and
tell you that they've Got An Idea. And boy, is it a Doozy. It's such a
Doozy that they want to Cut You In On It. The proposal is always the
same - they'll tell you the idea (the hard bit), you write it down and
turn it into a novel (the easy bit), the two of you split the money
fifty-fifty"

In this spirit, let me offer the following observations/suggestions:

Mayavi, the open source data visualization system from enthought.com,
does a very nice job of high-level wrapping of The Visualization
Toolkit. VTK has both high-level wrappings of OpenGL for display, as
well as many modules to import/export various 3D file formats, merging
or clipping 3D objects, constructive solid geometry, etc. All of the
lower-level VTK routines can be accessed through the traited VTK wrapper
(TVTK) from enthought. Once you have a Mayavi scene, it is a simple
matter to add anything to it, or to modify any of the objects in the scene.

Although Mayavi has evolved to be reasonably backend independent, the
current version interacts most easily with the wxpython GUI toolkit.
Given that they work well together, I would say that a combination of
wxpython, Mayavi, and enthought Traits (recent stable versions and
Python 2.5) could lead to a very interesting 3d sketching application.

If you install the wxpython demos and samples (an absolute necessity if
you program with wxpython), you can dig through the installation
directory and find a "samples" subdirectory, and in there you can find
another folder called "pySketch." This app is a nice 2D sketching
program with everything I really need for simple 2D sketches, except
rotating objects (and I had to hack it to get a button to save an image
and copy to clipboard) - it could probably also use buttons for various
common drawing objects. If nothing else, this example might give an idea
of a possible layout, and source for how to set it up.

For the 3d sketching, you would have to have some buttons for object
creation (various polyhedra, sphere, ellipse, arbitrary explicit
function, implicit function, constructive solid geometry surface, maybe
a library of predefined widgets), extruding, surfaces of rotations,
button or menu for importing/exporting an object, some buttons for
clipping and merging objects (additive and subtractive merges), some
buttons for object transformations (scaling, rotations, precise
placement in a scene, parametric stretching, twisting/turning, mirroring
objects), button for duplications, and buttons for setting object
materials/colors/properties.

There are many examples of embedding a mayavi scene in other
applications given in the examples directory at the mayavi/tvtk
developer repository.

Also, I have come to appreciate very much the wxpython AUI managed
frame, which lets you move panels, toolbars, whatever, to pretty much
any location within your frame. This means that anyone using your
application can customize their layout with trivial effort.

I doubt that I can get around to any of this until late next year, but I
would be happy to assist if you want to take a shot at it...

Cheers,
Eric Carlson
i don't see the gui as a problem, and i think using a toolkit would be
a good
idea at this point to get things going quickly.
i have looked at vtk and it looks promising.
Nov 3 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.