Skip to content

benmfzen/inanimatus

Repository files navigation

Inanimatus

ci

Conjuring solid objects from precise incantations.

Concretely: a documented workflow and Claude Code skill for producing reproducible, geometry-tested CadQuery models from dimensioned specifications — written for the case where an LLM writes the CAD code. (Named after the Inanimatus Conjurus spell: the charm for conjuring inanimate objects. Like any spell, it only works if the incantation is precise.)

Chamfer-band cube

This repo was distilled from real projects that went through every failure mode first — including driving Blender interactively through an LLM, which is where the method started and what it argues against. It ships as three things: the method docs, a Claude Code skill that applies them, and two worked examples with geometry tests and CI.

The three lessons

1. Images are not a spec. Vision models extract qualitative intent from a sketch ("a chamfer runs diagonally across the edge") but guess at quantitative geometry — dimensions, radii, proportions. In CAD the number is the product. Use sketches for intent, and give every dimension as an explicit number.

2. Decompose into layers, described precisely. The object is specified as profiles on Z-planes — each with an explicit width and corner radius — connected by lofts. Translating an explicit spec into code is what LLMs are good at; inferring geometry from vague prose is what they're bad at. The cross-section method formalizes this, and as a side effect it dodges the classic CAD-kernel failures (chamfer-after-fillet collisions, boolean cuts through rounded edges, order-dependent feature chains).

3. One declarative script, one run — never mutate state you can't observe. Driving a modeling session step by step (e.g. through a Blender MCP connection) fails structurally for an agent: the model mutates state it cannot see, the scene drifts from the model's idea of it, and errors surface only after the geometry is already garbage. A script that regenerates the whole object each run is reproducible, reviewable, and parametric — errors crash loudly as exceptions instead of silently as bad geometry. Iteration happens by editing the spec and re-running the whole script, then checking a render and the geometry tests.

A note on scope: these are guardrails for a blind agent, not universal CAD law. Interactive parametric CAD in the hands of a human who can see the viewport is perfectly reproducible; sweeps, revolves, and well-controlled booleans are legitimate tools for outer forms. The rules below are deliberately stricter than general CAD practice because the author of the script cannot look at the screen.

Worked examples

Stepped stand — the cross-section method, straight

A 78mm pencil cup built entirely from the profile table: a foot with a step, a long concave flank lofted through its low point, a shallow groove near the top, a 45° chamfer rim with the corner radius carried through (concentric by construction) — and the bore as the only boolean, last. Every feature of the outer form is a row in one spec table.

Chamfer-band cube — the diagonal special case

A 54mm cube wearing a continuous 6mm chamfer band along the cube's Petrie hexagon — six edges forming one closed loop, while the other six stay sharp. The band can't be expressed in horizontal cross-sections or as a plain chamfer() call; it falls out of six overlapping 45° half-space cuts (script). A diagonal slot turns it into a remote holder.

stepped stand chamfer-band cube

Quickstart

git clone https://github.com/benmfzen/inanimatus && cd inanimatus

# CadQuery needs Python 3.10–3.12
python3.12 -m venv .venv && source .venv/bin/activate
pip install -r requirements.lock   # pinned, reproducible

# Build an example (one run: STEP + STL)
cd examples/stepped_stand && python stepped_stand.py && cd ../..

# Run the geometry tests
pytest

# Render verification views (optional, needs Blender ≥ 4.2)
blender --background --python tools/render_stl.py -- \
    examples/stepped_stand/stepped_stand.stl examples/stepped_stand/renders
# macOS: use /Applications/Blender.app/Contents/MacOS/Blender

Verification: render + geometry tests

"Render and compare against the spec" catches shape intent; tests/ catches what a render can't — for each example: exactly one valid solid, bounding box matches the spec, volume within 2% of the spec-derived expectation, holes open at the right depth, minimum wall thickness above the print rules, exported STL watertight and winding-consistent. CI runs the tests and rebuilds both examples from scratch on every push.

The Claude Code skill

skill/3d-object-design/ packages the method as a skill: capture the spec as explicit numbers → decompose into cross-sections → write the one-run script → render → compare against the spec. Install it by cloning this repo and linking the skill into your skills directory:

ln -s "$(pwd)/skill/3d-object-design" ~/.claude/skills/3d-object-design

Then ask Claude Code to design an object and it will hold you (and itself) to the method — including refusing to guess dimensions you didn't give it.

Method docs

  • Cross-section method — profiles on Z-planes + lofts instead of feature chains
  • Surface method — constructed faces and G1 patches for diagonal features
  • Print design rules — measurable FDM rules: walls, overhangs, fits, chamfer-below-fillet-above
  • Toolchain — pinned versions, export tolerances, known kernel limitations

Honest limitations

  • The chamfer band's corners are mitered (G0). The G1 upgrade path (Coons/N-sided patches at the vertices) is documented in the surface method but not yet implemented in the example.
  • The "declarative spec" is currently named Python constants plus a disciplined convention — not yet a machine-validated format (see roadmap).
  • The method is developed and tested for FDM printing with a 0.4mm nozzle; the design rules cover resin only in passing.

Roadmap

  • Machine-readable spec format (YAML profile tables) with schema validation, so the spec can be diffed against the built model automatically
  • G1 vertex patches for the chamfer band example
  • Automatic verification report (solid count, B-rep validity, bounding box, watertightness, minimum wall) as a console summary after each build

License

MIT

About

Conjuring solid objects from precise incantations — a declarative method for LLM-driven CAD (CadQuery + Claude Code skill)

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages