FoundationPartsOperationsFillet & Chamfer variants

Fillet & Chamfer variants

Beyond a constant radius:

OptionEffect
Fillet(..., radius_end=r2)variable fillet: radius at the start of each edge, r2 at its end
Chamfer(..., distance2=d2)two-distance chamfer: radius on one face, d2 on the other
Chamfer(..., angle_deg=a)distance-angle chamfer: radius on the first face, at angle a

Use an EdgeFinder to pick the edges, exactly as for plain fillets.

from cadbuildr.foundation import *


def _block(part, length=40, width=20, height=12):
    s = Sketch(part.xy())
    return Extrusion(Rectangle.from_center_and_sides(s.origin, length, width), height)


class VariableFillet(Part):
    """Fillet with `radius_end`: each upright edge grows from 1 mm to 6 mm."""

    def __init__(self):
        self.add_operation(
            Fillet(
                _block(self),
                1,
                edge_finder=EdgeFinder(rule=ParallelToAxisRule(axis="Z")),
                radius_end=6,
            )
        )
        self.translate([-50, 0, 0])
        self.paint("light_blue")


class TwoDistanceChamfer(Part):
    """Chamfer with `distance2`: 4 mm on one face, 2 mm on the other."""

    def __init__(self):
        top = EdgeFinder(rule=InPlaneFinderRule(self.xy(), 12))
        self.add_operation(Chamfer(_block(self), 4, edge_finder=top, distance2=2))
        self.paint("dark_orange")


class AngleChamfer(Part):
    """Chamfer with `angle_deg`: 3 mm at 30° from the first face."""

    def __init__(self):
        top = EdgeFinder(rule=InPlaneFinderRule(self.xy(), 12))
        self.add_operation(Chamfer(_block(self), 3, edge_finder=top, angle_deg=30))
        self.translate([50, 0, 0])
        self.paint("lime")


class EdgeTreatments(Assembly):
    def __init__(self):
        self.add_component(VariableFillet())
        self.add_component(TwoDistanceChamfer())
        self.add_component(AngleChamfer())


show(EdgeTreatments())