extrude_cut
Subtract material from a solid part using an active sketch. Supports blind, through all, up to surface, and offset cuts for precise material removal.
Instructions
Exit the active sketch and cut (subtract) material from the part.
Mirrors the SolidWorks "Cortar-Extruir → Direccion 1" UI panel. Most common autoparts use: drilling bolt holes through a bracket, cutting slots for adjustment, removing material around features.
Args: depth_mm: Cut depth in mm. Required (positive) for end_conditions "blind", "mid_plane", and "offset_from_surface" (per-condition meaning below). Ignored for the others — pass 0.0 (the default).
end_condition: One of:
- "blind" (default, "Hasta profundidad especificada"): cut a
fixed depth on ONE side of the sketch plane.
- "through_all" ("Por todo"): cut through everything on ONE
side of the sketch plane. Useful for bolt holes when you
don't know the body thickness.
- "through_all_both" ("Por todo - Ambos lados"): cut through
everything on BOTH sides of the sketch plane. Use when the
sketch sits in the middle of a body.
- "mid_plane" ("Plano medio"): cut symmetrically about the
sketch plane. depth_mm is total — split equally per side.
Common for keyways, oil grooves, symmetric lightening
pockets in cast housings and shafts.
- "up_to_next" ("Hasta el siguiente"): cut up to the next
surface that intersects the cut profile. Useful for cuts in
multi-wall weldments / housings where the cut should stop
at the next inner wall. No depth or reference required.
- "up_to_surface" ("Hasta la superficie"): cut up to a named
face or reference plane. Requires `reference_name`.
Live caveat: in SW Spanish 2024 via this binding, FeatureCut4
with T1=UpToSurface accepts FACE references but rejects
reference-plane references (returns None even with the plane
correctly selected at Mark=32). Use a face name (e.g.
"Cara<2>@Pieza1") for "up_to_surface". For "cut up to a
reference plane", use "offset_from_surface" with a very
small offset, which works for both faces and planes.
- "offset_from_surface" ("Equidistante de la superficie"):
cut up to an offset distance past a named face. Requires
`reference_name` AND positive depth_mm. Use `offset_reverse`
to flip which side of the face the offset goes.
- "up_to_body" ("Hasta el sólido"): cut up to a named solid
body. Requires `reference_name` (the body name from
get_active_part_info "bodies"). Common in multi-body
weldments and fixture layouts.
reference_name: Locale-sensitive entity name from
get_active_part_info — face/plane name (e.g. "Cara<2>@Pieza1",
"Plano1@Pieza1") or solid-body name (e.g. "Saliente-Extruir1").
Required when end_condition needs a reference; pass None
otherwise (the tool will reject reference_name on conditions
that don't accept one — fail loud rather than silently
ignored).
target_bodies: Feature Scope (alcance de la operación). Pass None
(default) to let SolidWorks auto-select all bodies the cut
geometrically intersects. Pass a list of body names to
restrict the cut to exactly those bodies (the SW UI's
"Cuerpos seleccionados" mode). Body names come from
get_active_part_info "bodies". Empty list raises — pass None
to mean "all".
offset_reverse: Only meaningful for "offset_from_surface" — flips
which side of the reference face the offset goes. Ignored for
all other end conditions.
reverse_direction: Flip the cut direction relative to the
sketch's natural default. The default (False) cuts INTO the
body for both plane-anchored and face-anchored sketches. Pass
True when the sketch's orientation breaks that heuristic —
sketch on a back face, ref plane interior to the body, etc.
If the result is "FeatureCut4 returned None" with cut
direction listed as a likely cause, retry with True.
start_condition: Where the cut BEGINS — "sketch_plane" (default) or
"offset". "offset" starts the cut start_offset_mm off the sketch
plane, so a sketch on a real outer face can carve a mid-body BAND
(start_offset_mm = where it begins, depth_mm = its width with
end_condition="blind") WITHOUT an interior reference plane (which
silently makes a zombie sketch).
start_offset_mm: Offset (mm, >0) from the sketch plane to the cut
start; only for start_condition="offset". start_flip picks side.
start_flip: Flip the offset to the other side of the sketch plane.Returns the new Feature with name (e.g., "Cortar-Extruir1"), type ("cut_extrude"), and dimensions.
Caveat: requires an active sketch AND the sketch geometry must intersect existing solid material. If the sketch is empty/open or misses the body, FeatureCut4 fails.
Failure recovery: same contract as extrude_sketch — on failure the sketch is RE-OPENED so you can fix the profile with more sketch primitives and retry (otherwise later geometry calls would silently no-op against a closed sketch).
Example — M8 clearance hole through a 5mm bracket: create_sketch("front"); create_circle(25, 15, 4.25) extrude_cut(5.0, "blind") Example — in a 2-body part, cut only through the upper boss: extrude_cut(end_condition="through_all", target_bodies=["Saliente-Extruir2"])
Related composites: build_rectangular_pocket (sketch+cut in one call), add_bolt_circle (N holes on a bolt circle), linear_pattern (repeat an existing seed cut).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth_mm | No | ||
| start_flip | No | ||
| end_condition | No | blind | |
| target_bodies | No | ||
| offset_reverse | No | ||
| reference_name | No | ||
| start_condition | No | sketch_plane | |
| start_offset_mm | No | ||
| reverse_direction | No |