You have access to agentcad, a CLI that turns build123d or CadQuery Python scripts into
3D geometry. All output is JSON. Every command returns "command" and "status" keys.
agentcad init --name <project_name>
agentcad --help # Read this — it is your complete operational briefing
show_object, and agentcad edit helpers are pre-injected by default.
show_object(result) is required.
```bash
agentcad run script.py --output test --dry-run
```
Check volume, dimensions, is_valid in the response.
```bash
agentcad run script.py --output label
```
Every successful run produces (paths in the JSON response):
preview.png — 4-view composite (front, right, top, iso). Read thisto confirm the part looks right before iterating. One image, all 4 angles.
diff.side_by_side — side-by-side PNG vs the most recent successful priorversion. Read this when iterating to see what your change did.
diff.overlay — tinted (green prev, red this) overlay for subtle shifts.Read only if side-by-side didn't resolve the question.
viewer.html — interactive 3D viewer for the user (humans only; you can'trender HTML). Mention it to the user so they open it.
Pass --no-preview only for tight parametric sweeps where latency matters.
```bash
agentcad view v1_label/viewer.html # or output.step / output.glb
```
Users expect to see the result in a browser. Do this every run, unprompted.
is_valid: false or geometry looks wrong:```bash
agentcad inspect v1_label/output.step
```
--output label. Use agentcad diff 1 2 to compare versions.
show_object(result) is required — at least one call. build123d primitives like Box, Cylinder, Sphere, Plane, plus
show_object, load_step, pick_face, pick_edge, fillet_edges,
chamfer_edges, shell_faces, cut_pocket, boss, split_by_plane,
and replace_face.
import cadquery as cq, initialize with agentcad init --runtime cadquery, or pass --runtime cadquery.
TopoDS_Shape. Bridge with .val().wrapped:```python
import cadquery as cq
part = cq.Workplane('XY').box(10, 20, 5).val().wrapped
moved = translate(part, 50, 0, 0)
```
```python
import cadquery as cq
show_object(cq.Workplane('XY').newObject([cq.Shape.cast(topo_shape)]))
```
gp_Pnt, BRepPrimAPI, etc.), import manually.| Command | Purpose |
|---|---|
| --------- | --------- |
agentcad init --name NAME | Initialize project |
agentcad run SCRIPT --output LABEL | Execute script, produce STEP + metrics |
agentcad run ... --dry-run | Metrics only, no version consumed |
agentcad run ... --no-preview | Suppress preview (on by default) |
agentcad run ... --render iso,front | PNG views |
agentcad run ... --export stl,glb | Mesh export |
agentcad run ... --params k=v,k=v | Override script parameters |
agentcad render STEP --view SPEC | Post-hoc renders with camera control |
agentcad export STEP --format stl,glb | Post-hoc mesh export |
agentcad inspect STEP | Topology report (validity, free edges) |
agentcad diff REF1 REF2 | Compare versions |
agentcad context | Project state |
agentcad docs [SECTION] | Deep-dive docs (16 sections) |
agentcad view FILE | Run this after every successful build — opens GLB/STEP in the user's browser |
volume and dimensions catch most issues.preview.png — the 4-view composite. Fastest way to spot obvious problems.diff.side_by_side if iterating — confirms your change did what you intended.agentcad inspect — check free_edge_count and shell status.free_edge_count > 0 means open shell. a blank cylinder/box instead of building up. See agentcad docs patterns.
translate() and rotate() to place it.
makeCompound() for assemblies (parts stay separate), .union() for boolean fuse into one solid.
--params. Use this for iteration.
show_object(shape, name="wheel", options={"color": "red"})for per-part metrics and colored GLB export.
共 3 个版本