Python library for Solid Modelling
Clone or download
Latest commit f4b7862 Sep 4, 2014
Failed to load latest commit information.
docs Include glyph and text in docs Nov 28, 2011
src step file import and export without veroboseness Sep 4, 2014
tests Tests to detect regression in primitive solid generation Oct 4, 2011
LICENSE minor May 28, 2011 Update Jan 23, 2013

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

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


Getting Cadmium

git clone cadmium
cd cadmium
python 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>


Cadmium is inspired by the OpenSCAD project, but it is a completely independent implementation. Here is what is different about Cadmium.

  • Write your code in Python. No need to learn new syntax. Use your favorite python features as you do advanced calculations for solid modelling.
  • Cadmium has no GUI. It only generates STL files (other formats may be supported in future). You can view these STL files in your favorite STL viewer, on your favorite OS. Becase Cadmium has no GUI, it's very light weight and has minimal dependencies. Hence it should be portable to any platform on which you can install PythonOCC
  • All of the Cadmium code itself is written in Python, hence easy to maintain
  • Cadmium is only creates easy-to-use abstraction on top of PythonOCC. All the real work is done by PythonOCC and the underlying OpenCASCADE library.

Cadmium is a work in progress. Bug reports and patches are welcome.