FoundationPartsSheet MetalCorner Break

Corner Break

SheetMetalCornerBreak rounds (FILLET) or bevels (CHAMFER) the corners of a sheet through its thickness. These are the short edges across the sheet at a corner of a flange, the ones you break so a part has no sharp corners. The flat pattern gets the same arc or bevel, so Unfold and the DXF export include it.

SheetMetalCornerBreak(body, corners, radius, break_type=CornerBreakType.FILLET)
  • corners: Points sketched on one face of a flange, each exactly on a corner of that flange’s outline. All the points of one corner break share a sketch, so use one corner break per face. The sketch can be on either face of the sheet.
  • radius: the fillet radius, or how far the chamfer is set back along both edges.
  • break_type: CornerBreakType.FILLET (default) or CornerBreakType.CHAMFER.

Above, the base’s back corners are rounded 6 mm (points on the base sketch) and the wall’s top corners are bevelled 4 mm (points on a sketch on the wall’s outer face). The wall’s top edge is at thickness + bend radius + wall length above the base, because the wall starts above the base and its bend.

The kernel reports a clear error instead of building the part when:

  • a point is not on a corner (for example, the middle of an edge);
  • a break doesn’t fit, because it needs more straight edge than the corner has;
  • a corner is where a bend or another flange joins, so it has no free edge through the thickness.
from cadbuildr.foundation import (
    Assembly,
    CornerBreakType,
    Line,
    Part,
    Point,
    Rectangle,
    SheetMetalBaseFlange,
    SheetMetalCornerBreak,
    SheetMetalEdgeFlange,
    SheetMetalToSolid,
    Sketch,
    Unfold,
    show,
)

BEND_RADIUS = 1.0  # SheetMetalBaseFlange's default_bend_radius


class _Bracket(Part):
    """L-bracket: base corners rounded, wall corners bevelled."""

    def __init__(self, flatten=False, width=60, depth=40, thickness=2, wall=24):
        s = Sketch(self.xy())
        body = SheetMetalBaseFlange(
            profile=Rectangle.from_center_and_sides(s.origin, width, depth),
            thickness=thickness,
        )
        front = Line(Point(s, -width / 2, -depth / 2), Point(s, width / 2, -depth / 2))
        body = SheetMetalEdgeFlange(body=body, edge=front, length=wall)

        # Round the base's two back corners (points on the base's bottom face).
        back = [Point(s, -width / 2, depth / 2), Point(s, width / 2, depth / 2)]
        body = SheetMetalCornerBreak(body, back, 6)

        # Bevel the wall's two top corners (points on the wall's outer face).
        # The wall's top edge sits above the base and its bend.
        top = thickness + BEND_RADIUS + wall
        wall_face = Sketch(self.xz().get_parallel_plane(depth / 2))
        tips = [Point(wall_face, -width / 2, top), Point(wall_face, width / 2, top)]
        body = SheetMetalCornerBreak(body, tips, 4, break_type=CornerBreakType.CHAMFER)

        if flatten:
            body = Unfold(body=body)
        self.add_operation(SheetMetalToSolid(body=body))
        self.paint("orange" if flatten else "light_blue")


class SheetMetalCornerBreakBracket(Assembly):
    """SheetMetalCornerBreak — the bracket folded (left) and as its flat
    pattern (right): the rounded and bevelled corners follow into the flat."""

    def __init__(self, separation=40):
        folded = _Bracket()
        folded.translate([-separation, 0, 0])
        self.add_component(folded)
        flat = _Bracket(flatten=True)
        flat.translate([separation, 0, 0])
        self.add_component(flat)


show(SheetMetalCornerBreakBracket())