Sheet metal (design for manufacturing)
Design sheet-metal parts the way a fabricator quotes them — a material, a
gauge and outside dimensions — and let the library tell you what a shop
would reject before you send the DXF. This is the cadbuildr-sheetmetal
library, built on Foundation’s sheet-metal operations.
Prerequisites: pip install cadbuildr-sheetmetal (it installs
cadbuildr-foundation and cadbuildr-stdlib).
Make a bracket and check it
from cadbuildr.foundation import show
from cadbuildr.sheetmetal import LBracket, check
bracket = LBracket(
material="aluminum_5052", gauge=14, # 1.63 mm (aluminium uses B&S gauge)
leg_a=30, leg_b=50, width=30, # outside dimensions, mm
hole_size="M5", holes=2, # ISO 273 clearance holes
)
print(check(bracket)) # [] — a shop can make it
show(bracket)Shorten a leg and the check says why it can’t be bent, and what to change:
check(LBracket(gauge=12, leg_a=8, hole_size="none"))
# [{'severity': 'error', 'code': 'dfm.flange',
# 'message': 'LBracket: flange leg_a is 8.0 mm; Cold rolled steel (CRS 1008)
# 12 ga (2.66 mm) needs at least 10.6 mm to form on a press brake',
# 'fix': 'make leg_a >= 10.6 mm or use a thinner gauge', ...}]Stock: gauge, bend radius, K-factor
SheetStock resolves a material and a gauge into what the press brake needs.
The inside bend radius defaults to one thickness, raised to the alloy’s
minimum; the K-factor comes from Foundation’s material curve.
from cadbuildr.sheetmetal import SheetStock, stock_table
s = SheetStock("stainless_304", gauge=16)
s.thickness, s.bend_radius, s.k_factor # (1.519, 1.519, 0.38)
stock_table("cold_rolled_steel") # every gauge with its minimum flangeThe rules
| Code | Rule (default) |
|---|---|
dfm.flange | outside leg ≥ max(4 t, 2.5 t + R) |
dfm.bend_radius | inside radius ≥ the alloy minimum (6061-T6: 3 t) |
dfm.hole_edge | hole edge ≥ 1.5 t from a free edge |
dfm.hole_bend | hole edge ≥ 2.5 t + R from the next leg |
dfm.hole_size, dfm.hole_web | Ø ≥ t (1.2 t stainless), web ≥ 2 t |
dfm.hardware_* | self-clinching insert: minimum sheet, edge distance, harder than the sheet |
Pass your shop’s numbers with check(part, ShopRules(flange_t=5, hole_edge_t=2)).
Self-clinching hardware
ClinchNut, ClinchStud and ClinchStandoff follow the PEM tables (mounting
hole, minimum sheet, edge distance). Parts mark their mounting holes with a
ClinchHole interface, so the hardware is connected, never positioned:
from cadbuildr.sheetmetal import ClinchStandoff, PcbTray, SheetMetalAssembly
class PiTray(SheetMetalAssembly):
def __init__(self):
tray = PcbTray(board="Raspberry Pi 4 / 5", standoff=6)
self.ground(tray)
for hole in tray.group("pcb"):
standoff = ClinchStandoff(size="M2.5", length=6)
self.connect(standoff.interface("seat"), hole)A SheetMetalAssembly adds the DFM issues to check(), so they appear in
the viewer’s Check panel. Switch the tray to material="stainless_304" and the
check reports that SO standoffs don’t clinch in stainless (use SO4).
Rack chassis
RackChassisShell is a one-piece 19 in chassis (EIA-310): base, side walls
and front panel bent up, rack ears with mounting slots, lid lips, vents and
PCB standoff holes. RackChassis presses the standoffs in.
from cadbuildr.sheetmetal import RackChassis
show(RackChassis(units=1, depth=250, gauge=16, lip=8))Flat pattern, DXF, bend table, cost
bracket.bend_table() # angle, up/down, radius, K, bend allowance / deduction
bracket.flat_pattern() # blank size, holes, bend lines
bracket.to_dxf("bracket.dxf") # layers OUTLINE, HOLES, BEND_UP, BEND_DOWN
bracket.cost() # material + cutting + bending + inserts + setup
LBracket(flatten=True) # the kernel's flat pattern in the viewerParts
| Part | What it is |
|---|---|
LBracket | 90° bracket, clearance holes per leg |
AngleClip | equal-leg clip with adjustment slots |
ZBracket | offset (joggle) bracket |
UBracket | U channel, optional clevis cross hole |
PcbTray | tray with standoffs in a board pattern, legs and feet |
RackChassisShell / RackChassis | 19 in 1–4 U chassis |
ClinchNut / ClinchStud / ClinchStandoff | self-clinching hardware |
BracketOnProfiles | an L bracket joining two 2020 profiles with stdlib screws and T-nuts |