Skip to main content
execute_code runs Python inside Parashell’s FreeCAD-compatible interpreter. The snippet is not shell code. It is not a package manager. It is not a general automation sandbox.

Allowed imports

Prefer only modules native to the CAD environment and the Python standard library for simple math/data handling:
Use optional workbench modules only when installed:
Do not import network, shell, package installation, or broad filesystem modules for modeling snippets.

Forbidden forms

Do not use these in execute_code:
Allowed file interaction is limited to Parashell document save/export APIs or explicit export paths requested by the user.

Literals

Flow control

Avoid unbounded loops. Iteration counts must be small and deterministic.

Functions

Use local helper functions to remove repetition when the snippet remains short:
Do not define large frameworks, persistent hooks, background timers, monkey patches, or module-level state intended to survive the operation.

Exceptions

Catch expected modeling failures and return a useful error. Do not swallow all failures silently.

Comprehensions

Keep comprehensions readable. Prefer ordinary loops when side effects are involved.

Attribute and property syntax

Check property existence when assigning uncommon fields:

Expressions

Use expressions to bind feature dimensions to spreadsheet aliases:
Avoid hard-coding driving dimensions when a spreadsheet variable should control the model.

Minimal snippet structure

Minimal parametric snippet structure

When possible, use the structured MCP sketch and spreadsheet tools instead of writing this by hand.