Split & Full round

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


class Dome(Part):
    """Split keeps one side of a world plane: half a sphere."""

    def __init__(self, radius=20):
        s = Sketch(self.xy())
        self.add_operation(Split(Sphere(s.origin, radius), "XY", "TOP"))
        self.paint("light_blue")


class RoundedRib(Part):
    """FullRound replaces the selected face (the top of a 4 mm rib) with a
    half-round of radius 2 mm, tangent to both sides of the rib."""

    def __init__(self, length=40, thickness=4, height=20):
        s = Sketch(self.xy())
        rib = Extrusion(
            Rectangle.from_center_and_sides(s.origin, length, thickness), height
        )
        top = FaceFinder(rule=InPlaneFinderRule(self.xy(), height))
        self.add_operation(FullRound(rib, top))
        self.translate([50, 0, 0])
        self.paint("dark_orange")


class SplitAndFullRound(Assembly):
    def __init__(self):
        self.add_component(Dome())
        self.add_component(RoundedRib())


show(SplitAndFullRound())
  • Split(solid, plane_name, keep) keeps the part of a solid on one side of a world plane ("XY", "YZ", "XZ"). keep="TOP" keeps the +normal side (z ≥ 0 for XY), "BOTTOM" the other — the dome above is half a sphere. keep="BOTH" keeps both halves as separate solids that share the cut face, e.g. to colour or export them apart. The cut uses OpenCascade’s splitter.
  • FullRound(solid, face_finder) replaces the face picked by the FaceFinder (the end of a rib or boss) with an exact half-round. It finds the two parallel, opposite side faces next to it, uses half the distance between them as the radius, and makes the round tangent to both, so no flat is left. The face must be a rectangle with two such sides, and the finder must match exactly one face.

Both replace the solid built so far with their result, like Fillet.

from cadbuildr.foundation import *


class Dome(Part):
    """Split keeps one side of a world plane: half a sphere."""

    def __init__(self, radius=20):
        s = Sketch(self.xy())
        self.add_operation(Split(Sphere(s.origin, radius), "XY", "TOP"))
        self.paint("light_blue")


class RoundedRib(Part):
    """FullRound replaces the selected face (the top of a 4 mm rib) with a
    half-round of radius 2 mm, tangent to both sides of the rib."""

    def __init__(self, length=40, thickness=4, height=20):
        s = Sketch(self.xy())
        rib = Extrusion(
            Rectangle.from_center_and_sides(s.origin, length, thickness), height
        )
        top = FaceFinder(rule=InPlaneFinderRule(self.xy(), height))
        self.add_operation(FullRound(rib, top))
        self.translate([50, 0, 0])
        self.paint("dark_orange")


class SplitAndFullRound(Assembly):
    def __init__(self):
        self.add_component(Dome())
        self.add_component(RoundedRib())


show(SplitAndFullRound())