# Tools [Back to README](../README.md) · [Configuration](configuration.md) · [Code execution](execution.md) ## Available tools | Tool | Purpose | | --- | --- | | `create_document` | Create a new FreeCAD document. | | `list_documents` | List open documents. | | `reload_document` | Close and reopen a saved document to pick up external file changes, such as results from a headless script. | | `create_object` | Create an object in a document. | | `edit_object` | Edit an object's properties. | | `delete_object` | Delete an object from a document. | | `get_objects` | Get all objects in a document. | | `get_object` | Get one object in a document. | | `get_view` | Get a screenshot of the active view. | | `execute_code` | Execute Python code on FreeCAD's GUI thread. | | `execute_code_async` | Start a background computation and return its job ID; use `commit()` for document and view access. | | `get_async_status` | Get background job state and failure tracebacks without using the GUI thread. | | `execute_code_headless` | Run a script in a separate `freecadcmd` process and return its exit status and output. | | `get_rpc_status` | Report RPC and GUI-dispatch health, addon version, and version check without using the GUI thread. | | `insert_part_from_library` | Insert a part from the [FreeCAD parts library](https://github.com/FreeCAD/FreeCAD-library). | | `get_parts_list` | List parts in the [FreeCAD parts library](https://github.com/FreeCAD/FreeCAD-library). | | `run_fem_analysis` | Run CalculiX on an existing analysis and return summary results. | See [code execution](execution.md) for execution modes, shared script state, background job tracking, and timeout handling. ## Screenshot options The following tools return optional screenshots: `create_object`, `edit_object`, `delete_object`, `execute_code`, `insert_part_from_library`, `get_objects`, `get_object`, and `run_fem_analysis`. | Parameter | Default | Purpose | | --- | --- | --- | | `include_screenshot` | `true` | Set to `false` for text-only feedback, such as analytical scripts or intermediate steps. | | `view_name` | `"Isometric"` | Orient the returned screenshot, for example `"Front"`, `"Top"`, or `"Right"`. | The [`--only-text-feedback` flag](configuration.md#text-feedback-and-screenshots) suppresses these optional screenshots regardless of `include_screenshot`. Use `get_view` to request a screenshot explicitly; it is available even with `--only-text-feedback`. It takes `view_name` and optional `width`, `height`, and `focus_object` parameters. With both dimensions omitted, images retain the viewport aspect ratio with a maximum edge of 1024 pixels. With only one dimension supplied, the other uses the viewport dimension. Optional screenshots are omitted when the requested document is not the displayed document; they never show another document. Supported views are `Isometric`, `Front`, `Top`, `Right`, `Back`, `Left`, `Bottom`, `Dimetric`, and `Trimetric`. ## FEM analysis `run_fem_analysis` runs the CalculiX solver on an existing `Fem::FemAnalysis` container. It auto-creates a `SolverCcxTools` if the analysis has none and returns max von Mises stress, max/min displacement, node count, and the solver's working directory. The default `timeout` is 600 seconds. The reply includes `solver_object`, the new `result_objects`, and `applied_loads` (forces in N with faces and direction, pressures in MPa, fixed faces). Loads are captured inside the same GUI operation as the solve, after recomputation. If a supported load cannot be read, the solve stops with an error. Set `ConstraintForce.Force` with an explicit unit, e.g. `"1000 N"`. `create_object` and `edit_object` reject unitless force values. Existing documents and `execute_code` retain FreeCAD's native units: `Force = 1000` means **1 N**, not 1000 N. Always check the returned loads when interpreting stress and displacement. This summary covers force, pressure and fixed constraints, not every FEM load type. The force follows the loaded face's normal unless `Direction` links an edge or face, e.g. `{"object_name": "Beam", "edge": "Edge3"}`. `Reversed` flips it. The addon reuses the existing CalculiX solver and imports each solve's results once. Its working directory is isolated per call; only new mechanical results are returned. Existing results in the selected analysis are purged before solving. See [`examples/cantilever_fem.py`](../examples/cantilever_fem.py) for an end-to-end example, including geometry, material, mesh, constraints, and an analytical comparison. For long analyses, configure the client to allow the [queue and execution timeout budgets](execution.md#gui-dispatch-timeouts). ## Property and error contracts Rotation angles in property input and output are in degrees (protocol 2). Dictionaries and null values retain their JSON types. Object links use internal object names; subelement links use `[object_name, [subelement, ...]]`. Missing documents and objects are errors, not empty query results. Failed edits roll back their transaction, including when undo was initially disabled. A failed rollback explicitly reports that changes may remain. Creation failures remove new objects; objects created successfully but invalid after recompute remain available for inspection as reported in the error. Mesh creation rejects unknown properties and requires a successful mesher run with nonempty elements. Mesh `Shape` links and legacy `Part`/`ElementSizeMax/Min` aliases are accepted by both creation and editing. `get_task_status(task_id)` retrieves a GUI operation after a timeout without waiting for the GUI. Omit the ID to list pending and recently completed tasks. See [execution lifecycle and outcomes](execution.md#listener-readiness-and-operation-outcomes).