Give your AI agent eyes for CAD — with local, native CLI execution.
CAD Agent is now a CLI-first tool driven exclusively through ./cad.sh.
No HTTP server. No MCP transport. No agent-managed container orchestration.
AI agents can generate CAD code, but they need visual and geometric feedback to iterate reliably.
CAD Agent provides that feedback loop locally:
- Execute
build123dcode from a file - Render PNG previews
- Measure geometry
- Export STL/STEP/3MF
All through one stable command surface: cad.sh.
Use only:
./cad.sh setup./cad.sh doctor./cad.sh build ..../cad.sh render ..../cad.sh measure ..../cad.sh export ..../cad.sh all ..../cad.sh cli ...
./cad.sh setup
./cad.sh doctorsetup creates .env and installs dependencies.
doctor verifies Python + required packages.
Create workspace/part.py:
from build123d import *
base = Box(80, 40, 10)
hole1 = Cylinder(4, 12).locate(Pos(-25, 0, 0))
hole2 = Cylinder(4, 12).locate(Pos(25, 0, 0))
# Final shape must be assigned to `result`
result = base - hole1 - hole2./cad.sh build --code-file workspace/part.py --name part./cad.sh render \
--code-file workspace/part.py \
--name part \
--mode 3d \
--view iso \
--output renders/part_iso.png./cad.sh export \
--code-file workspace/part.py \
--name part \
--format stl \
--output exports/part.stl
./cad.sh export \
--code-file workspace/part.py \
--name part \
--format step \
--output exports/part.stepCreate local venv and install dependencies.
./cad.sh setupValidate runtime readiness.
./cad.sh doctorExecute CAD file and return build result JSON.
./cad.sh build --code-file workspace/part.py --name partBuild + render image.
Supported modes:
3d2dmultiviewblueprint
Examples:
./cad.sh render --code-file workspace/part.py --name part --mode 3d --view iso --output renders/part_iso.png
./cad.sh render --code-file workspace/part.py --name part --mode 2d --view front --output renders/part_front.png
./cad.sh render --code-file workspace/part.py --name part --mode multiview --output renders/part_multi.png
./cad.sh render --code-file workspace/part.py --name part --mode blueprint --views front,right,top,bottom --title "PART REV A" --output renders/part_blueprint.pngBuild + print dimensions/geometry summary.
./cad.sh measure --code-file workspace/part.py --name partBuild + export one format (stl, step, 3mf).
./cad.sh export --code-file workspace/part.py --name part --format stl --output exports/part.stlOne-shot pipeline: render + measure + STL + STEP.
./cad.sh all \
--code-file workspace/part.py \
--name part \
--view iso \
--render renders/part_iso.png \
--stl exports/part.stl \
--step exports/part.stepRaw passthrough to underlying CLI.
./cad.sh cli --helpYour Python file must:
- be valid Python
- use
build123d - assign the final geometry to
result
If result is missing, build may succeed but geometry operations can fail or be ambiguous.
- Write/modify
workspace/<model>.py buildrender(usually3d+multiview)- inspect output image
measurefor constraintsexportwhen approved
- Renders:
renders/ - CAD exports:
exports/(orworkspace/if no explicit output provided) - CLI output: JSON (agent-parseable)
- No output image appears
- Re-run with explicit output:
--output renders/<name>.png
- Check command exit code and JSON error output.
- Re-run with explicit output:
- Build failed
- Verify Python syntax and
build123dusage.
- Verify Python syntax and
- Render is blank
- Use
--mode 3d --view isofirst; renderer includes fallback backends.
- Use
- Dependency issues
- Re-run:
./cad.sh setup./cad.sh doctor
- Re-run:
This repo is configured to avoid accidental design-file commits:
.gitignoreexcludes CAD artifacts (*.stl,*.step,*.3mf, etc.)- output folders are local and intended to stay unversioned
- optional pre-commit hook can block CAD artifacts
Enable hooks:
git config core.hooksPath .githooks