add_end_keyway
Create a DIN 6885 keyway in a shaft end. Inputs define the end, shaft diameter, slot dimensions, and offset from the end face.
Instructions
Cuñero — DIN 6885-style axial keyway cut into a shaft end.
Junior workflow: "agrega un cuñero al extremo izquierdo de la flecha,
ancho 6mm, largo 20mm, profundidad 3mm, 5mm adentro del extremo".
Operates on the active part — assumes a shaft along world X already
exists (typically just built with build_stepped_shaft). Composes:
create_reference_plane("top", offset = D/2) -> tangent plane on
top of the shaft
create_sketch() -> slot sketch
create_slot(...) -> keyway profile
extrude_cut(depth, reverse_direction=True) -> cut INTO body
CRITICAL — reverse_direction=True is non-obvious here. The default
extrude_cut direction goes AWAY from the body for offset-plane
sketches: the tangent plane's outward normal is +Y, but the shaft
body is below the plane at Y < D/2. reverse_direction=True flips the
cut so it removes material going from the plane DOWN into the shaft.
Without it the cut is a no-op (cuts empty space above the cylinder).
Args:
end: "start" (the X=0 end — keyway sits at axial_offset from the
min-X face) or "end" (the far +X end — keyway sits at
axial_offset from the max-X face). End position resolved
best-effort via get_bounding_box on the active part.
diameter_at_end_mm: Diameter of the shaft at the end being cut.
Used to compute the tangent-plane offset (= D/2). Must be
greater than keyway_depth_mm + 1.0 (need at least 1mm of
remaining material below the cut).
keyway_width_mm: Slot width perpendicular to the shaft axis.
Standard DIN 6885 widths (Ø range → width): Ø6-8 → 3mm,
Ø10-12 → 4mm, Ø13-17 → 5mm, Ø18-22 → 6mm, Ø22-30 → 8mm,
Ø30-38 → 10mm. Default 5mm (covers Ø13-17).
keyway_length_mm: Slot total axial length (including rounded
ends). Must be greater than width (slot is rectangle + 2
semicircles; degenerate when length ≤ width). Default 15mm.
keyway_depth_mm: Cut depth from the shaft surface inward.
Standard ~D/8 for power transmission. Default 2.5mm.
axial_offset_from_end_mm: Distance from the shaft end face to
the nearest slot edge. Default 5mm (typical clearance for
keystock insertion).
Returns dict: cut: Feature info for the extrude_cut (cut_extrude). plane: Plane dict (name, parent_plane, offset_mm) for the tangent reference plane. input echoes (end, diameter_at_end_mm, keyway_*_mm, axial_offset_from_end_mm). keyway_start_x_mm, keyway_end_x_mm: DERIVED — world-X positions of the slot edges. Use these to verify the cut landed where you intended. shaft_bbox_mm: {"min", "max", "size"} — the bbox we resolved the axial position from. Reported so the caller can audit the best-effort end resolution (multi-feature parts — shaft plus flange disk, end cap, etc. — may have bbox X-extremes that aren't the shaft tip). warning: present (string) ONLY if the resolved keyway overlaps the bbox extent — non-fatal, surfaces the question to the caller without raising.
Caveat (orientation): assumes shaft axis = world +X, shaft cross- section centered on Y=Z=0. This matches build_stepped_shaft's contract. For shafts in arbitrary orientation, use the primitive chain (create_reference_plane → create_sketch → create_slot → extrude_cut(reverse_direction=True)) directly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | ||
| keyway_depth_mm | No | ||
| keyway_width_mm | No | ||
| keyway_length_mm | No | ||
| diameter_at_end_mm | Yes | ||
| axial_offset_from_end_mm | No |