jay3sh / cadmium

Python library for Solid Modelling
http://jay3sh.github.com/cadmium
Other
59 stars 15 forks source link

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).

Screenshots and examples

http://jay3sh.github.com/cadmium/.

Typical Solid modelling code with 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')

Getting Cadmium

git clone https://github.com/jayesh3/cadmium.git cadmium
cd cadmium
python setup.py install

Getting Dependencies - PythonOCC

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.

Running example code

python examples/<python-script> <filename.stl>

Details

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.