Fillet & Chamfer variants

Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
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())

Beyond a constant radius:

OptionEffect
Fillet(..., radius_end=r2)variable fillet: radius at the start of each edge, r2 at its end
Fillet(..., radius_points=[FilletRadiusPoint(t, r)])variable fillet through control points: radius r at position t along each edge (see below)
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())

Tangent chains

A fillet or chamfer on one edge runs on along every edge tangent to it. Picking one straight edge of a rounded-rectangle outline bevels the whole outline, straights and arcs, in one smooth band. This holds for plain, two-distance and distance-angle chamfers, and for fillets. To stop at a corner, the edges must meet at an angle.

Vertex chamfer (corner setback)

self.chamfer_vertices(d) cuts corners off the part’s body built so far. Each corner, a convex vertex where exactly three straight edges meet, is cut by the plane through the points d along its three edges. On a right-angled corner this removes d³/6.

self.chamfer_vertices(4)                                   # every such corner
self.chamfer_vertices(4, at=[(15, -15, 20)])               # only these corners
self.add_operation(VertexChamfer(body, 8, vertices=[Point3D(15, -15, 20)]))  # on one feature

In the default mode, corners that are concave, have curved edges, or have more or fewer than three edges are skipped. A corner you pick with at / vertices that can’t be bevelled is a processing error, and so is a distance not shorter than the corner’s edges.

Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import *


class MouldedBlock(Part):
    """Parting-line draft: a 40 x 30 x 24 block whose walls keep their outline
    on the parting plane at z = 12 and taper 6 degrees above and below it
    (the part releases from a two-half mould)."""

    def __init__(self):
        s = Sketch(self.xy())
        body = Extrusion([Rectangle.from_center_and_sides(s.origin, 40, 30)], 24)
        parting = self.xy().get_parallel_plane(12)
        self.add_operation(PartingLineDraft(body, 6, parting_plane=parting))
        self.translate([-28, 0, 0])
        self.paint("light_blue")


class FlangedBoss(Part):
    """Parting-line draft about an edge chain: the edges where the boss meets
    its flange (z = 6) are the parting line; the flange tapers down, the boss
    tapers up."""

    def __init__(self):
        s = Sketch(self.xy())
        flange = Extrusion([Rectangle.from_center_and_sides(s.origin, 36, 28)], 6)
        boss = Extrusion([Rectangle.from_center_and_sides(s.origin, 26, 18)], 22, 6)
        body = BooleanOperation(flange, [boss], BooleanOp.UNION)
        parting_edges = EdgeFinder(InPlaneFinderRule(self.xy(), 6))
        self.add_operation(PartingLineDraft(body, 5, parting_edges=parting_edges))
        self.translate([28, 0, 0])
        self.paint("dark_orange")


class CornerSetback(Part):
    """Vertex chamfer (corner setback): every corner of the block is cut off
    4 mm along each of its three edges."""

    def __init__(self):
        s = Sketch(self.xy())
        self.extrude(Rectangle.from_center_and_sides(s.origin, 30, 30), 20)
        self.chamfer_vertices(4)
        self.translate([0, 45, 0])
        self.paint("lime")


class OneCorner(Part):
    """One picked corner, set back 8 mm (VertexChamfer on a feature)."""

    def __init__(self):
        s = Sketch(self.xy())
        body = Extrusion([Rectangle.from_center_and_sides(s.origin, 30, 30)], 20)
        self.add_operation(VertexChamfer(body, 8, vertices=[Point3D(15, -15, 20)]))
        self.translate([0, -45, 0])
        self.paint("light_blue")


class PartingDraftCorners(Assembly):
    def __init__(self):
        self.add_component(MouldedBlock())
        self.add_component(FlangedBoss())
        self.add_component(CornerSetback())
        self.add_component(OneCorner())


show(PartingDraftCorners())

The green block has all eight corners set back 4 mm. The blue one at the front has one corner set back 8 mm. The two parts on the left and right show parting-line draft.

Variable fillet through control points

radius_points adds radius control points between the two ends of each edge. A position runs from 0 (the edge’s start, where the radius is radius) to 1 (its end, where it is radius_end, or radius if you leave radius_end out); control points must lie strictly between them.

self.fillet_edges(1, edges=back_edge, radius_points=[(0.5, 6)])  # 1 → 6 → 1 mm
self.add_operation(
    Fillet(body, 1, edge_finder=front_edge, radius_end=2,
           radius_points=[FilletRadiusPoint(0.25, 4)])               # 1 → 4 → 2 mm
)
Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import *


class VariableFilletPoints(Part):
    """Variable fillets through radius control points on a 60 x 24 x 14 block.

    - back top edge: 1 mm at both ends, 6 mm half-way (a "pinched" fillet);
    - front top edge: 1 mm -> 4 mm at a quarter -> 2 mm at the end.
    Positions run from 0 (the edge's start) to 1 (its end).
    """

    def __init__(self):
        s = Sketch(self.xy())
        self.extrude(Rectangle.from_center_and_sides(s.origin, 60, 24), 14)

        back = EdgeFinder(ContainsPointFinderRule(Point3D(0, 12, 14)))
        self.fillet_edges(1, edges=back, radius_points=[(0.5, 6)])

        front = EdgeFinder(ContainsPointFinderRule(Point3D(0, -12, 14)))
        self.fillet_edges(1, edges=front, radius_end=2, radius_points=[(0.25, 4)])
        self.paint("light_blue")


show(VariableFilletPoints())
  • The radius follows a smooth curve through the control points that never goes above or below its neighbouring control points (a monotone cubic), so the largest radius is the largest one you give.
  • Which end of an edge is “0” is the edge’s own direction. On a symmetric law (same radius at both ends) this does not matter.
  • On a chain of tangent edges (a rounded-rectangle outline, say) the fillet runs along the whole chain and every edge of the chain gets the same law.
  • A radius too large for the neighbouring faces fails with a processing error that lists the radii.

Not supported yet: conic (rho) and curvature-continuous fillets, and a face blend between two face sets. The OpenCascade fillet builder only makes circular-section fillets on edges.

from cadbuildr.foundation import *


class VariableFilletPoints(Part):
    """Variable fillets through radius control points on a 60 x 24 x 14 block.

    - back top edge: 1 mm at both ends, 6 mm half-way (a "pinched" fillet);
    - front top edge: 1 mm -> 4 mm at a quarter -> 2 mm at the end.
    Positions run from 0 (the edge's start) to 1 (its end).
    """

    def __init__(self):
        s = Sketch(self.xy())
        self.extrude(Rectangle.from_center_and_sides(s.origin, 60, 24), 14)

        back = EdgeFinder(ContainsPointFinderRule(Point3D(0, 12, 14)))
        self.fillet_edges(1, edges=back, radius_points=[(0.5, 6)])

        front = EdgeFinder(ContainsPointFinderRule(Point3D(0, -12, 14)))
        self.fillet_edges(1, edges=front, radius_end=2, radius_points=[(0.25, 4)])
        self.paint("light_blue")


show(VariableFilletPoints())