Engineering standards
Look up the numbers a part needs to be made and assembled: ISO 286 fits, tap
drills and clearance holes, counterbores, thread tables, inserts for 3D
prints, keys, circlips, O-ring grooves, materials, surface finish and
general tolerances. Holes and shaft cuts sized from these tables carry the
interfaces that let standard screws, nuts and bearings connect. This is
cadbuildr.stdlib.standards, part of the standard library.
Prerequisites: pip install cadbuildr-stdlib (it installs
cadbuildr-foundation). Lengths are in millimetres.
Size a bearing seat with an ISO 286 fit
from cadbuildr.stdlib.standards import bearing_fit, fit, tolerance
f = fit("H7/g6", 10)
print(f.hole.limits, f.shaft.limits) # (10.0, 10.015) (9.986, 9.995)
print(f.kind, f.min_clearance) # clearance 0.005
shaft = tolerance("k6", 8) # 608 bearing on a rotating shaft
print(shaft.mean) # 8.0055: the diameter to model
print(bearing_fit("k6", 8).kind) # interference (bearing bore is 0 / -8 µm)Upper-case letters are holes, lower-case are shafts. Covered: shafts c, d,
e, f, g, h, js, k, m, n, p, r, s and the matching holes, grades IT1 to IT16,
sizes up to 500 mm. bearing_fit() compares against the ISO 492 bearing
rings rather than an H hole, because a bearing bore is undersize.
For printed parts, use printed_clearance("sliding", "fdm") (0.3 mm) instead
of ISO 286.
Tap and bolt a plate
from cadbuildr.foundation import Assembly, show
from cadbuildr.stdlib.fasteners import DIN912Screw
from cadbuildr.stdlib.standards import screw_length, thread
from cadbuildr.stdlib.standards.demos import ClampPlate, TappedBlock
print(thread("M5").tap_drill, thread("M5").clearance("normal")) # 4.2 5.5
plate = ClampPlate(size="M5", n=2, thickness=10, holes="counterbore")
length = screw_length("M5", plate.grip) # 16: clamps the plate + 1.5 d thread
block = TappedBlock(size="M5", n=2, height=20, depth=12)
asm = Assembly()
asm.ground(block)
asm.connect(plate.interface("bottom"), block.interface("top"))
asm.connect_all(lambda: DIN912Screw("M5", length, with_thread=False), plate.group("bolts"))
print(asm.check()) # []
show(asm)On your own parts, drill holes at registered anchors with the hole
features. Each one cuts the hole and binds a ScrewHole (or Bore)
interface carrying the nominal size:
| Feature | Size from | Interface |
|---|---|---|
tapped_hole(anchor, "M5", depth) | ISO 2306 tap drill | ScrewHole(thread=True) |
clearance_hole(anchor, "M5", depth, "close") | ISO 273 close / normal / loose | ScrewHole |
counterbored_hole(anchor, "M5", depth) | DIN 974-1 counterbore | ScrewHole on the counterbore floor |
countersunk_hole(anchor, "M4", depth) | ISO 10642 head, 90° | ScrewHole |
heat_set_insert_hole(anchor, "M3") | insert hole + 1 mm | ScrewHole(thread=True) |
self_tap_screw_hole(anchor, "M3", material="ABS") | 0.8 d pilot for ABS | ScrewHole(thread=True) |
fitted_bore(anchor, 22, "H7", depth) | ISO 286 zone mean | Bore(d=22, fit="H7") |
Pass group="bolts" to connect a whole pattern with connect_all.
Cut shafts, hubs and nut pockets
Shaft and hub cuts work on a body of revolution built along +Z, with the cut position measured along the axis:
from cadbuildr.stdlib.standards import (
captive_nut_pocket, circlip_groove, d_flat, hub_keyway, oring_groove, shaft_keyway,
)
d_flat(shaft, d=5, z0=10, length=15) # NEMA 17 motor-shaft flat at 4.5 mm
shaft_keyway(shaft, d=20, z0=5, length=28) # DIN 6885 key 6 x 6
hub_keyway(hub, bore=20, z0=0, length=25)
circlip_groove(shaft, d=8, z=30) # DIN 471 (kind="bore": DIN 472)
oring_groove(piston, bore=20, cs=1.78, z=10) # returns the groove and the AS568 ring
captive_nut_pocket(block.anchor("under"), "M3") # hex pocket a HexNut connects intoReady-made parts in cadbuildr.stdlib.standards.shaft_parts:
ParallelKey, ORingSeal, KeyedShaft, CaptiveNutBlock and
CaptiveNutDemo.
Reference
| Function | Standard | Example |
|---|---|---|
thread("M6"), "M10x1.25", "1/4-20" | ISO 261 / 724 / 2306 / 273, ASME B1.1 | tap drill, minor and pitch diameters, clearance |
trapezoidal("Tr8x2"), "Tr8x8(P2)" | ISO 2904 | lead-screw diameters and nut drill |
pipe_thread("G1/4"), "1/4 NPT" | ISO 228 / ISO 7, ASME B1.20.1 | major diameter, TPI, tap drill, taper |
counterbore("M5"), countersink("M4") | DIN 974-1, ISO 10642 / 7046 | diameter, depth, hole |
screw_length("M5", grip) | ISO 4762 lengths | shortest length with enough engagement |
heat_set_insert("M3"), self_tap_hole(3, "PC") | insert datasheets, thread-forming guidance | hole, depth, boss |
wood_pilot("#8", "hardwood") | woodworking pilot charts | pilot, clearance, edge distance |
keyway(20), circlip_shaft(8), circlip_bore(22) | DIN 6885-1, DIN 471 / 472 | key section, groove |
oring("AS568-010"), gland(1.78), piston_groove(20, 1.78) | AS568, ISO 3601, Parker ORD 5700 | ring, groove depth and width |
preferred(37, "R20"), sheet_gauge(16), stock_size(13) | ISO 3, IEC 60063, US gauges | 35.5, 1.519, 15 |
material("6061-T6") | handbook values | density, E, yield, cost per kg, processes |
ra_grade(1.6), general_tolerance(45, "m") | ISO 1302, ISO 2768 | N7, ±0.3 |
Unknown sizes raise StandardsError naming the table and the nearest
known keys. The values are nominal design data: check vendor datasheets for
inserts, bearings and prices.