FoundationPartsSheet MetalContour Flange

Contour Flange

A contour flange is a sketch-driven flange — instead of a fixed rectangular cross-section, you draw the cross-section profile yourself on a sketch perpendicular to the body edge and extrude it along length. This is how you build lipped, hemmed or otherwise non-trivial flange edges.

from cadbuildr.foundation import *
from cadbuildr.foundation.sheet_metal import base_flange, contour_flange, to_solid


class SheetMetalContour(Part):
    def __init__(self, width=80, depth=40, thickness=2, lip_length=30):
        # Base plate
        s_base = Sketch(self.xy())
        plate = Rectangle.from_center_and_sides(s_base.origin, width, depth)
        base = base_flange(profile=plate, sketch=s_base, thickness=thickness)

        # Cross-section sketch on a plane perpendicular to the chosen edge
        s_profile = Sketch(self.yz())
        lip = Rectangle.from_center_and_sides(s_profile.origin, 8, thickness)
        edge = EdgeFinder(rule=InPlaneFinderRule(plane=self.xy()))
        flange = contour_flange(
            base, edge_finder=edge, profile=lip, sketch=s_profile, length=lip_length
        )

        self.add_operation(to_solid(flange))


show(SheetMetalContour())