FoundationPartsOperationsDraft

Draft

Draft(solid, angle_deg, neutral_plane_name="XY") tapers faces so a part can be pulled out of a mould or a casting. The faces keep their size on the neutral plane and lean inward by angle_deg going along the pull direction, which is that plane’s normal: "XY" pulls along +Z, "YZ" along +X, "XZ" along +Y.

By default every planar face parallel to the pull direction (all the side walls) is drafted. Pass edge_finder=FaceFinder(rule=…) to draft only some faces.

Draft composes like any other modifier. The tray on the right is Shell(Draft(Extrusion), 1.5): draft first, then hollow.

from cadbuildr.foundation import *


class TaperedBlock(Part):
    """Draft: every side wall leans in 5° going up from the XY (neutral) plane."""

    def __init__(self):
        s = Sketch(self.xy())
        block = Extrusion(Rectangle.from_center_and_sides(s.origin, 30, 20), 15)
        self.add_operation(Draft(block, 5))
        self.translate([-25, 0, 0])
        self.paint("light_blue")


class MouldedTray(Part):
    """Draft composes like any modifier: Shell(Draft(Extrusion)) gives a
    mould-friendly open tray with tapered walls."""

    def __init__(self):
        s = Sketch(self.xy())
        block = Extrusion(Rectangle.from_center_and_sides(s.origin, 30, 20), 15)
        self.add_operation(Shell(Draft(block, 8), 1.5))
        self.translate([25, 0, 0])
        self.paint("dark_orange")


class DraftExamples(Assembly):
    def __init__(self):
        self.add_component(TaperedBlock())
        self.add_component(MouldedTray())


show(DraftExamples())