FoundationPartsSheet MetalMiter Flange

Miter Flange

The SheetMetalMiterFlange node sweeps a user-authored cross-section along an edge (or a chain of edges, mitered at the corners). Unlike a SheetMetalEdgeFlange — a single bent wall — you draw the profile yourself in (outward, up) local coordinates. Here an L-lip (a flat arm that turns up into a return lip) is swept along the front edge. The single-edge case is the classic “contour flange”.

from cadbuildr.foundation import Part, Sketch, Rectangle, Line, Point, show
from cadbuildr.foundation.draw import Draw
from cadbuildr.foundation import SheetMetalBaseFlange, SheetMetalMiterFlange, SheetMetalToSolid


class SheetMetalMiter(Part):
    """Miter Flange — sweep a user-authored cross-section along an edge. The
    profile is drawn in (outward, up) local coords; here an L-lip."""

    def __init__(self, width=80, depth=40, thickness=2):
        sb = Sketch(self.xy())
        base = SheetMetalBaseFlange(
            profile=Rectangle.from_center_and_sides(sb.origin, width, depth), thickness=thickness
        )
        sp = Sketch(self.yz())
        d = Draw(sp)
        d.move_to(0.0, 0.0)
        d.line_to(0.0, -thickness)
        d.line_to(18.0, -thickness)
        d.line_to(18.0, 14.0)
        d.line_to(18.0 - thickness, 14.0)
        d.line_to(18.0 - thickness, 0.0)
        lip = d.close()
        front = Line(Point(sb, -width / 2, -depth / 2), Point(sb, width / 2, -depth / 2))
        self.add_operation(SheetMetalToSolid(body=SheetMetalMiterFlange(body=base, edges=[front], profile=lip)))


show(SheetMetalMiter())