execute_code
Execute Python scripts within FreeCAD to drive parametric modeling and geometry operations. Optionally attach a screenshot to confirm the result.
Instructions
Execute arbitrary Python code in FreeCAD.
The code runs on FreeCAD's GUI thread with the full FreeCAD Python API
available (FreeCAD, FreeCADGui already imported; import Part/Draft/etc.
as needed). print() output is captured and returned.
Args:
code: The Python code to execute.
with_screenshot: Attach a screenshot after successful execution
(default: no screenshot).
Returns:
A message indicating the success or failure of the code execution, the
output of the code execution, and a screenshot only when requested.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| with_screenshot | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |