execute_python
Run Python scripts inside Fusion to automate CAD/CAM workflows, inspect geometry, and create toolpaths using preloaded API objects and persistent variables.
Instructions
Run Python inside Fusion on its main thread.
Pre-bound (refreshed each call): app, ui, adsk, math, doc (active document), design, root (design.rootComponent), cam (CAM product or None), mm(v) mm->cm, deg(v) deg->rad. Variables persist between calls. Raw API lengths are CENTIMETERS. print() output is returned; a trailing bare expression is echoed like a REPL. Never close or save documents you did not create. Avoid long loops: the main thread is blocked while this runs.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "execute_python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout_s | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |