Cadmium is a python library for Solid Modelling
Cadmium allows you to write python code to create primitive objects (Box, Cylinder, Sphere, etc.) and apply CSG operations (Addition, Subtraction, Intersection) on them to create advanced solid models. The primitives have support for affine transformations too (translation, rotation).
http://jay3sh.github.com/cadmium/.
from cadmium import *
box = Box(x=4, y=4, z=4).rotate(Z_axis, 30)
cyl = Cylinder(radius=2, height=4).translate(-1,0,0)
solid = box + cyl
solid.toSTL('solid.stl')
git clone https://github.com/jayesh3/cadmium.git cadmium
cd cadmium
python setup.py install
Cadmium depends on PythonOCC which in turn requires OpenCASCADE.
The easiest way to setup PythonOCC and OpenCASCADE is to do it in Ubuntu server VM (unless you run Ubuntu natively). Although, PythonOCC includes some GUI utilities Cadmium doesn't need them, so you can use Ubuntu server VM.
To install OpenCASCADE just do apt-get install libopencascade-dev
. You can get PythonOCC from here. If you choose to build it from source these instructions are helpful.
python examples/<python-script> <filename.stl>
Cadmium is inspired by the OpenSCAD project, but it is a completely independent implementation. Here is what is different about Cadmium.
Cadmium is a work in progress. Bug reports and patches are welcome.