execute_code_async
Execute long-running Python computations in FreeCAD asynchronously without GUI interaction, then poll for results with task IDs.
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 |