Slot family

Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import *


class SlotsPlate(Part):
    """Three slot variants — same pill geometry, different parameterizations.

    `SlotCenterToCenter(p1, p2, height)` — pill from p1 to p2 with parallel
    sides separated by `height`.
    `SlotOverall(center, width, height)` — bounding-rectangle dimensions.
    `SlotCenterPoint(center, point, height)` — center plus one endpoint.

    The slots are drawn on the plate's XY face and extruded straight through
    its thickness as cuts, stacked along Y so all three are visible at once.
    """

    def __init__(self):
        s = Sketch(self.xy())
        # Flat plate lying in the XY plane, 4 thick along Z.
        self.add_operation(Box(s.origin, w=80, d=40, h=4))
        # Three slots, vertically offset for clarity, cut straight through Z.
        self.add_operation(Extrusion(
            SlotCenterToCenter(Point(s, -22, 13), Point(s, 22, 13), height=6),
            start=-4, end=4, cut=BoolParameter(value=True),
        ))
        self.add_operation(Extrusion(
            SlotOverall(Point(s, 0, 0), width=50, height=6),
            start=-4, end=4, cut=BoolParameter(value=True),
        ))
        self.add_operation(Extrusion(
            SlotCenterPoint(center=Point(s, 0, -13), point=Point(s, 22, -13), height=6),
            start=-4, end=4, cut=BoolParameter(value=True),
        ))
        self.paint("medium_azure")


show(SlotsPlate())

A slot is a pill-shaped 2D primitive: two parallel sides connected by two semicircular ends. Three constructors target the same geometry:

SlotCenterToCenter(p1, p2, height)             # endpoints of the centerline
SlotOverall(center, width, height)             # bounding-rectangle dimensions
SlotCenterPoint(center, point, height)         # center + endpoint pair

All expand to a CustomClosedShape (2 lines + 2 arcs) and compose with Extrusion for cuts or pads.