Set Parameter
set_paramUse this when you need to edit a param() default value in a kernelCAD script. Returns the modified code as text plus diagnostics from re-evaluating the result. Caller persists the new code via standard file-write tools (this tool has no side effects).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The .kcad.ts source code. | |
| new_value | Yes | The new default value. Either a number for a numeric param (e.g. 12.5), or a string expression evaluated in the script (e.g. "width/2 + 3"). | |
| param_name | Yes | The string literal name of the param (first arg to param()). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the edit applied and re-evaluated cleanly. | |
| error | No | Failure message (present when ok is false). | |
| new_code | No | Modified .kcad.ts source (present on success). Caller persists it. | |
| diagnostics | No | Diagnostics from re-evaluating the modified source. | |
| binding_name | No | JS const name bound to the new construct (when one was created). |