Set a Part Studio variable
onshape_set_variableCreate or update a variable. Feature tools can then reference it by name (depth_variable, radius_variable, ...) so a dimension lives in one place.
Instructions
Create or update a variable. Feature tools can then reference it by name (depth_variable, radius_variable, ...) so a dimension lives in one place. Uses the variable table where the account supports it and falls back to an assignVariable feature otherwise; result.route says which was used. On the feature route an existing variable of the same name is rewritten in place, so features built after it pick up the new value (result.action is updated or created).
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>. | |
| elem | Yes | Element id (tab) — the <elem> segment of the document URL. | |
| name | Yes | Variable name, without the leading #. | |
| type | No | Variable type; inferred from the expression's units when omitted. | |
| expression | Yes | Value expression with units, e.g. "0.25 in" or "2 * #wall". | |
| description | No | What the variable means. |