Forming Features

Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import (
    Line,
    Part,
    Point,
    Rectangle,
    SheetMetalBaseFlange,
    SheetMetalBead,
    SheetMetalDimple,
    SheetMetalExtrudedHole,
    SheetMetalToSolid,
    Sketch,
    sheet_thickness,
    show,
)


class FormedPanel(Part):
    """Forming features on a 16-gauge aluminium panel: a dimple, an extruded
    (flanged) hole and a stiffening bead, all formed up from the top face."""

    def __init__(self, length=120, width=60):
        t = sheet_thickness("aluminum_5052", 16)
        s = Sketch(self.xy())
        body = SheetMetalBaseFlange(
            profile=Rectangle.from_center_and_sides(s.origin, length, width),
            thickness=t,
            material="aluminum_5052",
        )
        top = Sketch(self.xy().get_parallel_plane(t))
        body = SheetMetalDimple(
            body=body, center=Point(top, -35, 0), radius=12, depth=5
        )
        body = SheetMetalExtrudedHole(
            body=body, center=Point(top, 0, 0), radius=8, height=6
        )
        body = SheetMetalBead(
            body=body, path=Line(Point(top, 25, -18), Point(top, 45, 18)), radius=4
        )
        self.add_operation(SheetMetalToSolid(body=body))
        self.paint("light_bluish_gray")


show(FormedPanel())

Forming features press shapes into the sheet. Sketch their position on a flange face; they rise along the sketch normal.

NodeFeature
SheetMetalDimple(body, center, radius, depth)a hollow spherical dimple
SheetMetalExtrudedHole(body, center, radius, height)a hole drawn up into a collar (flanged hole, e.g. for tapping thin sheet)
SheetMetalBead(body, path, radius)a half-round stiffening ridge along a line, with rounded ends
SheetMetalFormTool(body, tool, face)any solid pressed into the sheet as a hollow form (below)

In the flat pattern, an extruded hole is the smaller pre-form hole it is drawn from. Dimples and beads keep the plain sheet.

Stock gauges. The panel above is 16-gauge 5052 aluminium: sheet_thickness("aluminum_5052", 16) returns 1.291 mm from the stock tables in MATERIALS. material="aluminum_5052" records the stock on the base flange in the DAG, for BOMs and flat-pattern exports.

from cadbuildr.foundation import (
    Line,
    Part,
    Point,
    Rectangle,
    SheetMetalBaseFlange,
    SheetMetalBead,
    SheetMetalDimple,
    SheetMetalExtrudedHole,
    SheetMetalToSolid,
    Sketch,
    sheet_thickness,
    show,
)


class FormedPanel(Part):
    """Forming features on a 16-gauge aluminium panel: a dimple, an extruded
    (flanged) hole and a stiffening bead, all formed up from the top face."""

    def __init__(self, length=120, width=60):
        t = sheet_thickness("aluminum_5052", 16)
        s = Sketch(self.xy())
        body = SheetMetalBaseFlange(
            profile=Rectangle.from_center_and_sides(s.origin, length, width),
            thickness=t,
            material="aluminum_5052",
        )
        top = Sketch(self.xy().get_parallel_plane(t))
        body = SheetMetalDimple(
            body=body, center=Point(top, -35, 0), radius=12, depth=5
        )
        body = SheetMetalExtrudedHole(
            body=body, center=Point(top, 0, 0), radius=8, height=6
        )
        body = SheetMetalBead(
            body=body, path=Line(Point(top, 25, -18), Point(top, 45, 18)), radius=4
        )
        self.add_operation(SheetMetalToSolid(body=body))
        self.paint("light_bluish_gray")


show(FormedPanel())

Form tool: press any solid

Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import (
    Circle,
    Extrusion,
    Loft,
    Part,
    Point,
    Rectangle,
    SheetMetalBaseFlange,
    SheetMetalFormTool,
    SheetMetalToSolid,
    Sketch,
    show,
)


class FormedPanel(Part):
    """SheetMetalFormTool — any solid pressed into the sheet: a tapered pad
    raised from the top face and a round boss pressed out of the bottom."""

    def __init__(self, thickness=1.5):
        s = Sketch(self.xy())
        body = SheetMetalBaseFlange(
            profile=Rectangle.from_center_and_sides(s.origin, 80, 50),
            thickness=thickness,
        )

        # A tapered pad standing on the top face: a loft from 30 x 20 to 20 x 10.
        top = self.xy().get_parallel_plane(thickness)
        pad_top = top.get_parallel_plane(5)
        pad = Loft(
            [
                Rectangle.from_center_and_sides(Point(Sketch(top), -15, 0), 30, 20),
                Rectangle.from_center_and_sides(Point(Sketch(pad_top), -15, 0), 20, 10),
            ]
        )
        body = SheetMetalFormTool(body, pad, top)

        # A round boss pressed down out of the bottom face (the XY plane).
        boss = Extrusion(Circle(Point(s, 22, 0), 9), -4)
        body = SheetMetalFormTool(body, boss, self.xy())

        self.add_operation(SheetMetalToSolid(body=body))
        self.paint("light_blue")


show(FormedPanel())

SheetMetalFormTool(body, tool, face) presses any solid into the sheet: an Extrusion, a Loft, a Lathe, a boolean of several… face is the plane of the flange face the tool stands on. The part of the tool outside the sheet becomes a hollow form, with walls one sheet thick (grown inward, sharp corners), open where it meets the sheet. The sheet under it is cut open. On the bottom face (here the xy() plane of a base flange), the form presses downward.

  • Don’t add the tool to the part. Only the form is added.
  • A tool modelled partly inside the sheet is fine: only what stands out of the sheet forms.
  • The tool needs a flat face lying in face, and every wall at least two sheet thicknesses thick so it can be hollowed. Otherwise the kernel reports what is wrong instead of returning a form.
  • Like dimples and beads, forms are not developed: Unfold gives the plain sheet, with no cut-out.
from cadbuildr.foundation import (
    Circle,
    Extrusion,
    Loft,
    Part,
    Point,
    Rectangle,
    SheetMetalBaseFlange,
    SheetMetalFormTool,
    SheetMetalToSolid,
    Sketch,
    show,
)


class FormedPanel(Part):
    """SheetMetalFormTool — any solid pressed into the sheet: a tapered pad
    raised from the top face and a round boss pressed out of the bottom."""

    def __init__(self, thickness=1.5):
        s = Sketch(self.xy())
        body = SheetMetalBaseFlange(
            profile=Rectangle.from_center_and_sides(s.origin, 80, 50),
            thickness=thickness,
        )

        # A tapered pad standing on the top face: a loft from 30 x 20 to 20 x 10.
        top = self.xy().get_parallel_plane(thickness)
        pad_top = top.get_parallel_plane(5)
        pad = Loft(
            [
                Rectangle.from_center_and_sides(Point(Sketch(top), -15, 0), 30, 20),
                Rectangle.from_center_and_sides(Point(Sketch(pad_top), -15, 0), 20, 10),
            ]
        )
        body = SheetMetalFormTool(body, pad, top)

        # A round boss pressed down out of the bottom face (the XY plane).
        boss = Extrusion(Circle(Point(s, 22, 0), 9), -4)
        body = SheetMetalFormTool(body, boss, self.xy())

        self.add_operation(SheetMetalToSolid(body=body))
        self.paint("light_blue")


show(FormedPanel())