Relate two mates
onshape_assembly_relationCouple mates so one drives the other: GEAR (two revolutes, ratio), RACK_AND_PINION (a revolute and a slider, distance per revolution), SCREW (one cylindrical mate, distance per revolution) or LINEAR (two sliders, ratio).
Instructions
Couple mates so one drives the other: GEAR (two revolutes, ratio), RACK_AND_PINION (a revolute and a slider, distance per revolution), SCREW (one cylindrical mate, distance per revolution) or LINEAR (two sliders, ratio). Each mate's degree of freedom follows from its type; cylindrical mates contribute whichever the relation needs. Mates missing the parameter relations need (made by hand-written payloads) are completed first and listed in completedMates. Fails if the relation does not regenerate.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc": "<doc>",
"ws": "<ws>",
"elem": "<elem>",
"type": "<type>",
"mates": "<mates>"
},
"name": "onshape_assembly_relation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ws | Yes | Workspace id — the <ws> segment of the document URL. | |
| doc | Yes | Document id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>. | |
| dofs | No | Override the degree of freedom per mate: Rz rotation about, Tz translation along, its Z axis. | |
| elem | Yes | Element id (tab) — the <elem> segment of the document URL. | |
| name | No | Feature name (default "Relation"). | |
| type | Yes | Relation type. | |
| mates | Yes | Mate feature ids: two, or one for SCREW. | |
| ratio | No | GEAR and LINEAR: the ratio between the mates (default 1). | |
| reverse | No | Reverse the direction of the coupling. | |
| distance_per_revolution | No | RACK_AND_PINION and SCREW: travel per full turn, inches. A pinion's is its pitch circumference. |