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, 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.
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. | |
| study | No | Name of the study to run; defaults to the last declared one. | |
| 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 |
|---|---|---|---|
| ok | Yes | False when the study violated its declared minSafetyFactor, a selector did not resolve, or the solver toolchain is missing. | |
| error | No | ||
| images | No | Absolute PNG paths of the rendered stress heatmap. | |
| legend | No | Heatmap colour bands { color, fromMPa, toMPa } — the scale the PNGs are drawn on. | |
| out_dir | No | Directory holding the summary JSON, solver deck and heatmap PNGs. | |
| summary | No | Solved evidence: maxVonMisesMPa, maxVonMisesAt, maxDisplacementMm, maxDisplacementAt, minSafetyFactor (+ minSafetyFactorRequired), nodeCount/elementCount/meshSizeMm, quality (minSICN, meanSICN, lowQualityCount), maxStressErrorPercent, trust { meshTrusted, reasons }, hotSpots [{ region, maxVonMisesMPa, nodeId, at, safetyFactor }], appliedForceN / reactionForceN / equilibriumResidual, meshMs / solveMs. | |
| artifacts | No | Absolute paths of the BREP geometry handoff, .inp deck, .frd results and mesh JSON, for hand reproduction. | |
| errorCode | No | ||
| diagnostics | No | fea.* diagnostics raised by the run. |