| name | fusion-agent-kit |
| description | Use when building, modeling, editing, or 3D-printing a part in Autodesk Fusion 360 from an AI agent (Claude Code, Codex, etc.) via the Fusion MCP bridge - any "design/model/CAD this part", parametric modeling, screw threads, enclosures, brackets, or STL export task. |
fusion-agent-kit
Overview
Drive Fusion 360 from an AI agent by writing a re-runnable Python build script that calls fusion_helpers.py. The model is defined by code, not clicks: every dimension is a named parameter, every feature is rebuilt by a build_*() function, and set_param(...); build_all() regenerates the whole part. This makes design iteration cheap and the result fully reproducible (you can kill Fusion and rebuild in one call).
Core loop: brainstorm the part -> write build_<part>.py -> run it -> screenshot -> adjust params -> export. You see what you build at every step.
Prerequisites
- The Fusion 360 MCP bridge tool
mcp__fusion360__fusion_execute (runs Python with full adsk.* API inside Fusion). fusion_screenshot exists but its inline base64 usually exceeds the token limit -- use the helper's screenshot() (saves a PNG you then Read).
fusion_helpers.py from this repo (load it with exec(open(path).read())).
Workflow
- Brainstorm first. Don't model immediately. Clarify the object, its real measurements, how it mounts/assembles, and the retention/joining mechanism. Confirm with the user (sketches/ASCII help). Wrong assumptions here waste the most work. Write a short spec.
- Load helpers + a fresh doc. In one
fusion_execute call:
exec(open('/abs/fusion_helpers.py').read()) -> set_output_dir('/abs/project/output') -> new_design_doc(). Always build into a fresh doc; re-running into a stale one leaves dead features.
- Write
build_<part>.py following the structure below. Load it the same way and call add_*_params(); build_all().
- Verify visually every step.
screenshot('iso.png', 'iso-br') then Read the PNG. For internal features, render a cross-section (cut a copy with a big box, screenshot, undo).
- Iterate by parameter.
set_param('wall','4 mm'); build_all(). Never hand-edit geometry you can re-derive.
- Export.
export_stl('Body','part.stl') for printing; export_f3d('/abs/Part.f3d') to hand the user an openable file (the API saveAs is blocked in MCP/headless contexts, so .f3d export is how you deliver a file).
Build-script structure
Mirror examples/puck-cradle/build_puck_cradle.py:
MM = 0.1
def add_part_params(silent=False):
return add_params({ "wall": ("3 mm","mm","wall thickness"), ... })
def _dims():
...
def build_body():
...
return body
def build_demo():
def build_export():
def build_all(shoot=True, demo=True, export=False):
add_part_params(silent=True); build_body(); ...; state_compact()
Each builder must clean its own features (delete_matching('Prefix') + delete its body) so build_all() is idempotent.
Quick reference (helpers)
| Need | Helper |
|---|
| Fresh parametric doc | new_design_doc() |
| Params | add_params(spec), get_param_mm(n), set_param(n, expr) |
| Find | find_body, find_sketch, find_feature, find_component |
| Sketch (cm coords) | sketch_rect_by_corners, sketch_rect_centered, sketch_rounded_rect |
| Solids | extrude_new_body, extrude_cut_from_profile, combine_cut, combine_join |
| Patterns/edges | pattern_rect, fillet_all_edges, cp_offset |
| Timeline | delete_matching, suppress_matching, group_timeline |
| Inspect | state_dump(), state_compact(), count_circular_faces |
| Output | set_output_dir, screenshot, export_stl, export_f3d |
Threads: use ThreadFeatures with isModeled=True and a standard designation from threadDataQuery (e.g. M62x3, TR60x3). See gotchas.
Read this before you build
REQUIRED: references/gotchas.md - hard-won Fusion API traps (units, ASCII encoding, sketch-axis flips, mesh-boolean timeouts, modeled threads, the save block). Skipping it will cost you a rebuild.
Common mistakes
- Modeling before brainstorming -> wrong mechanism, repeated rework.
- Stale doc -> dead features error out. Use
new_design_doc().
- Unit mix-ups -> sketch coords are cm (
*MM); extrude distance strings are mm ("12 mm") or param expressions. Never *10 an already-mm value.
- Trusting it built -> always screenshot/section and check
lumps==1.
- Mesh booleans -> converting an STL mesh to BRep then joining is slow and can exceed the tool timeout (Fusion keeps working -- wait and re-query, don't kill).