Corner Relief
Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import (
Assembly,
Line,
Part,
Point,
Rectangle,
SheetMetalBaseFlange,
SheetMetalCornerRelief,
SheetMetalEdgeFlange,
SheetMetalToSolid,
Sketch,
Unfold,
show,
)
from cadbuildr.foundation.gen.models import CornerReliefType
class _RelievedCorner(Part):
"""Two flanges meeting at a corner, with a round corner relief."""
def __init__(self, flatten=False, width=60, depth=40, wall=15, thickness=2):
s = Sketch(self.xy())
body = SheetMetalBaseFlange(
profile=Rectangle.from_center_and_sides(s.origin, width, depth),
thickness=thickness,
)
w, h = width / 2, depth / 2
body = SheetMetalEdgeFlange(
body=body, edge=Line(Point(s, -w, -h), Point(s, w, -h)), length=wall
)
body = SheetMetalEdgeFlange(
body=body, edge=Line(Point(s, w, -h), Point(s, w, h)), length=wall
)
body = SheetMetalCornerRelief(
body=body, relief_type=CornerReliefType.CIRCULAR, size=8
)
if flatten:
body = Unfold(body=body)
self.add_operation(SheetMetalToSolid(body=body))
self.paint("orange" if flatten else "light_blue")
class SheetMetalCornerReliefDemo(Assembly):
"""SheetMetalCornerRelief: folded (left) and flat (right) — the relief hole
sits where the two bends meet."""
def __init__(self):
folded = _RelievedCorner()
folded.translate([-45, 0, 0])
self.add_component(folded)
flat = _RelievedCorner(flatten=True)
flat.translate([45, 0, 0])
self.add_component(flat)
show(SheetMetalCornerReliefDemo())SheetMetalCornerRelief(body, relief_type, size) cuts a relief wherever two
bends off the same flange meet at a corner, so the bends don’t collide and the
flat pattern doesn’t tear there.
relief_type | Relief |
|---|---|
RECTANGULAR (default) | a size × size square centred on the corner |
CIRCULAR / OBROUND | a circle of diameter size |
The relief is recorded on the parent flange, so it appears in the flat pattern (right) and in the DXF export.
from cadbuildr.foundation import (
Assembly,
Line,
Part,
Point,
Rectangle,
SheetMetalBaseFlange,
SheetMetalCornerRelief,
SheetMetalEdgeFlange,
SheetMetalToSolid,
Sketch,
Unfold,
show,
)
from cadbuildr.foundation.gen.models import CornerReliefType
class _RelievedCorner(Part):
"""Two flanges meeting at a corner, with a round corner relief."""
def __init__(self, flatten=False, width=60, depth=40, wall=15, thickness=2):
s = Sketch(self.xy())
body = SheetMetalBaseFlange(
profile=Rectangle.from_center_and_sides(s.origin, width, depth),
thickness=thickness,
)
w, h = width / 2, depth / 2
body = SheetMetalEdgeFlange(
body=body, edge=Line(Point(s, -w, -h), Point(s, w, -h)), length=wall
)
body = SheetMetalEdgeFlange(
body=body, edge=Line(Point(s, w, -h), Point(s, w, h)), length=wall
)
body = SheetMetalCornerRelief(
body=body, relief_type=CornerReliefType.CIRCULAR, size=8
)
if flatten:
body = Unfold(body=body)
self.add_operation(SheetMetalToSolid(body=body))
self.paint("orange" if flatten else "light_blue")
class SheetMetalCornerReliefDemo(Assembly):
"""SheetMetalCornerRelief: folded (left) and flat (right) — the relief hole
sits where the two bends meet."""
def __init__(self):
folded = _RelievedCorner()
folded.translate([-45, 0, 0])
self.add_component(folded)
flat = _RelievedCorner(flatten=True)
flat.translate([45, 0, 0])
self.add_component(flat)
show(SheetMetalCornerReliefDemo())