execute_code_async
Run Python code asynchronously in FreeCAD to avoid GUI blocking. Ideal for CPU-heavy OCCT computations on existing shapes; poll results via task ID.
Instructions
Execute Python code in FreeCAD without waiting for completion.
Background thread, NOT the GUI thread: the code must NOT touch FreeCADGui,
the active view/selection, document objects, recompute, or save — for any
of that use execute_code instead (the safe default). Only for long pure
OCCT/CPU computations on already-fetched shapes. Use task_print(...) for
output (print() is not captured); poll with get_task_result(task_id).
Args:
code: Background-safe Python code to execute.
Returns:
A message with the task_id for polling via get_task_result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |