Building the enclosure in Fusion
The scripts in scripts/ are the source of truth. The Fusion document is a disposable render of them. Change the
script and rebuild. Hand edits in the Fusion GUI are lost on the next build.
Steps
- Fusion ready. Run the runner below with an empty body. If there's no active design, create one and import
boardmodel/ESP32-S3-Touch-AMOLED-1_75.stpinto the root at identity (importManager.createSTEPImportOptions+importToTarget). Done when the root has occurrenceESP32-S3-TOUCH-AMOLED-1_75_ASM:1. - Edit. Parameters live in the
Pdict at the top ofscripts/enclosure.py. Values derived from them go inderived(). Geometry goes inbuild_shell/build_cap/build_refs. Helpers go inscripts/wslib.py. - Rebuild with the runner.
build(overrides)accepts a dict for quick experiments, e.g.{'lattice': False}(a rebuild without the lattice takes about 1 s; with the v2 fine knit about 12 s). Done when it printsbuilt in …with no traceback. - Verify using the
fusion-inspectskill. A build is only done when the checks printPASSand you've looked at a screenshot.
Runner (paste as the MCP script)
import sys, importlib
REPO = r'C:\Github\claudesk\3d-model\scripts' # absolute path to 3d-model/scripts in your clone
if REPO not in sys.path: sys.path.insert(0, REPO)
import wslib, enclosure, checks
for m in (wslib, enclosure, checks): importlib.reload(m)
def run(_context: str):
enclosure.build() # or enclosure.build({'sphere_d': 90})
Fusion's Python caches modules between runs. Always keep the reload line, or edits won't take effect.
If the mcp__fusion__* tools are missing
When the MCP server failed to connect at session start (e.g. Fusion wasn't running yet), check that Fusion is up
(netstat -ano | grep 27182 shows LISTENING). Then either ask the user to reconnect with /mcp, or call the endpoint
directly: save the runner to a file and run python scripts/fmcp.py script runner.py.
For a screenshot, run python scripts/fmcp.py shot out.png [direction].
Conventions
- Work in mm through
wslib(P(),box(),cyl_y(), …). Only raw API calls see Fusion's cm, viawslib.MM. - Model with temporary B-Rep (
wslib.tbm()and theunion/cut/intersecthelpers), then commit withadd_bodies. This is fast, needs no timeline, and works in both parametric and direct designs. - Each build deletes and recreates the top-level components
Enclosure(Shell, Cap) andRefs.Refsholds ghost bodies (PlugGhost, SpeakerGhost) for parts we don't have CAD for. They only exist for clash checks and are never exported. When a new bought part matters for fit, add a ghost for it. - Frame: the board STEP as imported. +Y is the viewing direction, the glass front is at y=2.78, the USB-C mouth faces -X, and the desk sits below -Z, tilted back by
base_tilt(30°) so the screen faces up at the user (derived()['down']). - Board facts come from measuring the STEP. Measure with a script and record them in
CLAUDE.mdrather than guessing from the PDF. - Let exceptions propagate. The traceback is the only failure signal the MCP returns.