run_script
Run custom FreeCAD Python on a document when no dedicated CAD tool fits; save changes, return printed output and a result dict, and add generated geometry via add_shape.
Instructions
Escape hatch: run arbitrary FreeCAD Python in the worker on doc (saved afterwards). Predefined: App (=FreeCAD), Part,
V (Vector), doc, result (a dict you can fill; it is returned), add_shape(doc, name, shape, material=None). print()
output is returned. Use only when no dedicated tool fits; geometry made here should go in via add_shape so other tools
see it.
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": {
"doc": "<doc>",
"code": "<code>"
},
"name": "run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | ||
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |