FoundationPartsOperationsRib & Push/Pull

Rib & Push/Pull

  • Rib(points, thickness) fills the area between an open polyline and the straight line joining its ends, and extrudes it thickness symmetrically about its sketch plane. Three points make the classic triangular gusset, as between the two plates above. A Rib expands into an Extrusion, so use rib.expand() inside a BooleanOperation, or add it straight to the part.
  • OffsetFace(solid, face_finder, distance) pushes or pulls planar faces along their outward normal: positive distance grows the solid, negative cuts into it. Here the upright’s top face is pulled up 10 mm.
import math

from cadbuildr.foundation import *


class GussetedBracket(Part):
    """Rib + OffsetFace.

    A base plate and an upright plate are joined by a triangular Rib (gusset)
    sketched on the YZ plane, and the upright's top face is pulled up 10 mm
    with OffsetFace (push/pull).
    """

    def __init__(self, thickness=5, upright=30):
        s = Sketch(self.xy())
        base = Extrusion(Rectangle.from_center_and_sides(s.origin, 40, 50), thickness)
        wall_s = Sketch(self.xy())
        wall = Extrusion(
            Rectangle.from_center_and_sides(Point(wall_s, 0, -22.5), 40, thickness),
            upright,
        )
        side = Sketch(self.yz())
        rib = Rib(
            [
                Point(side, -20, thickness),
                Point(side, 15, thickness),
                Point(side, -20, upright),
            ],
            4,
        )
        body = BooleanOperation(base, [wall, rib.expand()], BooleanOp.UNION)
        top = FaceFinder(rule=InPlaneFinderRule(self.xy(), upright))
        self.add_operation(OffsetFace(body, top, 10))
        self.rotate(math.pi)  # upright at the back, so the camera sees the gusset
        self.paint("medium_azure")


show(GussetedBracket())