extrude_sketch
Extrude a closed 2D sketch to create a solid boss feature. Set depth, direction, and whether to merge with existing bodies.
Instructions
Exit the active sketch and extrude it as a boss (solid) feature.
Args: depth_mm: Extrusion depth in mm (must be positive). end_condition: "blind" (fixed depth — default) or "through_all" (extrudes to the next surface; depth_mm is ignored). reverse_direction: Flip the extrude direction along the sketch plane normal. Default (False) extrudes the SW-default way — for a Front-plane sketch in this binding, that's +Z. Pass True to extrude the opposite way (e.g. -Z from Front).
Gotcha — face-anchored sketches: after `create_sketch_on_face`,
the default extrudes INTO the body (toward the inward normal —
the cut/pocket case). Pass `reverse_direction=True` for raised
features (hubs, bosses) — the typical intent on top of a face.
merge: If True (default), the new boss merges with any existing
solid material it touches. Pass False to keep the new
extrusion as a SEPARATE body — required for back-to-back
stacks where two extrudes share a face (without merge=False
on the second one, SW fuses them into one body), and for any
multi-body workflow where target_bodies needs to address the
new body independently.Returns the new Feature with name (e.g., "Saliente-Extruir1"), type ("boss_extrude"), and dimensions. After this call the sketch is closed and the part has a new solid feature.
Caveat: the active sketch must contain at least one closed profile (e.g., a rectangle from create_rectangle). FeatureExtrusion3 fails if the sketch is empty, open, or self-intersecting.
Failure recovery: when extrude_sketch fails (e.g., open profile), the sketch is RE-OPENED automatically — fix the profile with more sketch primitives and retry (otherwise later geometry calls would silently no-op against a closed sketch).
Example — 50×30×5 mm box on the Front plane: create_sketch("front") create_rectangle(0, 0, 50, 30) extrude_sketch(5.0)
Example — back-to-back blocks (one in +Z, one in -Z) from the same Front-plane sketch, kept as TWO separate bodies: create_sketch("front"); create_rectangle(0, 0, 30, 30) extrude_sketch(20.0) # body in +Z create_sketch("front"); create_rectangle(0, 0, 30, 30) extrude_sketch(20.0, reverse_direction=True, merge=False) # body in -Z, separate
Related: build_flange_boss (sketch + extrude in one call). Use revolve_sketch / sweep_sketch / shell_part for true Revolución / Barrer / Vaciar features — don't approximate with stacked extrudes. loft is NOT in v1 (see list_capabilities() for the gap list).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| merge | No | ||
| depth_mm | Yes | ||
| end_condition | No | blind | |
| reverse_direction | No |