Sweep Tolerance Range
sweep_toleranceUse this when you need to check whether a mechanism stays buildable across a tolerance/dimension range, not just at one nominal value. Declares one or more param() names with a { values: [...] } list or a { min, max, steps } range, re-evaluates the script once per cartesian-product combination (capped at 64 combos — exceeding it truncates to the first 64 and emits kinematic.sweep-tolerance.combo-cap-exceeded), and runs the standard gates on each combo: interference, mounting-hole diameter agreement, and joint-axis binding (all three, default on); reachability only when gates.reachable names a tip_link + target. Returns the pass/fail envelope table (one row per combo) plus firstFailure per gate — the fastest way to find the first param value at which a design breaks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Inline kernelCAD script source. | |
| file | No | Path to a .kcad.ts script file. | |
| gates | No | Which standard gates to run per combo. | |
| params | Yes | param() name -> { values: [number|string, ...] } or { min, max, steps }. | |
| assembly | No | Assembly name; defaults to the first captured assembly. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether every gate passed on every evaluated combo. | |
| error | No | ||
| results | No | One entry per evaluated combo: { combo, gates, diagnostics }. | |
| errorCode | No | ||
| diagnostics | No | Sweep-level diagnostics (e.g. combo-cap-exceeded). | |
| combosCapped | No | True when the full cartesian product exceeded the 64-combo cap. | |
| firstFailure | No | First failing combo per gate name. | |
| combosEvaluated | No | Number of combos actually evaluated (capped at 64). |