Add Mate
add_mateUse this when you need to author a mate-graph relationship into the source, selected by relation (default 'mate'):
'mate' — a typed mate between two connectors ({ name, a, b, type, pose?, limitsDeg?, limitsMm? }).
'coupling' — couple a driven mate to a source mate by ratio ({ driven, source, ratio, offset? }).
'transmission' — a physical drive path across mates ({ name, kind, sourceMate, drivenMates, path, ... }). All durably edit source and need { code, assembly_binding }. Params other than
relationare forwarded verbatim; each relation fails closed on its own missing required params.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | No | relation:'mate' — connector ref "<partName>.<connectorName>". | |
| b | No | relation:'mate' — connector ref "<partName>.<connectorName>". | |
| code | Yes | The .kcad.ts source code. | |
| kind | No | relation:'transmission' — transmission kind. | |
| name | No | relation:'mate'|'transmission' — name unique within the assembly. | |
| path | No | relation:'transmission' — drive path. | |
| pose | No | relation:'mate' — optional mate pose. | |
| type | No | relation:'mate' — mate type. | |
| input | No | relation:'transmission' — optional input. | |
| notes | No | relation:'transmission' — optional notes. | |
| ratio | No | relation:'coupling' — driven pose = source pose * ratio + offset. | |
| driven | No | relation:'coupling' — driven mate name. | |
| offset | No | relation:'coupling' — optional pose offset. | |
| output | No | relation:'transmission' — optional output. | |
| source | No | relation:'coupling' — source mate name. | |
| actuator | No | relation:'transmission' — optional actuator. | |
| limitsMm | No | relation:'mate' — optional [minMm, maxMm]. | |
| relation | No | Which relationship to author (default 'mate'). | |
| limitsDeg | No | relation:'mate' — optional [minDeg, maxDeg]. | |
| sourceMate | No | relation:'transmission' — source mate name. | |
| drivenMates | No | relation:'transmission' — driven mate names. | |
| assembly_binding | Yes | JS identifier bound to assembly(...). |
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). |