Run Structural FEA
run_feaUse this when you need to know whether a part will hold a load. Runs the linear-static structural study a script declares with shape.feaStudy({ material, fixed, loads, meshSize?, minSafetyFactor? }): meshes the solid with quadratic tetrahedra, solves it with CalculiX, and returns evidence — peak von Mises stress (MPa), peak displacement (mm), the minimum safety factor against the material yield (taken away from the clamp-singular edges of the fixed faces; the raw clamp-edge peak is reported separately as peakAtSupportMPa), per-region hot spots named by @kc[...] face ref, mesh-quality trust flags, an equilibrium residual, and stress-heatmap PNG paths.
Requires the external solver toolchain (CalculiX ccx plus the gmsh Python module). When it is absent the call fails with fea.solver.unavailable and the exact install command — never a silent pass.
Pass { file | code }, optional study (defaults to the last declared study), output_dir (keeps the .inp/.frd deck for reproduction), mesh_size (mm, overrides the study for this run), and heatmaps: false for a fast numbers-only run.
Mesh refinement is automatic: when the stress is untrusted only because the solver's error estimate is high, it re-solves once at 0.75x the element size (when the predicted element count fits the element budget) and returns that pass, with summary.refinement listing each pass's mesh size, element count and peak stress and why it stopped. refine: false solves once at mesh_size.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Inline kernelCAD script source (mutually exclusive with file). | |
| file | No | Path to a .kcad.ts script declaring at least one feaStudy. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project. | |
| study | No | Name of the study to run; defaults to the last declared one. | |
| refine | No | One automatic finer pass (0.75x element size) when the stress is untrusted, inside the element budget (default true). false: one solve at mesh_size. | |
| heatmaps | No | Render stress heatmap PNGs (default true). | |
| mesh_size | No | Target element size in mm, overriding the study for this run. | |
| output_dir | No | Directory for the solver deck, results, summary JSON and heatmap PNGs. | |
| mesh_timeout_ms | No | Wall-clock budget for meshing (default 120000). | |
| solve_timeout_ms | No | Wall-clock budget for the solve (default 300000). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||