Using the AI CAD agent
The PrintPal AI CAD Modeler is a chat-driven parametric CAD agent. You describe parts in plain English (and optionally images), it writes editable OpenSCAD, renders live in your browser, and exports to STL, 3MF, STEP, OFF, and SCAD. This guide walks the whole workflow.
The agent does the writing. Read the OpenSCAD references (cheat sheet, tutorial) only when you want to understand or hand-edit the generated code.
The interface, at a glance
The modeler is a three-pane layout:
- Chat (left) — your conversation with the agent. Every turn shows the prompt, the agent's reply, the design brief, and tool cards for each step (parse, generate, render, validate).
- 3D viewer (center) — live in-browser preview of the current model. Orbit with left-drag, pan with right-drag, zoom with the wheel. Click a feature in the viewer to highlight it in chat.
- Code / parameters (right) — toggle between Code mode (the raw OpenSCAD source) and Build mode (a parameter sheet auto-derived from your variables).
Your first prompt
Open /tools/3d-cad-modeler and type a part description. Be specific about dimensions and use cases — the more constraint the agent has, the fewer turns to a finished part.
Good first prompt
M3 corner bracket, 30 mm legs, 4 mm
thick, two countersunk M3 holes per
leg with 6 mm head and 1.7 mm depth.
Weak first prompt
I need a bracket
The weak prompt isn't wrong — the agent will ask clarifying questions before generating. It just costs you an extra turn. For more on prompt structure, see Prompting for CAD.
The design brief
On the first turn the agent commits to a design brief — a short structured summary of what it intends to build: envelope (bounding box), feature list, materials/printability notes, and any assumptions it made. The brief is checked against the actual render bbox after every generation.
The brief lives at the top of the chat. Click any feature in the brief to highlight it in the 3D viewer.
Feature references (@feature)
The agent annotates named feature groups in the code with
// @feature: snake_case_name. These tags are stable:
they survive across regenerations even if the surrounding code is
rewritten.
// @feature: mounting_holes
module mounting_holes() {
for (p = [[5,5],[35,5],[5,25],[35,25]])
translate([p[0], p[1], -1])
cylinder(h=10, d=3.2, $fn=32);
}
Reference them in chat to make surgical edits:
make @feature[mounting_holes] 4 mm biggeradd a chamfer to @feature[mounting_holes]delete @feature[mounting_holes] and replace with slots
An autocomplete picker (@) opens above the composer, just like Cursor's autocomplete. Other reference types: @param (variables), @module (any user module), @hardware (BOSL2 fasteners).
Build mode vs code mode
- Build mode — auto-generated parameter sheet. Drag sliders, type values, watch the model re-render in milliseconds. Best for tweaking sizes and counts.
- Code mode — the raw OpenSCAD source with syntax highlighting and
@featurechips. Best for surgical edits, copy/paste between projects, or learning OpenSCAD by example.
You can switch freely; the agent picks up your hand-edits on the next turn without losing context.
Iterating
The agent is designed to be conversational. Iterate in small steps:
- Generate the base part ("M3 corner bracket, 30 mm legs...").
- Refine ergonomics ("add a stiffening rib between the legs").
- Refine hardware ("make the holes countersunk for M3 flat-head screws").
- Refine printability ("increase wall thickness to 3 mm and add a 0.4 mm chamfer to the bottom edges").
- Refine fit ("shrink the hole pattern to 25 mm × 25 mm to match a NEMA17 motor").
Auto-fix & auto-iterate
Two background loops keep the agent honest:
- Auto-fix on compile errors. If the generated OpenSCAD doesn't compile, the agent is silently re-prompted with the error and the failing program, asked to repair, and re-runs. The loop is bounded so a chatty model can't spin forever.
- Auto-iterate against images. When you attach a reference image (sketch, photo, screenshot), the agent runs a self-critique pass for up to 2 rounds: a 4-view technical sheet of the render is sent back to the model with "does this match the reference?", and the model refines.
Validations after every render
- Bbox check — the actual render bounding box is compared against the envelope the agent committed to in the brief. Mismatch surfaces in the chat with the diff.
- Manifold check — the mesh is watertight, every edge shared by exactly two faces, no zero-area triangles.
- Printability hints — minimum wall thickness pass for FDM (≥ 1.6 mm by default), overhang detection, and unsupported floor warnings.
Failures appear as warn-colored tool cards in chat — the next turn knows about them, so you can simply say "fix it" or describe a targeted change.
Reference images
Drop a sketch, photo, or screenshot into the chat composer. The vision-capable agent will read it, ask any clarifying questions, and generate parametric code that matches.
Supported sources:
- Hand sketches on graph paper (best for mechanical parts).
- Front/side/top photos of an existing part you're recreating.
- Screenshots of other CAD or marketing images for stylistic reference.
See Image-to-CAD workflow for a deep dive.
Session history
Every session autosaves to your account once you take a meaningful action (first chat send, first scene change, first code edit). The History drawer in the topbar lets you browse, search, rename, and reload any prior session — chat, code, parameters, viewer settings, and the design brief all come back exactly as you left them.
Exporting
Hit the Export button in the top-right of the viewer:
| Format | Best for |
|---|---|
.stl | Slicers (Bambu Studio, PrusaSlicer, OrcaSlicer, Cura). |
.3mf | Modern slicer-native bundles with embedded metadata, units, and per-part colors. |
.step | Real ISO-10303-21 AP214 BRep for Fusion 360, SOLIDWORKS, Onshape, FreeCAD, NX, Creo. |
.off | Text-based mesh for academic tools. |
.scad | Raw OpenSCAD source for further iteration in any OpenSCAD-compatible toolchain. |
All exports run client-side via OpenSCAD WebAssembly — they hit no server and cost no credits.
How AI usage is billed
Pay-as-you-go via API credits. There is no monthly subscription required. Editing, rendering, exporting, and browsing your session history are always free — those run entirely in your browser. Only AI generation turns are metered. Enable auto top-up in Buy credits so you never run out mid-project.
Keyboard shortcuts
| Shortcut | Action |
|---|---|
| Enter | Send the chat message. |
| Shift + Enter | New line in the composer. |
| @ | Open the autocomplete picker for features / params / modules. |
| Ctrl/⌘ + click chip | Pin a feature highlight that persists across edits. |
| Esc | Cancel an in-flight generation. |
Ready? Open the modeler.
Describe a part — the agent has the brief, validations, and exports ready before you finish your coffee.