Extrude sketch
extrudeCreate solids or cut holes and pockets from closed sketch regions by setting depth, direction, and operation for Onshape CAD models.
Instructions
Extrude all closed regions of a sketch into a solid, or cut with it (operation 'remove'). The default direction follows the sketch plane's normal. For a sketch on a part's own face that normal points OUT of the part, so to cut a hole or pocket INTO the part pass opposite_direction=true (verified on live Onshape; without it nothing is cut). Always confirm with get_part_properties - the volume must drop. For operation 'new' the reply lists the created parts (parts_created) and names them when part_name is given.
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": {
"document_id": "<document_id>",
"element_id": "<element_id>",
"sketch_feature_id": "<sketch_feature_id>",
"depth": "<depth>"
},
"name": "extrude"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hole | No | The cut is a round drilled hole (use operation 'remove'): it is named 'Hole', without a size. | |
| name | No | Feature name. Defaults to its size: 'Extrude 8 mm' ('Cut 8 mm' for operation 'remove', 'Hole' with hole=true); with a variable depth the name shows the variable, e.g. 'Extrude (head_h)'. Do not put '#word' in a name: Onshape reads it as a parameter of the feature and shows '?'. | |
| depth | Yes | Length: a number in the configured unit (see get_settings; mm by default), a string with a unit such as '2.5 in', or an Onshape expression such as '#width'. | |
| operation | No | 'new' creates a separate part; 'add' merges into existing parts; 'remove' cuts material away (holes, pockets); 'intersect' keeps only the overlap. | new |
| part_name | No | Name for the part an operation 'new' creates, e.g. 'M10x40 Hex Bolt'. Give one unless the user chose a name: otherwise the part stays 'Part N'. | |
| symmetric | No | Extrude half the depth to each side of the sketch plane. | |
| element_id | Yes | Element (tab) ID: the string after /e/ in the Onshape URL. Get it from get_document. | |
| only_parts | No | Part IDs (from list_parts) that operations 'add', 'remove' and 'intersect' should affect. By default Onshape applies them to every part the extrusion touches, which matters when several parts share one Part Studio (e.g. a bolt and a nut). | |
| document_id | Yes | Onshape document ID: the 24-character hex string after /documents/ in the document URL. Get it from list_documents. | |
| workspace_id | No | Workspace ID (the string after /w/ in the URL). Optional - defaults to the document's main workspace. | |
| sketch_feature_id | Yes | feature_id returned by create_sketch. | |
| opposite_direction | No | Flip to the other side of the sketch plane. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||