一键导入
onshape-cad
Use when a task mentions Onshape, CAD, cad.onshape.com URLs, parametric parts, 3D printing, or model inspection/export.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when a task mentions Onshape, CAD, cad.onshape.com URLs, parametric parts, 3D printing, or model inspection/export.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | onshape-cad |
| description | Use when a task mentions Onshape, CAD, cad.onshape.com URLs, parametric parts, 3D printing, or model inspection/export. |
Use this skill to drive Onshape through the repo's CLI. The Python command is
onshape-cli; the Node/npm command is onshape. They share command names,
flags, and JSON output.
onshape-cli <command> ...python -m onshape_cli.cli <command> ...onshape <command> ... or npx onshape <command> ...exports unless they are set in the same command.{"ok": true, "result": ...}{"ok": false, "error": ..., "detail": ...}.result with jq; read .detail.message
and .detail.notices before retrying failures.Create an API key at https://dev.onshape.com -> API keys.
Credential lookup order:
--access-key / --secret-keyONSHAPE_ACCESS_KEY / ONSHAPE_SECRET_KEY~/.onshape/credentials.json or ONSHAPE_CONFIG$XDG_CONFIG_HOME/onshape/credentials.json~/.claude/mcp.json onshape blockUseful commands:
onshape-cli login
onshape-cli config show
onshape-cli logout
For scripted agents, prefer env vars or explicit flags. ONSHAPE_BASE_URL or
--base-url can override the API base URL.
Most geometry commands need a document, workspace, and element:
--doc <documentId> --ws <workspaceId> --elem <elementId>
You can also set ONSHAPE_DOC, ONSHAPE_WS, and ONSHAPE_ELEM inside the same
shell command. Extract ids from URLs shaped like:
https://cad.onshape.com/documents/<doc>/w/<workspace>/e/<element>
Discovery flow:
onshape-cli list-documents --limit 10
onshape-cli search-documents "name"
onshape-cli get-document-summary --doc D
onshape-cli get-elements --doc D --ws W --type PARTSTUDIO
onshape-cli find-part-studios --doc D --ws W --name "Part"
Free Onshape accounts can create only public documents:
onshape-cli create-document --name "Agent build" --public
The result includes result.id and result.defaultWorkspace.id.
For new parts:
measure.shaded-view or get-thumbnail.Minimal example:
DOC=$(onshape-cli create-document --name "Bracket" --public | jq -r .result.id)
WS=$(onshape-cli get-document --doc "$DOC" | jq -r .result.defaultWorkspace.id)
ELEM=$(onshape-cli create-part-studio --doc "$DOC" --ws "$WS" --name "Part" | jq -r .result.response.id)
SK=$(onshape-cli sketch-rectangle --doc "$DOC" --ws "$WS" --elem "$ELEM" --plane Top --corner1 0,0 --corner2 3,2 | jq -r .result.featureId)
EX=$(onshape-cli extrude --doc "$DOC" --ws "$WS" --elem "$ELEM" --sketch "$SK" --depth 0.25 | jq -r .result.featureId)
onshape-cli fillet --doc "$DOC" --ws "$WS" --elem "$ELEM" --feature "$EX" --radius 0.1
onshape-cli measure --doc "$DOC" --ws "$WS" --elem "$ELEM"
onshape-cli shaded-view --doc "$DOC" --ws "$WS" --elem "$ELEM" --out render.png
onshape-cli export-stl --doc "$DOC" --ws "$WS" --elem "$ELEM" --out bracket.stl
Edges and faces are usually selected with FeatureScript queries evaluated by Onshape. Prefer queries over raw ids unless a command needs an axis or direction.
Common selectors:
qAllModifiableSolidBodies();qCreatedBy(makeId("FID"), EntityType.FACE);qCreatedBy(makeId("FID"), EntityType.EDGE);Shared selection flags:
--all: all edges on all solid bodies--feature FID: edges from a feature--circular: circular or arc edges--query "<FeatureScript query>"--edges id1,id2 or --faces id1,id2Default plane ids: Front JCC, Top JDC, Right JEC.
Documents: list-documents, search-documents, get-document,
get-document-summary, create-document, delete-document,
update-document, get-elements, find-part-studios, get-workspaces,
list-versions, create-version.
Part studios: create-part-studio, delete-element, delete-feature,
get-parts, get-features, get-feature-specs, get-sketch-info,
get-body-details, validate-partstudio, rollback.
Sketching: sketch-rectangle, sketch-circle, sketch-line,
sketch-circle-axis, sketch-candy-cane-path, create-sketch.
Solids: extrude, hole, thicken, revolve, sweep, draft.
Edges/faces: fillet, chamfer, shell.
Booleans/patterns: boolean, boolean-union, mirror, linear-pattern,
circular-pattern, offset-plane.
Assemblies: create-assembly, insert-instance, get-assembly-features,
assembly-add-feature, assembly-mate-connector, assembly-mate,
assembly-group, get-bom, assembly-mass-properties, transform-instance,
delete-instance.
Drawings: create-drawing, get-drawing-views, export-drawing.
Feature Studios: create-feature-studio, get-feature-studio,
set-feature-studio, get-feature-studio-specs.
Metadata/config: get-metadata, set-metadata, get-variables,
set-variable, get-configuration, encode-configuration.
Images/export/measure: thumbnail-info, get-thumbnail, shaded-view,
measure, get-edges, find-circular-edges, find-edges-by-feature,
mass-properties, export-stl, export.
Raw feature access: add-feature, update-feature,
eval-featurescript. Use get-feature-specs first, then pass a
BTFeatureDefinitionCall-1406 envelope as --json or --json-file.
export-stl is the simplest reliable export. Use export
for STEP/IGES/3MF/PARASOLID.create-version.--direction-ids or --axis-ids; get them
with get-edges.shell needs at least one face to remove.revolve and offset-plane can be regen-rejected; inspect featureStatus.extrude --op NEW over many fragile
additive/removal steps.measure, bbox.z is height and
bbox.y is depth for Front-plane profiles.measure verifies dimensions; rendered images verify shape and orientation.doc/ws/elem; do not recreate
or overwrite it.ok:false or result.value: null is usually a real API or FeatureScript
error, not a transient. Inspect detail.message and detail.notices.get-feature-specs and use
add-feature or update-feature with JSON.