Antimony • Parametric Graph CAD

CAD From A Parallel Universe

A computer-aided design (CAD) tool from a parallel universe in which CAD software evolved from Lisp machines rather than drafting tables. Built on functional representations (Signed Distance Fields / F-Reps) and Python 3 scripting.

v0.9.5 ReleaseWindows (.zip)macOS (.dmg)Signed Distance Fieldsroboter/antimonyMatt Keeter (Original Author)

Fork Notice: Added Windows Buildv0.9.5 Ready

This repository is a fork of Matt Keeter's Antimony. It is a fork where I added Windows build support, resolving MSVC/MinGW toolchain dependencies and providing portable pre-compiled Windows zip packages alongside the macOS releases.

antimony — screwdriver.sb (Modeling Session Demo)
1152 x 720 • 4m 44s Demo
Interactive Chapter Timeline00:00 / 04:44
Section: Intro & Workspace Setup00:00
(Chapter 1 of 6)

Screwdriver Modeling Session Workflow

Click any step below to jump directly to that section in the video

Antimony Release 0.9.5

Latest Release

Official Windows & macOS binaries hosted on GitHub Releases

View on GitHub

Windows Build

antimony-windows.zip • 41.4 MB
Added in Fork

Native Windows portable build with bundled Qt5, Python 3 runtime, and required dynamic libraries. Extract and double-click antimony.exe.

Download antimony-windows.zip (41.4 MB)

macOS Disk Image (DMG)

antimony-mac.dmg • 37.9 MB
Apple DMG

Standard macOS Disk Image bundle. Open the DMG and drag Antimony.app into your Applications folder.

💡 Running Antimony on Windows:

Extract antimony-windows.zip to any directory. No registry installation required. Double click antimony.exe to start modeling. If you encounter any missing runtime dependencies, you can also build from source using the scripts in the automated build section below.

“Antimony is a computer-aided design (CAD) tool from a parallel universe in which CAD software evolved from Lisp machines rather than drafting tables.”
Architectural Pillars

The Three Mostly-Orthogonal Axes

Unlike traditional monolithic CAD programs, Antimony is decomposed cleanly into three decoupled subsystems:

1. Directed Acyclic Graph

Information flow engine tracking dependencies, parameter inputs, and propagating edits downstream automatically.

Graph Engine →

2. Geometry Engine (CSG)

Solid modeling using functional representations (F-Reps) where boolean unions, intersections, and subtractions are mathematically exact.

Functional Math →

3. Standard Library & UI

Rich shapes and spatial transforms with bidirectional 3D UI hooks that allow interactive direct manipulation in viewport.

Python + UI Hooks →

1. Graph Engine (DAG & Scripted Nodes)

Directed acyclic graph tracking parameter flow and topological changes

Solid modeling in Antimony is performed by connecting nodes in a graph. Nodes typically represent primitive shapes (circles, cubes, cylinders) or transformations (extrusions, sweeps, rotations, CSG booleans).

Each node is defined by a customizable Python 3 script augmented with a few special keywords like input() and output() that declare ports and inject variables into the script namespace.

Automatic Downstream Change Propagation:

When any port value or node script changes, Antimony tracks the dependency graph and instantly recalculates only the affected downstream nodes, ensuring high performance even in deep DAG trees.

Antimony Node Graph connections
Node graph connecting circle shape and parametersAntimony DAG
Circle Node Definition (Python 3.x)
import fab.shapes

# Define a set of input ports
# (and inject variables into the local namespace)
input('x', float)
input('y', float)
input('r', float)

# Call the 'circle' function in the standard shapes library
# using the variables that came in from the input ports
c = fab.shapes.circle(x, y, r)

# Create an output port that produces the circle shape
output('shape', c)

Real-time Downstream Propagation

Dragging sliders or typing new values updates dependent nodes instantly across all links.

Antimony live change propagation animated demonstration

Scaling to Complex Assemblies

The DAG architecture scales seamlessly from single components up to multi-part mechanical assemblies (e.g., the Kelvin clamp assembly).

Antimony Kelvin assembly graph
Antimony full multi-part assembly viewport

2. Geometry Engine (Functional Representations & CSG)

Implicit surfaces, pure mathematical booleans, and shaded bitmap viewport blitting

Antimony's geometry engine uses functional representations (F-Reps) for solid modeling. Solids are defined by implicit mathematical equations f(x, y, z) < 0.

This representation is uniquely suited for Constructive Solid Geometry (CSG) operations:

  • Union: min(A, B)
  • Intersection: max(A, B)
  • Difference: max(A, -B)

In the application, the geometry engine renders shapes as shaded distance bitmaps which are then blitted directly to the interactive 3D viewport.

CSG Boolean example in Antimony
Exact Boolean Union & Difference operationsZero Topological Errors

Real-time Shaded Bitmaps & 3D Viewport

Shapes are evaluated in parallel on CPU/GPU raymarchers and blitted cleanly as shaded bitmaps.

Antimony Application UI with shaded viewport

Sharp Feature Detection in .STL Export

Antimony exports heightmaps for 2.5D CNC machining and watertight .stl files for 3D printing with feature detection algorithms that keep sharp edges crisp.

Antimony STL export with sharp crease feature detection

3. Standard Library & Bidirectional 3D UI Hooks (sb.ui)

Direct on-screen manipulation handles wired back into Python node parameters

Antimony's standard library defines dozens of shapes and spatial transforms, from standard primitives (cube, cylinder, sphere, circle, rectangle) and booleans to exotic deformations like attract, repel, twist, and bend.

Crucially, node scripts can define interactive 3D UI features using the sb.ui module. Wireframes and draggable control points are drawn directly over the 3D model.

Bidirectional Viewport Dragging:

These UI features are hooked back into the graph: dragging corner points or handles in the 3D viewport pushes coordinate updates back into the node's Python input ports in real time!

Interactive 3D UI handle dragging pushing changes back into node graph
Dragging 3D viewport handles updates node inputssb.ui Hooks
Rectangle Node with Viewport UI Handles (Python 3.x)
import fab

title('Rectangle')

input('xmin', float)
input('ymin', float)
input('xmax', float, 1)
input('ymax', float, 1)

output('shape', fab.shapes.rectangle(xmin, xmax, ymin, ymax))

# Interactive 3D Viewport UI Handles (sb.ui)
sb.ui.wireframe([
  (xmin, ymin, 0), (xmax, ymin, 0),
  (xmax, ymax, 0), (xmin, ymax, 0)
], close=True)
sb.ui.point(xmin, ymin, 0)
sb.ui.point(xmax, ymax, 0)

Under the Hood: Prefix String Distance Fields

Prefix string serialization for lightning-fast parsing and AST evaluation

While most users will work with high-level shapes, custom shapes in Antimony can be defined through a prefix string syntax that is easy to parse, serializable without paren ambiguities, and fast for machine code generation.

Here is the internal shape definition for the circle(x0, y0, r) shape:

def circle(x0, y0, r):
    return Shape(
        '-r+q-Xf%gq-Yf%gf%g' % (x0, y0, r), # prefix math string
        x0 - r, y0 - r, x0 + r, y0 + r) # bounding box
Hierarchical Prefix Tree Unpacking:
-
  r
    +
      q
        -
          X
          f%g
      q
        -
          Y
          f%g
  f%g
% (x, y, r)

Where q is square, r is square root, X, Y are coordinate axes, and f%g is a floating point constant.

Signed Distance Field Formula:
f(x, y) = √((x - x₀)² + (y - y₀)²) - r

Points where f(x, y) < 0 are inside the circle, points where f(x, y) = 0 define the exact mathematical boundary, and points with f(x, y) > 0 represent Euclidean distance from the boundary.

Documented in Appendix A of Matt Keeter's MIT Thesis

Automated Build & Launch Scripts

The repository includes turn-key automation scripts in the scripts/ folder for automated dependency installation, compilation, packaging, and execution.

Browse scripts/ on GitHub
Windows: build-windows.ps1 & run-windows.ps1Automated MSYS2 UCRT64 build & DLL runtime setup

Requires MSYS2 installed at C:\msys64. The script automatically installs mingw-w64-ucrt-x86_64 toolchain packages (Qt5, Python, Boost, Libpng, CMake, Ninja, flex, lemon), configures with CMake, and builds the executable.

# 1. Clone repository
git clone --recursive https://github.com/roboter/antimony.git
cd antimony

# 2. Run automated build script
.\scripts\build-windows.ps1

# 3. Run Antimony with runtime DLL PATH injected
.\scripts\run-windows.ps1
macOS: build-mac.sh & bundle-mac.shHomebrew dependency resolution, compilation & DMG packaging

Requires Homebrew. The script installs required formulas (libpng boost-python3 qt@5 lemon flex ninja cmake dylibbundler) and supports --bundle and --dmg flags.

# 1. Clone repository
git clone --recursive https://github.com/roboter/antimony.git
cd antimony

# 2. Make scripts executable and compile
chmod +x scripts/*.sh
./scripts/build-mac.sh

# Or build and create antimony-mac.dmg:
./scripts/build-mac.sh --dmg

# 3. Launch application bundle
open build/app/Antimony.app
Local CI Verification: run-ci-locally.ps1Executes full continuous integration pipeline locally

Validates the build and test suites locally using the same script that executes in the GitHub Actions CI environment.

.\scripts\run-ci-locally.ps1

MIT Center for Bits and Atoms (CBA) Heritage

Lineage from personal-scale digital fabrication workflows to mathematical CAD

Antimony grew out of Matt Keeter's research on powerful personal-scale CAD/CAM workflows at the MIT Center for Bits and Atoms (CBA) under Prof. Neil Gershenfeld.

It represents the culmination of a sequence of experimental digital fabrication CAD tools:

1. cad_ui (2012)

Initial experimental geometric solver exploring non-traditional boundary representations.

2. kokopelli (2013)

Pure Python text-to-F-Rep CAD tool used extensively in MIT MAS.863 “How to Make Almost Anything”.

3. Antimony → libfive

Visual DAG UI combined with Python node scripts, later evolving into the modern libfive geometric kernel.

Antimony was featured in the 2015 edition of Fab Academy, demonstrating how makers and engineers can design complex parametric geometries without commercial CAD licenses.