FoundationPartsSheet MetalBend

Bend

A bend rotates a flat region of a sheet-metal body around an in-plane line by angle. Unlike edge_flange, the bent region was already part of the body — no new wall is added. Useful for forming sheet metal that has already been laid out flat.

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


class SheetMetalInlineBend(Part):
    def __init__(self, width=120, depth=40, thickness=2, angle=30):
        s = Sketch(self.xy())
        plate = Rectangle.from_center_and_sides(s.origin, width, depth)
        base = base_flange(profile=plate, sketch=s, thickness=thickness)

        # Bend the plate around an in-plane line on the top face
        line = EdgeFinder(rule=InPlaneFinderRule(plane=self.xy()))
        bent = bend(base, bend_line=line, angle=angle)

        self.add_operation(to_solid(bent))


show(SheetMetalInlineBend())