Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Python bindings for OpenSCAD
C++ C Python Shell Emacs Lisp
branch: master

This branch is 33 commits ahead, 4811 commits behind openscad:master

Merged pull request #11 from brad/master.

Ordered transformations
latest commit 886c09b7e6
@itdaniher itdaniher authored
Failed to load latest commit information.
contrib
doc suggestions for constants
examples makes transformations ordered
icons Moved progress display to status bar. Disabled by default but can be …
patches updated to support an installation dir
qxs Merge branch 'qcodeedit' of http://www.gilesbathgate.com/openscad int…
scripts Upload script for binaries
src Made the bool initialiser call the right constructor.
test-code Copyright updates
.gitignore ignore eclipse project files
COPYING Clifford Wolf:
Info.plist Experimental Apple Event hack; you can now do 'tell application "Open…
OpenSCAD.sdef Experimental Apple Event hack; you can now do 'tell application "Open…
README-openSCAD added back in the original openSCAD README
README.mkd fix link in readme
RELEASE_NOTES Update for 2011.01
bison.pri update qmake file for visual C++ builds
boost.pri update qmake file for visual C++ builds
build.sh nevermind. kevin says that's a bad idea. also, nice weather today.
cgal.pri update qmake file for visual C++ builds
eigen2.pri Extracted eigen2.pri
flex.pri update qmake file for visual C++ builds
glew.pri Use DEPLOYDIR independant of deploy config
mjau.gdb MDI fix and Mac environment for qcodeedit
opencsg.pri Use DEPLOYDIR independant of deploy config
openscad.pro Merge openscad/master
openscad.qrc Moved progress display to status bar. Disabled by default but can be …
openscad_win32.rc Copyright updates
pyscad.py makes transformations ordered
setenv_mjau.sh Use release libs also when developing
valgrind.supp Clifford Wolf:

README.mkd

pySCAD: Parameteric Python Design

About OpenSCAD:

OpenSCAD is an interactive constructive solid modelling tool which provides the ability to design, extrude, and compile 3D objects using a custom C-like syntax.

Built on Qt4, CGAL, OpenCSG, and Eigen, OpenSCAD allows users to describe objects with a functional language, providing a WYSIWYM(what-you-see-is-what-you-mean) interface to solid objects, in a similar paradigm to LaTeX.

This tool provides transformations including scale, rotate, translate, and mirror as well as operations including union, difference, and render intersection. Using just these functions, a wide user base have produced a number of objects including a RepRap variant, from simple starting blocks: cubes, spheres, cylinders, and polyhedra.

It's received lots of good press for its easy of use, versatility, and extensive functionality. However, it uses a custom, slightly archaic syntax, doesn't integrate well with other tools, lacks customization, and requires significant overhead.

We sought to change that.

Why PySCAD?

Python is the language of choice for many developers, especially in the desktop manufacturing sector. Skeinforge, a vital component of the printing process for both Makerbots and RepRaps, is written entirely in Python. It provides multiparadigm programming and a wide range of libraries ranging from computer vision, natural language processing, to web handling. As such, it makes an ideal base for to expand OpenSCAD.

A set of Python bindings to OpenSCAD would provide a familiar syntax, optional object-oriented coding, and greatly increase the ability for automating the design of solid objects.It will hopefully become trivial to add extended functionality to 3d models.

For example, Eagle CAD, one of the most common circuit design tools, is moving to an XML format for boards and parts. It will soon be possible to parse board design files in Python. The next step would be writing a script to automatically design, compile, and print a case for an arbitrary circuit board.

A more futuristic example would be leveraging a text-to-speech engine and a natural language toolkit to allow verbal design of 3d objects.

Technical Details

PySCAD uses ctypes to bind with the existing OpenSCAD code. OpenSCAD internally represents parsed code as an Abstract Syntax Tree (AST). This AST is then evaluated into a tree of nodes that are passed to OpenCSG. PySCAD integrates at the AST level, because it allows us to re-use OpenSCAD's constructors for primitives, as well as wrap other functionality, such as DXF import. A small shim, src/python.cc exposes a C API for instanting OpenSCAD AST objects and forcing OpenSCAD to render them. This is wrapped in a pythonic, object-oriented API.

What's Next?

Lots more development. This project is pre-alpha; we have a solid direction, but lots more to add. Even so, this code provides a useful interface to OpenSCAD. Ian is working on a wrapper library which will provide an object-orented interface to OpenSCAD functions. Kevin is continuing to rock the low-level C++ hacking. We're actively looking for more help. Feel free to drop us a line via Kevin's Blog or Ian's Site.

Something went wrong with that request. Please try again.