onshape

v0.3.0
io.github.gpambrozio/onshape Checked 3 days ago Published 1 month ago

Drive Onshape CAD from an assistant: documents, sketches, solid features, assemblies and exports.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

onshape_login Sign in to Onshape

Sign in to Onshape by opening a browser. method='api_key' (default) opens a local page that links to the Onshape developer key page and accepts the pasted key pair. method='oauth' runs the OAuth 2.0 authorization-code flow against an app you registered in the Onshape developer portal. The credential is verified against Onshape and stored in the OS keychain. Returns immediately with status 'pending' if the user has not finished yet — poll with onshape_login_status.

ParameterTypeDescription
base_urlstringOnshape API base URL (default https://cad.onshape.com).
client_idstringOAuth client id; also read from ONSHAPE_OAUTH_CLIENT_ID.
client_secretstringOAuth client secret; also read from ONSHAPE_OAUTH_CLIENT_SECRET.
methodstringLogin method (default api_key).
oauth_urlstringOAuth server (default https://oauth.onshape.com).
portintegerLoopback port for the callback (OAuth default 8471).
scopestringSpace-separated OAuth scopes, when the app needs them stated.
storestringWhere to keep the credential: auto (keychain, else file), keychain, or file.
wait_secondsintegerSeconds to wait for the browser before returning (default 20).

onshape_login_status Check the pending Onshape login

Wait for, and report on, the login started by onshape_login. Call this repeatedly while the user is in the browser; each call waits up to wait_seconds before returning.

ParameterTypeDescription
wait_secondsintegerSeconds to wait for the browser before returning (default 20).

onshape_set_api_key Store an Onshape API key pair

Store an Onshape access key and secret key directly, without a browser. Use when the user already has a key pair from https://cad.onshape.com/user/developer/apiKeys. The pair is verified against Onshape before it is saved.

ParameterTypeDescription
access_key *stringOnshape access key.
secret_key *stringOnshape secret key.
base_urlstringOnshape API base URL (default https://cad.onshape.com).
storestringWhere to keep the credential: auto (keychain, else file), keychain, or file.

onshape_auth_status Show Onshape sign-in status

Report which Onshape credential is active, where it came from and whether it still works. Secrets are redacted.

ParameterTypeDescription
verifybooleanAlso make a live API call to confirm the credential (default true).

onshape_logout Forget stored Onshape credentials

Delete the credential this server stored (keychain entry and config file). Credentials coming from environment variables or from an existing onshape-cli install are not touched.

onshape_list_documents List Onshape documents

List documents visible to the signed-in user, most recently modified first.

ParameterTypeDescription
filterstringWhich documents to list (default all).
limitintegerHow many to return (default 20).
sort_bystringSort column, e.g. modifiedAt or name (default modifiedAt).
sort_orderstringSort direction (default desc).

onshape_search_documents Search Onshape documents

Find documents by name. Search before creating, so repeated runs do not make duplicates.

ParameterTypeDescription
query *stringText to match against document names.
limitintegerHow many to return (default 20).

onshape_get_document Get an Onshape document

Read one document's metadata, including its default workspace id.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.

onshape_get_document_summary Summarize an Onshape document

Document metadata plus every workspace and the elements (tabs) inside each — the fastest way to orient in an unfamiliar document and collect the ids other tools need.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.

onshape_create_document Create an Onshape document

Create a document. Free Onshape accounts may only create public documents, so pass public=true there. The result carries the new document id and its default workspace id.

ParameterTypeDescription
name *stringDocument name.
descriptionstringDocument description.
publicbooleanMake the document public (required on free accounts).

onshape_update_document Rename an Onshape document

Change a document's name or description.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
descriptionstringNew description.
namestringNew name.

onshape_delete_document Delete an Onshape document

Move a document to the trash. This affects the whole document, not a single tab.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.

onshape_get_workspaces List workspaces

List a document's workspaces (branches).

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.

onshape_get_elements List elements in a workspace

List the elements (tabs) in a workspace: Part Studios, assemblies, drawings, Feature Studios.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
ws *stringWorkspace id — the <ws> segment of the document URL.
typestringOnly return elements of this type.

onshape_find_part_studios Find Part Studios by name

List the Part Studios in a workspace, optionally filtered by a substring of the name.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringCase-insensitive substring to match.

onshape_list_versions List document versions

List the immutable versions of a document, newest first.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.

onshape_create_version Create a document version

Snapshot the workspace as an immutable version. Do this before restructuring an existing design: it is the only way back to the previous state, and drawings must reference a version.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
name *stringVersion name, e.g. what is about to change.
ws *stringWorkspace id — the <ws> segment of the document URL.
descriptionstringWhy this snapshot was taken.

onshape_delete_element Delete an element

Delete one element (tab) from a workspace.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_create_part_studio Create a Part Studio

Add a Part Studio tab to a workspace. The new element id is at result.response.id.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
name *stringTab name.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_features List Part Studio features

The full feature tree with each feature's id, type, parameters and regeneration state. Large — prefer onshape_measure or onshape_get_parts when you only need the result of the tree.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
configurationstringEncoded configuration string from onshape_encode_configuration.

onshape_get_feature_specs Get feature specifications

The parameter ids, enum names and defaults Onshape expects for every feature type in this Part Studio. Read this before hand-writing a payload for onshape_add_feature.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_sketch_info Get sketch geometry

Entities and solved geometry for every sketch in a Part Studio, or for one sketch.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
sketchstringLimit to this sketch feature id.

onshape_get_body_details Get body topology

Bodies, faces and edges with their deterministic ids — the source for explicit edge selection.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_parts List parts

The parts a Part Studio produces, with part ids for export and assembly insertion.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_mass_properties Get mass properties

Volume, mass, centroid and inertia for the Part Studio's bodies.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
configurationstringEncoded configuration string from onshape_encode_configuration.

onshape_measure Measure the model

Body count, overall bounding box in inches and total volume. Use this to check a model matches its intended dimensions before exporting.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_clearance Measure clearance between two bodies

Minimum distance between two solid bodies in the same Part Studio, each named by part id or by the feature that created it. 0 (clear: false) means they touch or overlap, so this is also the interference check — e.g. a bracket against a dummy servo body. Returns inches and millimetres, plus the closest point on each body.

ParameterTypeDescription
a *objectThe first body: give exactly one of part or feature.
b *objectThe second body: give exactly one of part or feature.
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_validate_part_studio Validate a Part Studio

Count parts and bodies, and fail when the counts do not match the expectations you pass. A cheap regression check after a run of feature edits.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
expect_bodiesintegerFail unless it has exactly this many bodies.
expect_partsintegerFail unless the Part Studio has exactly this many parts.

onshape_add_feature Add a raw feature

Post a hand-written BTM feature payload to a Part Studio. The escape hatch for feature types this server has no dedicated tool for — read onshape_get_feature_specs first.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature *objectThe feature JSON, usually a BTFeatureDefinitionCall-1406 envelope.
ws *stringWorkspace id — the <ws> segment of the document URL.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_update_feature Update a feature

Replace an existing feature's payload, e.g. to change a dimension. Post the whole feature JSON.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature *objectThe full replacement feature JSON.
feature_id *stringId of the feature to replace.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_delete_feature Delete a feature

Remove one feature from the tree. Features added after it may fail to regenerate.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature_id *stringId of the feature to delete.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_rollback Move the rollback bar

Set the rollback index so features after it are suppressed. Index 0 rolls back to before the first feature.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
index *integerRollback index; use a large number to roll fully forward.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_eval_featurescript Evaluate FeatureScript

Run a FeatureScript function against the Part Studio and return its decoded value. The general-purpose way to inspect geometry: 'function(context is Context, queries) { ... }'.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
script *stringA FeatureScript function expression taking (context, queries).
ws *stringWorkspace id — the <ws> segment of the document URL.
rawbooleanReturn Onshape's raw response instead of the decoded value.

onshape_sketch_rectangle Sketch a rectangle

Add a sketch holding one closed rectangle, ready to extrude. Corners are opposite, in inches.

ParameterTypeDescription
corner1 *First corner. As [x, y] inches or "x,y".
corner2 *Opposite corner. As [x, y] inches or "x,y".
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Sketch").
planestringDefault plane to sketch on (default Front).
plane_featurestringSketch on a face created by this feature id instead of a default plane.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_sketch_circle Sketch a circle

Add a sketch holding one circle.

ParameterTypeDescription
center *Circle centre. As [x, y] inches or "x,y".
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
radius *numberRadius in inches.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Sketch circle").
planestringDefault plane to sketch on (default Front).
plane_featurestringSketch on a face created by this feature id instead of a default plane.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_sketch_line Sketch a line

Add a sketch holding one line segment. A line alone encloses no region, so it cannot be extruded.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
end *End point. As [x, y] inches or "x,y".
start *Start point. As [x, y] inches or "x,y".
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Sketch").
planestringDefault plane to sketch on (default Front).
plane_featurestringSketch on a face created by this feature id instead of a default plane.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_sketch_circle_axis Sketch a circle with a revolve axis

Add a sketch with a circle profile and a construction line. onshape_revolve spins the profile around that construction line, which is how you get a torus or a ring.

ParameterTypeDescription
axis_end *Axis end. As [x, y] inches or "x,y".
axis_start *Axis start. As [x, y] inches or "x,y".
center *Circle centre. As [x, y] inches or "x,y".
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
radius *numberRadius in inches.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Sketch circle and axis").
planestringDefault plane to sketch on (default Front).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_create_sketch Sketch arbitrary entities

Add a sketch from a list of entities: lines, circles, rectangles and arcs. Use this when the single-shape sketch tools cannot express the profile. Close the profile if you intend to extrude it.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
entities *arrayEntities making up the sketch.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Sketch").
planestringDefault plane to sketch on (default Front).
plane_featurestringSketch on a face created by this feature id instead of a default plane.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_sketch_candy_cane_path Sketch a hooked sweep path

Add a sketch of a straight stem joined to a hooked arc, approximated by segments — a ready-made path for onshape_sweep.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
hook_radius *numberRadius of the hook, inches.
straight_height *numberLength of the straight stem, inches.
ws *stringWorkspace id — the <ws> segment of the document URL.
bottomnumberY of the stem's bottom (default 0).
hook_anglenumberSweep of the hook in degrees (default 210).
namestringFeature name shown in the tree (default "Candy cane centerline").
planestringDefault plane to sketch on (default Front).
segmentsintegerTotal segments used to approximate the path (default 24).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).
xnumberX position of the stem (default 0).

onshape_extrude Extrude a sketch

Extrude the closed regions of a sketch into a solid. op=NEW makes a body, ADD merges into existing bodies, REMOVE cuts them, INTERSECT keeps the overlap. end_type picks blind, symmetric or through-all; opposite flips the direction.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
sketch *stringFeature id of the sketch to extrude.
ws *stringWorkspace id — the <ws> segment of the document URL.
depthnumberExtrusion depth in inches; the total depth when symmetric. Required unless THROUGH_ALL or depth_variable.
depth_variablestringUse a Part Studio variable (by name) for the depth instead.
end_typestringBLIND goes `depth` along the sketch normal (default); SYMMETRIC goes `depth` in total, half each side of the sketch plane; THROUGH_ALL goes past every body and ignores `depth`.
namestringFeature name shown in the tree (default "Extrude").
opstringNEW makes a new body; ADD/REMOVE/INTERSECT combine with existing bodies (default NEW).
oppositebooleanGo against the sketch normal instead of along it. Not with SYMMETRIC.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_hole Cut a hole

Extrude a sketch as a cut (op=REMOVE). Sketch a circle first, then cut it through the body: end_type THROUGH_ALL needs no depth. A sketch on a body's face points out of the body, so pass opposite to cut into it.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
sketch *stringFeature id of the sketch to cut with.
ws *stringWorkspace id — the <ws> segment of the document URL.
depthnumberCut depth in inches; the total depth when symmetric. Required unless THROUGH_ALL or depth_variable.
depth_variablestringUse a Part Studio variable for the depth.
end_typestringBLIND goes `depth` along the sketch normal (default); SYMMETRIC goes `depth` in total, half each side of the sketch plane; THROUGH_ALL goes past every body and ignores `depth`.
namestringFeature name shown in the tree (default "Hole").
oppositebooleanGo against the sketch normal instead of along it. Not with SYMMETRIC.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_thicken Thicken a sketch

Give a sketch region a wall thickness instead of a solid depth.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
sketch *stringFeature id of the sketch to thicken.
thickness *numberThickness in inches.
ws *stringWorkspace id — the <ws> segment of the document URL.
midplanebooleanGrow symmetrically about the sketch plane.
namestringFeature name shown in the tree (default "Thicken").
opstringNEW makes a new body; ADD/REMOVE/INTERSECT combine with existing bodies (default NEW).
oppositebooleanThicken in the opposite direction.
thickness_variablestringUse a Part Studio variable for the thickness.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_revolve Revolve a sketch

Revolve a sketch profile around an axis. With no axis given, the sketch's own construction line is used (see onshape_sketch_circle_axis); otherwise pass axis_ids or an axis query.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
sketch *stringFeature id of the sketch holding the profile.
ws *stringWorkspace id — the <ws> segment of the document URL.
anglenumberRevolve angle in degrees (default 360).
axisstringFeatureScript query selecting the axis.
axis_idsarrayDeterministic ids of the axis entity.
namestringFeature name shown in the tree (default "Revolve").
opstringNEW makes a new body; ADD/REMOVE/INTERSECT combine with existing bodies (default NEW).
typestringFULL revolves all the way around (default FULL when an axis is given).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_sweep Sweep a profile along a path

Sweep the closed regions of one sketch along the edges of another.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
path *stringFeature id of the path sketch.
profile *stringFeature id of the profile sketch.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Sweep").
opstringNEW makes a new body; ADD/REMOVE/INTERSECT combine with existing bodies (default NEW).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_fillet Fillet edges

Round the selected edges. Name the edges with one of: edges (ids), query (FeatureScript), feature (every edge that feature made), all, or circular.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
allbooleanSelect all edges of all solid bodies.
circularbooleanSelect only circular edges.
edgesarrayExplicit deterministic edge ids, from onshape_get_edges.
featurestringSelect every edge created by this feature id.
namestringFeature name shown in the tree (default "Fillet").
querystringFeatureScript query, e.g. query = qCreatedBy(makeId("FID"), EntityType.EDGE);
radiusnumberFillet radius in inches (default 0.1).
radius_variablestringUse a Part Studio variable for the radius.
typestringFillet type (default EDGE).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_chamfer Chamfer edges

Bevel the selected edges. Selection works exactly as for onshape_fillet.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
allbooleanSelect all edges of all solid bodies.
anglenumberAngle in degrees, for type=OFFSET_ANGLE.
circularbooleanSelect only circular edges.
edgesarrayExplicit deterministic edge ids, from onshape_get_edges.
featurestringSelect every edge created by this feature id.
namestringFeature name shown in the tree (default "Chamfer").
querystringFeatureScript query, e.g. query = qCreatedBy(makeId("FID"), EntityType.EDGE);
typestringChamfer type (default EQUAL_OFFSETS).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).
widthnumberChamfer width in inches (default 0.1).
width_variablestringUse a Part Studio variable for the width.

onshape_shell Shell a body

Hollow the body out to a wall thickness, removing the selected faces to open it.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
facesarrayDeterministic ids of faces to remove.
namestringFeature name shown in the tree (default "Shell").
outwardbooleanThicken outward instead of inward.
querystringFeatureScript query selecting the faces to remove.
thicknessnumberWall thickness in inches (default 0.125).
thickness_variablestringUse a Part Studio variable for the thickness.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_draft Draft faces

Taper faces away from a neutral plane — the usual requirement for moulded or cast parts.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
faces *stringFeatureScript query selecting the faces to draft.
neutral *stringFeatureScript query selecting the neutral plane or face.
ws *stringWorkspace id — the <ws> segment of the document URL.
anglenumberDraft angle in degrees (default 3).
namestringFeature name shown in the tree (default "Draft").
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_boolean Boolean bodies

Combine bodies: UNION, SUBTRACTION or INTERSECTION. Subtraction also needs the targets query.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
keep_toolsbooleanKeep the tool bodies after the operation.
namestringFeature name shown in the tree (default "Boolean").
opstringBoolean operation (default UNION).
targetsstringFeatureScript query selecting the target bodies (SUBTRACTION).
tool_idsarrayDeterministic ids of the tool bodies.
toolsstringFeatureScript query selecting the tool bodies.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_boolean_union Union every body

Merge all modifiable solid bodies into one. The usual cleanup before exporting a single part.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Union bodies").
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_mirror Mirror geometry

Mirror parts, bodies or faces across a plane.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
entities *stringFeatureScript query selecting what to mirror.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name shown in the tree (default "Mirror").
plane_idsarrayDeterministic id of the mirror plane, e.g. JCC for Front.
plane_querystringFeatureScript query selecting the mirror plane.
typestringWhat kind of thing is being mirrored (default PART).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_linear_pattern Linear pattern

Repeat geometry along a direction, at a fixed spacing.

ParameterTypeDescription
count *integerTotal number of instances, including the original.
distance *numberSpacing between instances, inches.
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
entities *stringFeatureScript query selecting what to pattern.
ws *stringWorkspace id — the <ws> segment of the document URL.
directionstringFeatureScript query selecting the direction entity.
direction_idsarrayDeterministic id of an edge giving the direction.
namestringFeature name shown in the tree (default "Linear Pattern").
oppositebooleanPattern in the opposite direction.
typestringWhat kind of thing is patterned (default PART).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_circular_pattern Circular pattern

Repeat geometry around an axis.

ParameterTypeDescription
count *integerTotal number of instances, including the original.
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
entities *stringFeatureScript query selecting what to pattern.
ws *stringWorkspace id — the <ws> segment of the document URL.
anglenumberTotal angle covered, degrees (default 360).
axisstringFeatureScript query selecting the axis.
axis_idsarrayDeterministic id of the axis entity.
equal_spacingbooleanSpace instances evenly over the angle (default true).
namestringFeature name shown in the tree (default "Circular Pattern").
typestringWhat kind of thing is patterned (default PART).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_offset_plane Create an offset plane

Add a construction plane offset from a default plane, a face, or another plane.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
base_idsarrayDeterministic ids of the plane or face to offset from.
base_planestringDefault plane to offset from (default Front).
base_querystringFeatureScript query selecting the base plane or face.
namestringFeature name shown in the tree (default "Offset plane").
offsetnumberOffset distance in inches (default 1).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_get_edges List edges

Every edge of every solid body, with its deterministic id, owning body, type, and for circles and arcs the radius and centre (inches).

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_find_circular_edges Find circular edges

Circular edges (full circles and arcs), optionally only those matching a radius, with each one's centre in inches — the usual way to pick hole rims to fillet, or to check where the holes are.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
radiusnumberOnly return edges with this radius, in inches.
tolerancenumberRadius match tolerance in inches (default 0.001).

onshape_find_edges_by_feature Find edges created by a feature

Deterministic ids of the edges a given feature created, evaluated by Onshape.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature *stringFeature id whose edges you want.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_variables List Part Studio variables

The variable table of a Part Studio: names, expressions and descriptions.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_set_variable Set a Part Studio variable

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).

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
expression *stringValue expression with units, e.g. "0.25 in" or "2 * #wall".
name *stringVariable name, without the leading #.
ws *stringWorkspace id — the <ws> segment of the document URL.
descriptionstringWhat the variable means.
typestringVariable type; inferred from the expression's units when omitted.

onshape_get_configuration Get element configuration

The configuration parameters an element exposes, with their ids and allowed values.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_encode_configuration Encode a configuration

Turn configuration parameter values into the encoded string other tools accept as `configuration`.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
params *arrayParameter ids and the values to set.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_export_stl Export STL

Export the Part Studio as STL, for 3D printing. The file is in millimetres by default, which is what slicers assume; STL carries no unit, so only change `units` if the consumer expects otherwise. Measure the model before exporting it.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
asciibooleanWrite ASCII STL instead of binary.
configurationstringEncoded configuration string.
outstringOutput file path (default onshape-<timestamp>.stl in the output directory).
resolutionstringTessellation quality (default medium).
unitsstringSTL units (default millimeter).

onshape_export Export CAD format

Export through Onshape's translation service: STEP, IGES, 3MF, PARASOLID, SOLIDWORKS and others. Slower than STL because the translation is queued server-side.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
configurationstringEncoded configuration string.
formatstringFormat name, e.g. STEP, IGES, 3MF, PARASOLID (default STEP).
kindstringElement kind being exported (default partstudios).
outstringOutput file path (default onshape-<timestamp>.<format> in the output directory).

onshape_shaded_view Render the model

Render the element server-side and return the image. Unlike a thumbnail this is generated on demand, so it always shows the current geometry — use it to check a model visually before exporting.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
configurationstringEncoded configuration string.
heightintegerImage height in pixels (default 340).
kindstringElement kind being exported (default partstudios).
no_edgesbooleanHide edges in the render.
outstringOutput PNG path (default onshape-<timestamp>.png in the output directory).
return_imagebooleanAlso return the PNG inline (default true).
view_matrixstring3x4 row-major camera matrix as 12 comma-separated numbers (default isometric).
widthintegerImage width in pixels (default 600).

onshape_get_thumbnail Download the element thumbnail

Save Onshape's stored thumbnail. Thumbnails are generated asynchronously and lag edits — prefer onshape_shaded_view to see the current state.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
outstringOutput PNG path (default onshape-thumb-<timestamp>.png).
return_imagebooleanAlso return the PNG inline (default true).
sizestringThumbnail size, e.g. "600x340" or "300x300" (default 600x340).

onshape_thumbnail_info List thumbnail sizes

The thumbnail sizes Onshape has rendered for this element, with their hrefs.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_create_assembly Create an assembly

Add an assembly tab to a workspace.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
name *stringTab name.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_assembly Get assembly structure

The assembly's instances, occurrences, mate features and mate connectors.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
include_mate_connectorsbooleanInclude mate connectors (default true).
include_mate_featuresbooleanInclude mate features (default true).
include_non_solidsbooleanInclude non-solid instances (default false).

onshape_insert_instance Insert an instance

Insert a part, a whole Part Studio or another assembly into an assembly. Insert from a version when pulling from a different document.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
src_elem *stringElement id of the source Part Studio or assembly.
ws *stringWorkspace id — the <ws> segment of the document URL.
configurationstringEncoded configuration for the inserted element.
fixedbooleanFix the new instance in place, to ground the assembly. Onshape has no public call to fix or unfix an instance afterwards; to change it, insert again and delete the old instance.
is_assemblybooleanThe source element is an assembly.
partstringPart id, to insert a single part.
src_docstringSource document id (defaults to the target document).
src_versionstringSource version id, required when inserting across documents.
whole_studiobooleanInsert every part of the source Part Studio.

onshape_delete_instance Delete an instance

Remove one instance from an assembly by its occurrence node id.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
node *stringOccurrence node id of the instance.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_transform_instance Transform instances

Apply a 4x4 row-major transform (16 numbers, metres) to the given occurrence paths.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
paths *arrayOccurrence paths, each an array of node ids.
transform *arrayRow-major 4x4 transform matrix.
ws *stringWorkspace id — the <ws> segment of the document URL.
absolutebooleanTreat the transform as absolute rather than relative.

onshape_get_assembly_features List assembly features

The mates, mate connectors, groups and relations defined in an assembly, with their feature ids, payloads and regeneration states.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_assembly_mate_connector Add a mate connector

Place an implicit mate connector on an instance by inference (CENTROID, TOP, ...). Its feature id is what onshape_assembly_mate then joins.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
occurrence *stringOccurrence id of the instance to attach to.
ws *stringWorkspace id — the <ws> segment of the document URL.
inferencestringInference type, e.g. CENTROID, TOP, MID_PLANE (default CENTROID).
namestringFeature name (default "Mate connector").
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_assembly_mate Add a mate

Join two mate connectors with a mate: FASTENED, REVOLUTE, SLIDER, CYLINDRICAL, PLANAR, and so on. Each connector is an assembly-level mate connector's feature id, or a Part Studio mate connector given as {path: [instance id], connector: feature id} from onshape_get_assembly. The mate's value measures the first connector against the second, so list the moving part first.

ParameterTypeDescription
connectors *arrayThe mate connectors to join, moving part first.
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name (default "Mate").
typestringMate type (default FASTENED).
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_assembly_group Group instances

Lock several instances together without individual mates.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
occurrences *arrayOccurrence ids to group.
ws *stringWorkspace id — the <ws> segment of the document URL.
namestringFeature name (default "Group").
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_assembly_add_feature Add a raw assembly feature

Post a hand-written assembly feature payload — the escape hatch for mate types with no tool here.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature *objectThe assembly feature JSON.
ws *stringWorkspace id — the <ws> segment of the document URL.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_update_assembly_feature Update an assembly feature

Replace an assembly feature's payload — a mate's type, connectors or limits, a relation's ratio. Post the whole feature JSON, e.g. as onshape_get_assembly_features returns it, inside a BTFeatureDefinitionCall-1406 envelope.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature *objectThe full replacement feature JSON.
feature_id *stringId of the feature to replace.
ws *stringWorkspace id — the <ws> segment of the document URL.
validatebooleanRe-read the feature list afterwards and fail if the feature regenerated with an error (default true).

onshape_delete_assembly_feature Delete an assembly feature

Remove a mate, mate connector, group or relation. Relations on a deleted mate stop solving.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
feature_id *stringId of the feature to delete.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_assembly_relation Relate two mates

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.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
mates *arrayMate feature ids: two, or one for SCREW.
type *stringRelation type.
ws *stringWorkspace id — the <ws> segment of the document URL.
distance_per_revolutionnumberRACK_AND_PINION and SCREW: travel per full turn, inches. A pinion's is its pitch circumference.
dofsarrayOverride the degree of freedom per mate: Rz rotation about, Tz translation along, its Z axis.
namestringFeature name (default "Relation").
rationumberGEAR and LINEAR: the ratio between the mates (default 1).
reversebooleanReverse the direction of the coupling.

onshape_get_mate_values Get mate values

Where every mate currently sits: each degree of freedom's value, translations in inches and rotations in degrees, keyed by unit (translationZ_in, rotationZ_deg).

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_set_mate_values Set mate values

Drive top-level mates to new positions — turn a revolute, slide a slider — and read them back; relations move the coupled mates too. Values are inches and degrees. Fails when Onshape does not apply a value, which it does silently for mates with limits enabled and for positions the rest of the assembly cannot reach.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
values *arrayOne entry per mate, naming only the degrees of freedom to change.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_bom Get the bill of materials

The assembly's BOM table.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
indentedbooleanReturn the indented BOM (default true).
multi_levelbooleanExpand sub-assemblies (default false).

onshape_assembly_mass_properties Get assembly mass properties

Mass, volume, centroid and inertia for a whole assembly.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_create_drawing Create a drawing

Create a drawing of a part, Part Studio or assembly. The source must be referenced by version — call onshape_create_version first and pass its id as src_version.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
name *stringDrawing name.
src_elem *stringElement id being drawn.
src_version *stringVersion id of the source element.
ws *stringWorkspace id — the <ws> segment of the document URL.
partstringPart id, to draw a single part.
src_docstringSource document id (defaults to the target document).

onshape_get_drawing_views List drawing views

The views placed on a drawing sheet.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_export_drawing Export a drawing

Export a drawing as PDF (or DWG/DXF) through the translation service.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
formatstringFormat name: PDF, DWG, DXF (default PDF).
outstringOutput file path (default onshape-drawing-<timestamp>.<format>).

onshape_create_feature_studio Create a Feature Studio

Add a Feature Studio tab for custom FeatureScript.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
name *stringTab name.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_feature_studio Read a Feature Studio

The FeatureScript source of a Feature Studio.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_set_feature_studio Write a Feature Studio

Replace the FeatureScript source of a Feature Studio. The whole file is overwritten.

ParameterTypeDescription
contents *stringThe complete new FeatureScript source.
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_feature_studio_specs Get Feature Studio specs

The feature specifications a Feature Studio defines, for calling its custom features.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.

onshape_get_metadata Get element or part metadata

Read the properties of an element, or of one part when part is given.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
ws *stringWorkspace id — the <ws> segment of the document URL.
partstringPart id, to read that part's properties.

onshape_set_metadata Set element or part metadata

Write properties such as part number, description or material. Only editable properties are accepted; read onshape_get_metadata first to find the property ids.

ParameterTypeDescription
doc *stringDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elem *stringElement id (tab) — the <elem> segment of the document URL.
properties *arrayProperty ids and their new values.
ws *stringWorkspace id — the <ws> segment of the document URL.
partstringPart id, to set that part's properties instead of the element's.

onshape_request Call any Onshape REST endpoint

Make an authenticated request to an arbitrary Onshape REST endpoint, for anything the dedicated tools do not cover. Paths start with /api/ and are documented at https://cad.onshape.com/glassworks/explorer. Prefer a dedicated tool when one exists — they normalise the response and validate the result.

ParameterTypeDescription
method *stringHTTP method.
path *stringAPI path, e.g. /api/v6/documents/d/{did}/w/{wid}/elements. Must begin with /api/.
bodyJSON request body, for POST.
paramsobjectQuery string parameters.