The fab solver is a software tool for computational geometry, with applications in CAD/CAM workflows. It was developed as part of the fab modules toolchain.

Objects are represented by mathematical expressions; a circle of radius 2 can be represented as X*X + Y*Y < 2*2. This representation is resolution and platform-independent.

GUI and Python Tools

I developed a set of Python functions to edit these math strings. The library includes common shapes (both 2D and 3D) and coordinate transformations.

In addition, I created a simple dual-panel GUI: Python script on the left and rendered image on the right. This closes the loop between code and output, allowing for real-time feedback.

cad_ui screenshot

The GUI was inspired by Bret Victor's talk, "Inventing on Principle".


To convert a math string into an solid object, the expression must be evaluated at each point on a 2D or 3D lattice. The solver is a tool to rapidly perform this evaluation. It is written in multithreaded C++ for speed and includes a variety of optimizations.

From a given math expression, it starts by generating a parse tree. Identical repeated expressions are combined to avoid unnecessary calculation.

Parse tree

The space is divided into a quad or octree, and evaluated using interval arithmetic to solve for large chunks at once. Unused branches of the tree are cached to speed up evaluation.

Quadtree demo

The output of the solver can then be used in the rest of the fab module toolchain, which goes from design to production.

External Links


Development log

Design tutorials