formacad 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +200 -0
- package/README.md +87 -2
- package/build/cli/src/forma.d.ts +2 -0
- package/build/cli/src/forma.js +285 -0
- package/build/cli/src/forma.js.map +1 -0
- package/build/cli/src/preview.d.ts +3 -0
- package/build/cli/src/preview.js +268 -0
- package/build/cli/src/preview.js.map +1 -0
- package/build/core/fonts/Roboto-Bold.ttf +0 -0
- package/build/core/fonts/Roboto-Regular.ttf +0 -0
- package/build/core/src/bevel.d.ts +41 -0
- package/build/core/src/bevel.js +548 -0
- package/build/core/src/bevel.js.map +1 -0
- package/build/core/src/difflib.d.ts +3 -0
- package/build/core/src/difflib.js +94 -0
- package/build/core/src/difflib.js.map +1 -0
- package/build/core/src/errors.d.ts +9 -0
- package/build/core/src/errors.js +14 -0
- package/build/core/src/errors.js.map +1 -0
- package/build/core/src/export2d.d.ts +7 -0
- package/build/core/src/export2d.js +79 -0
- package/build/core/src/export2d.js.map +1 -0
- package/build/core/src/geometry.d.ts +92 -0
- package/build/core/src/geometry.js +946 -0
- package/build/core/src/geometry.js.map +1 -0
- package/build/core/src/host.d.ts +28 -0
- package/build/core/src/host.js +113 -0
- package/build/core/src/host.js.map +1 -0
- package/build/core/src/importers.d.ts +11 -0
- package/build/core/src/importers.js +711 -0
- package/build/core/src/importers.js.map +1 -0
- package/build/core/src/index.d.ts +81 -0
- package/build/core/src/index.js +155 -0
- package/build/core/src/index.js.map +1 -0
- package/build/core/src/inflate.d.ts +15 -0
- package/build/core/src/inflate.js +230 -0
- package/build/core/src/inflate.js.map +1 -0
- package/build/core/src/interp.d.ts +142 -0
- package/build/core/src/interp.js +2026 -0
- package/build/core/src/interp.js.map +1 -0
- package/build/core/src/lexer.d.ts +14 -0
- package/build/core/src/lexer.js +217 -0
- package/build/core/src/lexer.js.map +1 -0
- package/build/core/src/manifold.d.ts +26 -0
- package/build/core/src/manifold.js +687 -0
- package/build/core/src/manifold.js.map +1 -0
- package/build/core/src/parser.d.ts +46 -0
- package/build/core/src/parser.js +408 -0
- package/build/core/src/parser.js.map +1 -0
- package/build/core/src/std.d.ts +3 -0
- package/build/core/src/std.js +47 -0
- package/build/core/src/std.js.map +1 -0
- package/build/core/src/threemf.d.ts +4 -0
- package/build/core/src/threemf.js +127 -0
- package/build/core/src/threemf.js.map +1 -0
- package/build/core/src/ttf.d.ts +39 -0
- package/build/core/src/ttf.js +473 -0
- package/build/core/src/ttf.js.map +1 -0
- package/build/core/src/values.d.ts +116 -0
- package/build/core/src/values.js +294 -0
- package/build/core/src/values.js.map +1 -0
- package/build/core/src/xml.d.ts +13 -0
- package/build/core/src/xml.js +152 -0
- package/build/core/src/xml.js.map +1 -0
- package/build/core/std/electronics.forma +120 -0
- package/build/core/std/enclosures.forma +76 -0
- package/build/core/std/fasteners.forma +170 -0
- package/build/core/std/gridfinity.forma +182 -0
- package/build/core/std/joints.forma +120 -0
- package/build/core/std/mechanics.forma +276 -0
- package/build/core/std/patterns.forma +138 -0
- package/build/core/std/threads.forma +152 -0
- package/package.json +58 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// std/electronics.forma — Reference PCBs/batteries (.reference) and port/fan cutouts for enclosures.
|
|
2
|
+
// Usage: import "std/electronics.forma" as elec
|
|
3
|
+
|
|
4
|
+
// Standard Raspberry Pi 4/5 M2.5 mounting hole coordinates (58mm x 49mm pattern relative to board center)
|
|
5
|
+
let rpiMountPoints = [
|
|
6
|
+
[-23.5mm, -24.5mm],
|
|
7
|
+
[34.5mm, -24.5mm],
|
|
8
|
+
[-23.5mm, 24.5mm],
|
|
9
|
+
[34.5mm, 24.5mm]
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
// Standard cooling fan mounting hole spacing for common sizes (30..120mm)
|
|
13
|
+
func fanHoleSpacing(size: Length) -> Length {
|
|
14
|
+
size == 30mm ? 24mm
|
|
15
|
+
: size == 40mm ? 32mm
|
|
16
|
+
: size == 50mm ? 40mm
|
|
17
|
+
: size == 60mm ? 50mm
|
|
18
|
+
: size == 80mm ? 71.5mm
|
|
19
|
+
: size == 120mm ? 105mm
|
|
20
|
+
: size * 0.8
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Raspberry Pi 4/5 reference model (85 x 56 mm, with M2.5 mounting holes & ports; use with .layer(.reference))
|
|
24
|
+
component RaspberryPiBoard() {
|
|
25
|
+
Difference {
|
|
26
|
+
Box(width: 85mm, depth: 56mm, height: 1.6mm)
|
|
27
|
+
for p in rpiMountPoints {
|
|
28
|
+
Cylinder(d: 2.75mm, h: 3mm).at(x: p[0], y: p[1], z: -0.5mm)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// SoC + 40-pin GPIO header
|
|
32
|
+
Box(width: 15mm, depth: 15mm, height: 3mm).at(x: -10mm, y: 2mm, z: 1.6mm)
|
|
33
|
+
Box(width: 51mm, depth: 5mm, height: 8.5mm).at(x: -10mm, y: 24.5mm, z: 1.6mm)
|
|
34
|
+
// Ethernet + dual USB stacks (+X edge)
|
|
35
|
+
Box(width: 21mm, depth: 16mm, height: 13.5mm).at(x: 33.5mm, y: -17mm, z: 1.6mm)
|
|
36
|
+
Box(width: 17mm, depth: 13mm, height: 15mm).at(x: 35.5mm, y: 1mm, z: 1.6mm)
|
|
37
|
+
Box(width: 17mm, depth: 13mm, height: 15mm).at(x: 35.5mm, y: 18mm, z: 1.6mm)
|
|
38
|
+
// USB-C power + dual micro-HDMI (-Y edge)
|
|
39
|
+
Box(width: 9mm, depth: 7mm, height: 3.2mm).at(x: -31.3mm, y: -25.5mm, z: 1.6mm)
|
|
40
|
+
Box(width: 6.5mm, depth: 7mm, height: 3.0mm).at(x: -16.5mm, y: -25.5mm, z: 1.6mm)
|
|
41
|
+
Box(width: 6.5mm, depth: 7mm, height: 3.0mm).at(x: -3.0mm, y: -25.5mm, z: 1.6mm)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ESP32 DevKit reference model (51.5 x 28 mm)
|
|
45
|
+
component ESP32Board() {
|
|
46
|
+
Box(width: 51.5mm, depth: 28mm, height: 1.6mm)
|
|
47
|
+
Box(width: 18mm, depth: 16mm, height: 3.2mm).at(x: 14mm, z: 1.6mm)
|
|
48
|
+
Box(width: 7mm, depth: 9mm, height: 3.2mm).at(x: -23mm, z: 1.6mm)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// USB-C port cutout along Y through a wall, with optional outer plug overmold relief for thick walls
|
|
52
|
+
component USBC_Cutout(wall: Length = 4mm, clearance: Length = 0.4mm, plugRelief: Bool = true) {
|
|
53
|
+
assert(wall > 0mm, "USBC_Cutout wall must be positive")
|
|
54
|
+
let w = 9.0mm + 2 * clearance
|
|
55
|
+
let h = 3.2mm + 2 * clearance
|
|
56
|
+
Rect(width: w, height: h)
|
|
57
|
+
.fillet(r: h * 0.48)
|
|
58
|
+
.extrude(height: wall + 2mm, center: true)
|
|
59
|
+
.rotate(x: 90deg)
|
|
60
|
+
if plugRelief && wall > 1.8mm {
|
|
61
|
+
Rect(width: 12.6mm + 2 * clearance, height: 6.8mm + 2 * clearance)
|
|
62
|
+
.fillet(r: 2.2mm)
|
|
63
|
+
.extrude(height: wall, center: true)
|
|
64
|
+
.rotate(x: 90deg)
|
|
65
|
+
.at(y: wall / 2 + 1.2mm)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Cooling fan cutout with circular airway and 4 corner mounting holes (30, 40, 50, 60, 80, 120 mm)
|
|
70
|
+
component FanCutout(size: Length = 40mm, wall: Length = 5mm, hole: Length = 3.4mm) {
|
|
71
|
+
assert(size >= 20mm && wall > 0mm, "FanCutout size >= 20mm and wall > 0")
|
|
72
|
+
let spacing = fanHoleSpacing(size: size)
|
|
73
|
+
Cylinder(d: size - 3mm, h: wall + 2mm, center: true)
|
|
74
|
+
for ix in 0..<2 {
|
|
75
|
+
for iy in 0..<2 {
|
|
76
|
+
Cylinder(d: hole, h: wall + 2mm, center: true)
|
|
77
|
+
.at(x: (ix == 0 ? -1 : 1) * spacing / 2, y: (iy == 0 ? -1 : 1) * spacing / 2)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 0.96" I2C OLED display cutout (active window + 4 M2 mounting holes)
|
|
83
|
+
component OLED_Cutout(wall: Length = 4mm) {
|
|
84
|
+
assert(wall > 0mm, "OLED_Cutout wall must be positive")
|
|
85
|
+
Box(width: 24.5mm, depth: 13.5mm, height: wall + 2mm, center: true)
|
|
86
|
+
for ix in 0..<2 {
|
|
87
|
+
for iy in 0..<2 {
|
|
88
|
+
Cylinder(d: 2.3mm, h: wall + 2mm, center: true)
|
|
89
|
+
.at(x: (ix == 0 ? -1 : 1) * 11.5mm, y: (iy == 0 ? -1 : 1) * 11.5mm)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 18650 lithium-ion cell reference model (18.2 x 65 mm, horizontal along X)
|
|
95
|
+
component Battery18650() {
|
|
96
|
+
Cylinder(d: 18.2mm, h: 65mm, center: true).rotate(y: 90deg)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Printable 18650 snap-in cradle with flex-relief side slots, end contact slots, and bottom push-out opening
|
|
100
|
+
component BatteryHolder18650(wall: Length = 2.2mm) {
|
|
101
|
+
assert(wall >= 1.5mm, "BatteryHolder18650 wall should be at least 1.5mm")
|
|
102
|
+
let len = 65.6mm
|
|
103
|
+
let d = 18.6mm
|
|
104
|
+
Difference {
|
|
105
|
+
Box(width: len + 2 * wall, depth: d + 2 * wall, height: d * 0.65)
|
|
106
|
+
.fillet(r: 2mm, edges: .vertical)
|
|
107
|
+
.chamfer(0.4mm, edges: .horizontal)
|
|
108
|
+
// Cylindrical cell cradle + top snap opening
|
|
109
|
+
Cylinder(d: d, h: len, center: true).rotate(y: 90deg).at(z: d / 2 + 1.5mm)
|
|
110
|
+
Box(width: len, depth: d * 0.88, height: d).at(z: d * 0.55)
|
|
111
|
+
// Longitudinal flex-relief slots so PLA walls flex smoothly without cracking
|
|
112
|
+
for sy in [-1, 1] {
|
|
113
|
+
Box(width: len - 14mm, depth: 2.2mm, height: 3.5mm).at(y: sy * (d / 2 + wall * 0.4), z: -0.5mm)
|
|
114
|
+
}
|
|
115
|
+
// End contact strip / leaf-spring slots at both ends
|
|
116
|
+
Box(width: len + 2 * wall + 2mm, depth: 8mm, height: 8mm).at(z: d * 0.28)
|
|
117
|
+
// Bottom finger push-out window for easy cell removal
|
|
118
|
+
Rect(width: 26mm, height: 10mm).fillet(r: 4.5mm).extrude(height: 6mm).at(z: -1mm)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// std/enclosures.forma — Building blocks for 3D-printable enclosures: standoffs, vents, lips, ears, and corner posts.
|
|
2
|
+
// Usage: import "std/enclosures.forma" as enclosures
|
|
3
|
+
|
|
4
|
+
// PCB mounting standoff with 45-degree overhang-free reinforcing gussets and screw pilot hole
|
|
5
|
+
component Standoff(h: Length = 6mm, od: Length = 6.5mm, hole: Length = 2.6mm, gussets: Number = 4) {
|
|
6
|
+
assert(h > 0mm && od > hole, "Standoff od must exceed hole diameter")
|
|
7
|
+
let ribH = h * 0.6
|
|
8
|
+
let ribReach = min(od * 0.65, ribH)
|
|
9
|
+
Difference {
|
|
10
|
+
Union {
|
|
11
|
+
Cylinder(d: od, h: h)
|
|
12
|
+
if gussets > 0 {
|
|
13
|
+
for i in 0..<gussets {
|
|
14
|
+
let a = i * (360deg / gussets)
|
|
15
|
+
Polygon(points: [
|
|
16
|
+
[0mm, 0mm],
|
|
17
|
+
[od / 2 + ribReach, 0mm],
|
|
18
|
+
[od / 2 - 0.3mm, ribH],
|
|
19
|
+
[0mm, ribH]
|
|
20
|
+
]).extrude(height: 1.2mm, center: true)
|
|
21
|
+
.rotate(x: 90deg)
|
|
22
|
+
.rotate(z: a)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
Cylinder(d: hole, h: h + 2mm).at(z: -0.5mm)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Parametric ventilation slot array cutter (use inside Difference)
|
|
31
|
+
component VentSlots(count: Number = 6, slotW: Length = 2.8mm, slotL: Length = 20mm, pitch: Length = 5.5mm, depth: Length = 6mm) {
|
|
32
|
+
assert(count >= 1 && slotW > 0mm && slotL > slotW, "VentSlots requires count >= 1 and slotL > slotW")
|
|
33
|
+
let total = (count - 1) * pitch
|
|
34
|
+
for i in 0..<count {
|
|
35
|
+
Rect(width: slotW, height: slotL)
|
|
36
|
+
.fillet(r: slotW * 0.45)
|
|
37
|
+
.extrude(height: depth)
|
|
38
|
+
.at(x: -total / 2 + i * pitch)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Centering lip for an enclosure lid with top lead-in chamfer (fits inside an inner cavity of width x depth)
|
|
43
|
+
component LidLip(width: Length = 60mm, depth: Length = 40mm, height: Length = 2.5mm, wall: Length = 1.6mm, r: Length = 2.5mm, clearance: Length = 0.25mm) {
|
|
44
|
+
assert(width > 2 * wall && depth > 2 * wall && height > 0.6mm, "LidLip dimensions too small")
|
|
45
|
+
let w = width - 2 * clearance
|
|
46
|
+
let d = depth - 2 * clearance
|
|
47
|
+
Difference {
|
|
48
|
+
Box(width: w, depth: d, height: height)
|
|
49
|
+
.fillet(r: r, edges: .vertical)
|
|
50
|
+
.chamfer(min(0.5mm, wall * 0.35), edges: .top)
|
|
51
|
+
Box(width: w - 2 * wall, depth: d - 2 * wall, height: height + 2mm)
|
|
52
|
+
.fillet(r: max(0.5mm, r - wall), edges: .vertical)
|
|
53
|
+
.at(z: -1mm)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// External mounting ear / flange with screw hole
|
|
58
|
+
component MountingEar(width: Length = 14mm, length: Length = 14mm, thick: Length = 3.5mm, hole: Length = 4.4mm) {
|
|
59
|
+
assert(width > hole && length >= width / 2, "MountingEar width must exceed hole")
|
|
60
|
+
Difference {
|
|
61
|
+
Hull {
|
|
62
|
+
Box(width: width, depth: 2mm, height: thick).at(y: 1mm)
|
|
63
|
+
Cylinder(d: width, h: thick).at(y: length - width / 2)
|
|
64
|
+
}
|
|
65
|
+
Cylinder(d: hole, h: thick + 2mm).at(y: length - width / 2, z: -1mm)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Corner screw boss inside an enclosure (blind by default, or through-hole with through: true)
|
|
70
|
+
component CornerPost(h: Length = 15mm, od: Length = 7mm, hole: Length = 2.8mm, through: Bool = false) {
|
|
71
|
+
assert(h > 2mm && od > hole, "CornerPost od must exceed hole")
|
|
72
|
+
Difference {
|
|
73
|
+
Cylinder(d: od, h: h)
|
|
74
|
+
Cylinder(d: hole, h: h + 2mm).at(z: through ? -1mm : 1.5mm)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// std/fasteners.forma — Metric fasteners, heat-set inserts, nut traps, and magnet pockets for 3D printing.
|
|
2
|
+
// Usage: import "std/fasteners.forma" as fasteners
|
|
3
|
+
|
|
4
|
+
let defaultClearance = 0.2mm
|
|
5
|
+
|
|
6
|
+
// Recommended FDM wall thickness for an exact integer number of perimeters (avoids weak gap-fill)
|
|
7
|
+
func perimeters(count: Number = 4, nozzle: Length = 0.4mm) -> Length {
|
|
8
|
+
assert(count >= 1 && nozzle > 0mm, "perimeters requires count >= 1 and nozzle > 0")
|
|
9
|
+
return count * nozzle * 1.05
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Clearance hole diameter for metric screws (M2..M8)
|
|
13
|
+
func holeDiameter(size: Number, clearance: Length = 0.2mm) -> Length {
|
|
14
|
+
assert(size >= 1.6, "screw size must be at least M1.6")
|
|
15
|
+
return size * 1mm + 2 * clearance
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ISO hex nut width across flats
|
|
19
|
+
func nutWidth(size: Number) -> Length {
|
|
20
|
+
size == 2 ? 4.0mm
|
|
21
|
+
: size == 2.5 ? 5.0mm
|
|
22
|
+
: size == 3 ? 5.5mm
|
|
23
|
+
: size == 4 ? 7.0mm
|
|
24
|
+
: size == 5 ? 8.0mm
|
|
25
|
+
: size == 6 ? 10.0mm
|
|
26
|
+
: size == 8 ? 13.0mm
|
|
27
|
+
: size * 1.65mm
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ISO 4762 socket-head cap diameter
|
|
31
|
+
func headDiameter(size: Number) -> Length {
|
|
32
|
+
size == 2 ? 3.8mm
|
|
33
|
+
: size == 2.5 ? 4.5mm
|
|
34
|
+
: size == 3 ? 5.5mm
|
|
35
|
+
: size == 4 ? 7.0mm
|
|
36
|
+
: size == 5 ? 8.5mm
|
|
37
|
+
: size == 6 ? 10.0mm
|
|
38
|
+
: size == 8 ? 13.0mm
|
|
39
|
+
: size * 1.8mm
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ISO 10642 90-degree countersunk flat-head diameter
|
|
43
|
+
func countersunkDiameter(size: Number) -> Length {
|
|
44
|
+
size == 2 ? 4.0mm
|
|
45
|
+
: size == 2.5 ? 5.0mm
|
|
46
|
+
: size == 3 ? 6.0mm
|
|
47
|
+
: size == 4 ? 8.0mm
|
|
48
|
+
: size == 5 ? 10.0mm
|
|
49
|
+
: size == 6 ? 12.0mm
|
|
50
|
+
: size == 8 ? 16.0mm
|
|
51
|
+
: size * 2.0mm
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Through-hole with optional .socket counterbore, .countersunk 90-deg bevel, .hex recess, or .none.
|
|
55
|
+
// Set sacrificialLayer: true for upside-down FDM counterbores (adds a 0.2mm bridge layer).
|
|
56
|
+
component ScrewHole(
|
|
57
|
+
size: Number = 3,
|
|
58
|
+
depth: Length = 10mm,
|
|
59
|
+
head: Enum = .socket,
|
|
60
|
+
clearance: Length = 0.2mm,
|
|
61
|
+
sacrificialLayer: Bool = false
|
|
62
|
+
) {
|
|
63
|
+
assert(depth > 0mm, "ScrewHole depth must be positive")
|
|
64
|
+
let d = holeDiameter(size: size, clearance: clearance)
|
|
65
|
+
let hd = headDiameter(size: size) + 2 * clearance
|
|
66
|
+
let hh = size * 1mm + 0.4mm
|
|
67
|
+
if sacrificialLayer && (head == .socket || head == .hex) {
|
|
68
|
+
Cylinder(d: d, h: max(0.5mm, depth - hh - 0.2mm) + 1mm).at(z: -1mm)
|
|
69
|
+
} else {
|
|
70
|
+
Cylinder(d: d, h: depth + 2mm).at(z: -1mm)
|
|
71
|
+
}
|
|
72
|
+
if head == .socket {
|
|
73
|
+
Cylinder(d: hd, h: hh + 1mm).at(z: depth - hh)
|
|
74
|
+
} else if head == .hex {
|
|
75
|
+
let hw = nutWidth(size: size) + 2 * clearance
|
|
76
|
+
Polygon(sides: 6, d: hw / cos(30deg)).extrude(height: hh + 1mm).at(z: depth - hh)
|
|
77
|
+
} else if head == .countersunk {
|
|
78
|
+
let csd = countersunkDiameter(size: size) + 2 * clearance
|
|
79
|
+
let ch = (csd - d) / 2
|
|
80
|
+
Cone(d1: d, d2: csd + 0.4mm, h: ch + 0.2mm).at(z: depth - ch)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Heat-set threaded brass insert pocket (Ruthex / CNC Kitchen style) with lead-in chamfer and melt-zone relief
|
|
85
|
+
component HeatInsert(size: Number = 3, depth: Length = 6mm, meltZone: Length = 1.5mm) {
|
|
86
|
+
assert(depth > 1mm, "HeatInsert depth must exceed 1mm")
|
|
87
|
+
let od = size == 2 ? 3.2mm
|
|
88
|
+
: size == 2.5 ? 4.0mm
|
|
89
|
+
: size == 3 ? 4.6mm
|
|
90
|
+
: size == 4 ? 5.6mm
|
|
91
|
+
: size == 5 ? 6.4mm
|
|
92
|
+
: size == 6 ? 8.0mm
|
|
93
|
+
: size == 8 ? 9.6mm
|
|
94
|
+
: size * 1.45mm
|
|
95
|
+
Cylinder(d: od, h: depth + 0.5mm).at(z: -0.5mm)
|
|
96
|
+
if meltZone > 0mm {
|
|
97
|
+
Cylinder(d: size * 1mm + 0.4mm, h: meltZone + 0.5mm).at(z: -meltZone)
|
|
98
|
+
}
|
|
99
|
+
Cone(d1: od, d2: od + 0.8mm, h: 0.8mm).at(z: depth - 0.8mm)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Hexagonal nut trap pocket with optional side insertion slot along +X and sequential-bridge step on top
|
|
103
|
+
component NutTrap(size: Number = 3, depth: Length = 3.2mm, clearance: Length = 0.2mm, slot: Length = 0mm, bridgeStep: Bool = false) {
|
|
104
|
+
assert(depth > 0mm, "NutTrap depth must be positive")
|
|
105
|
+
let w = nutWidth(size: size) + 2 * clearance
|
|
106
|
+
let dHole = holeDiameter(size: size, clearance: clearance)
|
|
107
|
+
Polygon(sides: 6, d: w / cos(30deg)).extrude(height: depth)
|
|
108
|
+
if slot > 0mm {
|
|
109
|
+
Box(width: slot, depth: w, height: depth).at(x: slot / 2)
|
|
110
|
+
}
|
|
111
|
+
if bridgeStep {
|
|
112
|
+
// 1-layer rectangular bridge step so a circular screw hole above the hex pocket prints cleanly
|
|
113
|
+
Box(width: dHole, depth: w, height: 0.25mm).at(z: depth)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Horizontal-axis teardrop hole cutter (axis along Y, 45-degree peaked roof prevents FDM crown sagging)
|
|
118
|
+
component TeardropHole(d: Length = 4mm, depth: Length = 10mm, clearance: Length = 0.2mm) {
|
|
119
|
+
assert(d > 0mm && depth > 0mm, "TeardropHole d and depth must be positive")
|
|
120
|
+
let r = d / 2 + clearance
|
|
121
|
+
Hull {
|
|
122
|
+
Circle(r: r)
|
|
123
|
+
Polygon(points: [[-r * 0.707, r * 0.707], [r * 0.707, r * 0.707], [0mm, r * 1.414]])
|
|
124
|
+
}.extrude(height: depth + 2mm, center: true).rotate(x: 90deg)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Neodymium magnet pocket with press-fit clearance and optional 2mm air-escape / punch-out pinhole
|
|
128
|
+
component MagnetPocket(d: Length = 6mm, h: Length = 2mm, clearance: Length = 0.15mm, knockout: Bool = false) {
|
|
129
|
+
assert(d > 0mm && h > 0mm, "MagnetPocket d and h must be positive")
|
|
130
|
+
Cylinder(d: d + 2 * clearance, h: h + 0.3mm).at(z: -0.1mm)
|
|
131
|
+
if knockout {
|
|
132
|
+
Cylinder(d: 2mm, h: h + 6mm).at(z: -5.5mm)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Quick 3D-printer FDM clearance calibration gauge (pegs with 0.15, 0.20, 0.25, 0.30, 0.40 mm radial gaps)
|
|
137
|
+
component ToleranceTest(thick: Length = 6mm) {
|
|
138
|
+
let gaps = [0.15mm, 0.20mm, 0.25mm, 0.30mm, 0.40mm]
|
|
139
|
+
let pitch = 14mm
|
|
140
|
+
let totalW = gaps.count * pitch + 6mm
|
|
141
|
+
let pegD = 6mm
|
|
142
|
+
Union {
|
|
143
|
+
Difference {
|
|
144
|
+
Box(width: totalW, depth: 18mm, height: thick)
|
|
145
|
+
.fillet(r: 3mm, edges: .vertical)
|
|
146
|
+
.chamfer(0.4mm, edges: .horizontal)
|
|
147
|
+
for i in 0..<gaps.count {
|
|
148
|
+
let cx = -((gaps.count - 1) * pitch) / 2 + i * pitch
|
|
149
|
+
Cylinder(d: pegD + 2 * gaps[i], h: thick + 2mm).at(x: cx, z: -1mm)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Captive test pins inside each hole (print-in-place: test which pins break free cleanly)
|
|
153
|
+
for i in 0..<gaps.count {
|
|
154
|
+
let cx = -((gaps.count - 1) * pitch) / 2 + i * pitch
|
|
155
|
+
Cylinder(d: pegD, h: thick + 2mm).chamfer(0.4mm, edges: .horizontal).at(x: cx)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Visual reference socket-head bolt (use with .layer(.reference) for fit checks)
|
|
161
|
+
component Bolt(size: Number = 3, length: Length = 12mm) {
|
|
162
|
+
assert(length > 0mm, "Bolt length must be positive")
|
|
163
|
+
let hd = headDiameter(size: size)
|
|
164
|
+
let hh = size * 1mm
|
|
165
|
+
Cylinder(d: size * 1mm, h: length).at(z: -length)
|
|
166
|
+
Difference {
|
|
167
|
+
Cylinder(d: hd, h: hh).chamfer(0.3mm, edges: .top)
|
|
168
|
+
Polygon(sides: 6, d: hd * 0.55).extrude(height: hh * 0.65).at(z: hh * 0.4)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// std/gridfinity.forma — Modular storage systems: Gridfinity bins & stepped baseplates, IKEA Skadis hooks, DIN rail clips.
|
|
2
|
+
// Usage: import "std/gridfinity.forma" as gf
|
|
3
|
+
|
|
4
|
+
let pitch = 42mm
|
|
5
|
+
let unitHeight = 7mm
|
|
6
|
+
|
|
7
|
+
// Single 42x42mm Gridfinity stepped base foot with optional 6x2mm corner magnet pockets.
|
|
8
|
+
// Matches Baseplate() stepped 45-degree cavity with 0.2mm radial clearance.
|
|
9
|
+
component BaseFoot(magnets: Bool = true) {
|
|
10
|
+
Difference {
|
|
11
|
+
Union {
|
|
12
|
+
Box(width: 36.6mm, depth: 36.6mm, height: 2.6mm)
|
|
13
|
+
.fillet(r: 1.6mm, edges: .vertical)
|
|
14
|
+
.chamfer(0.8mm, edges: .bottom)
|
|
15
|
+
Hull {
|
|
16
|
+
Box(width: 36.6mm, depth: 36.6mm, height: 0.2mm)
|
|
17
|
+
.fillet(r: 1.6mm, edges: .vertical)
|
|
18
|
+
.at(z: 2.5mm)
|
|
19
|
+
Box(width: 40.9mm, depth: 40.9mm, height: 0.2mm)
|
|
20
|
+
.fillet(r: 3.75mm, edges: .vertical)
|
|
21
|
+
.at(z: 4.55mm)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if magnets {
|
|
25
|
+
for ix in 0..<2 {
|
|
26
|
+
for iy in 0..<2 {
|
|
27
|
+
Cylinder(d: 6.2mm, h: 2.2mm)
|
|
28
|
+
.at(x: (ix == 0 ? -1 : 1) * 13mm, y: (iy == 0 ? -1 : 1) * 13mm, z: -0.1mm)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Gridfinity stepped 45-degree baseplate (x by y units)
|
|
36
|
+
component Baseplate(x: Number = 2, y: Number = 2) {
|
|
37
|
+
assert(x >= 1 && y >= 1, "Baseplate x and y must be at least 1")
|
|
38
|
+
let w = x * pitch
|
|
39
|
+
let d = y * pitch
|
|
40
|
+
let h = 4.65mm
|
|
41
|
+
Difference {
|
|
42
|
+
Box(width: w, depth: d, height: h).fillet(r: 4mm, edges: .vertical)
|
|
43
|
+
for ix in 0..<x {
|
|
44
|
+
for iy in 0..<y {
|
|
45
|
+
let cx = (ix - (x - 1) / 2) * pitch
|
|
46
|
+
let cy = (iy - (y - 1) / 2) * pitch
|
|
47
|
+
Union {
|
|
48
|
+
Hull {
|
|
49
|
+
Box(width: 35.6mm, depth: 35.6mm, height: 0.2mm)
|
|
50
|
+
.fillet(r: 1.2mm, edges: .vertical)
|
|
51
|
+
.at(z: -0.2mm)
|
|
52
|
+
Box(width: 37.0mm, depth: 37.0mm, height: 1.9mm)
|
|
53
|
+
.fillet(r: 1.8mm, edges: .vertical)
|
|
54
|
+
.at(z: 0.7mm)
|
|
55
|
+
}
|
|
56
|
+
Hull {
|
|
57
|
+
Box(width: 37.0mm, depth: 37.0mm, height: 0.2mm)
|
|
58
|
+
.fillet(r: 1.8mm, edges: .vertical)
|
|
59
|
+
.at(z: 2.4mm)
|
|
60
|
+
Box(width: 41.5mm, depth: 41.5mm, height: 0.2mm)
|
|
61
|
+
.fillet(r: 3.9mm, edges: .vertical)
|
|
62
|
+
.at(z: h)
|
|
63
|
+
}
|
|
64
|
+
}.at(x: cx, y: cy)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Parametric Gridfinity storage bin with optional stacking lip, dividers, label shelf, and magnet pockets
|
|
71
|
+
component Bin(
|
|
72
|
+
x: Number = 1,
|
|
73
|
+
y: Number = 1,
|
|
74
|
+
z: Number = 3,
|
|
75
|
+
wall: Length = 1.6mm,
|
|
76
|
+
magnets: Bool = true,
|
|
77
|
+
dividersX: Number = 0,
|
|
78
|
+
dividersY: Number = 0,
|
|
79
|
+
stackingLip: Bool = true,
|
|
80
|
+
label: Bool = false
|
|
81
|
+
) {
|
|
82
|
+
assert(x >= 1 && y >= 1 && z >= 2, "Bin requires x >= 1, y >= 1, z >= 2")
|
|
83
|
+
assert(wall >= 1mm, "Bin wall should be at least 1mm")
|
|
84
|
+
let outerW = x * pitch - 0.5mm
|
|
85
|
+
let outerD = y * pitch - 0.5mm
|
|
86
|
+
let footH = 4.75mm
|
|
87
|
+
let bodyH = z * unitHeight - footH
|
|
88
|
+
let innerW = outerW - 2 * wall
|
|
89
|
+
let innerD = outerD - 2 * wall
|
|
90
|
+
let floorZ = footH + 1.8mm
|
|
91
|
+
let lipH = stackingLip ? 3.2mm : 0mm
|
|
92
|
+
|
|
93
|
+
Union {
|
|
94
|
+
for ix in 0..<x {
|
|
95
|
+
for iy in 0..<y {
|
|
96
|
+
BaseFoot(magnets: magnets).at(
|
|
97
|
+
x: (ix - (x - 1) / 2) * pitch,
|
|
98
|
+
y: (iy - (y - 1) / 2) * pitch
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
Difference {
|
|
103
|
+
Box(width: outerW, depth: outerD, height: bodyH + lipH)
|
|
104
|
+
.fillet(r: 3.75mm, edges: .vertical)
|
|
105
|
+
.chamfer(0.5mm, edges: .top)
|
|
106
|
+
.at(z: footH)
|
|
107
|
+
// Main inner cavity
|
|
108
|
+
Box(width: innerW, depth: innerD, height: bodyH + lipH)
|
|
109
|
+
.fillet(r: 2.2mm, edges: .vertical)
|
|
110
|
+
.at(z: floorZ)
|
|
111
|
+
// Stepped stacking lip recess at top
|
|
112
|
+
if stackingLip {
|
|
113
|
+
Hull {
|
|
114
|
+
Box(width: innerW, depth: innerD, height: 0.2mm)
|
|
115
|
+
.fillet(r: 2.2mm, edges: .vertical)
|
|
116
|
+
.at(z: footH + bodyH - 0.2mm)
|
|
117
|
+
Box(width: outerW - 1.6mm, depth: outerD - 1.6mm, height: 0.2mm)
|
|
118
|
+
.fillet(r: 3.0mm, edges: .vertical)
|
|
119
|
+
.at(z: footH + bodyH + lipH)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Optional internal dividers
|
|
124
|
+
let divH = bodyH - 2.4mm
|
|
125
|
+
if dividersX > 0 {
|
|
126
|
+
for i in 1...dividersX {
|
|
127
|
+
let dx = -innerW / 2 + i * (innerW / (dividersX + 1))
|
|
128
|
+
Box(width: 1.2mm, depth: innerD + 0.4mm, height: divH).at(x: dx, z: floorZ)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if dividersY > 0 {
|
|
132
|
+
for i in 1...dividersY {
|
|
133
|
+
let dy = -innerD / 2 + i * (innerD / (dividersY + 1))
|
|
134
|
+
Box(width: innerW + 0.4mm, depth: 1.2mm, height: divH).at(y: dy, z: floorZ)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Optional 45-degree overhang-free label shelf on the +Y inner wall
|
|
138
|
+
if label {
|
|
139
|
+
let shelfD = 10mm
|
|
140
|
+
let shelfZ = footH + bodyH - 1.5mm
|
|
141
|
+
Hull {
|
|
142
|
+
Box(width: innerW, depth: shelfD, height: 1.4mm).at(y: innerD / 2 - shelfD / 2, z: shelfZ)
|
|
143
|
+
Box(width: innerW, depth: 1mm, height: 1mm).at(y: innerD / 2 - 0.5mm, z: shelfZ - shelfD)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// IKEA Skadis pegboard hook printed flat on its side in XY for maximum layer-line strength and zero supports
|
|
150
|
+
component SkadisHook(reach: Length = 22mm, thick: Length = 4.6mm) {
|
|
151
|
+
assert(reach >= 8mm && thick >= 3mm, "SkadisHook reach >= 8mm and thick >= 3mm")
|
|
152
|
+
// Continuous 2D profile in XY (back peg enters -X, drops -Y; front hook extends +X and curves +Y)
|
|
153
|
+
Polygon(points: [
|
|
154
|
+
[-8.5mm, 4mm],
|
|
155
|
+
[-5.3mm, 4mm],
|
|
156
|
+
[-5.3mm, 9.5mm],
|
|
157
|
+
[0mm, 9.5mm],
|
|
158
|
+
[0mm, 0mm],
|
|
159
|
+
[reach + 4mm, 0mm],
|
|
160
|
+
[reach + 4mm, 9mm],
|
|
161
|
+
[reach, 9mm],
|
|
162
|
+
[reach, 4.5mm],
|
|
163
|
+
[3.2mm, 4.5mm],
|
|
164
|
+
[3.2mm, 18mm],
|
|
165
|
+
[0mm, 18mm],
|
|
166
|
+
[0mm, 14mm],
|
|
167
|
+
[-8.5mm, 14mm]
|
|
168
|
+
]).extrude(height: thick).chamfer(0.4mm, edges: .horizontal)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Flexure snap-clip for standard 35mm top-hat DIN rail (EN 60715) with spring arm & release tab
|
|
172
|
+
component DinRailClip(width: Length = 15mm, thick: Length = 3mm) {
|
|
173
|
+
assert(width > 0mm && thick >= 2mm, "DinRailClip width > 0 and thick >= 2mm")
|
|
174
|
+
// Fixed hook on -X, flexible cantilevered latch + release tab on +X
|
|
175
|
+
Polygon(points: [
|
|
176
|
+
[-21mm, 0mm], [25mm, 0mm], [25mm, 2.2mm], [21.5mm, 2.2mm],
|
|
177
|
+
[21.5mm, 9.5mm], [16.5mm, 9.5mm], [16.5mm, 7.0mm], [18.5mm, 6.2mm],
|
|
178
|
+
[18.5mm, thick], [14mm, thick], [14mm, 1.5mm], [19.2mm, 1.5mm],
|
|
179
|
+
[19.2mm, thick + 0.4mm], [-18mm, thick + 0.4mm], [-18mm, 6.5mm],
|
|
180
|
+
[-16.5mm, 6.5mm], [-16.5mm, 9mm], [-21mm, 9mm]
|
|
181
|
+
]).extrude(height: width)
|
|
182
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// std/joints.forma — Screwless 3D-printable joints: tapered snap-fits, dovetails, print-in-place hinges, and alignment pins.
|
|
2
|
+
// Usage: import "std/joints.forma" as joints
|
|
3
|
+
|
|
4
|
+
// Tapered cantilever snap-fit clip with root reinforcement.
|
|
5
|
+
// Set flat: true to print lying in XY so continuous perimeter loops run along the beam (5x stronger in FDM).
|
|
6
|
+
component SnapFit(width: Length = 6mm, length: Length = 14mm, thick: Length = 2.0mm, hook: Length = 1.2mm, flat: Bool = false) {
|
|
7
|
+
assert(length > hook * 3 && thick >= 1mm, "SnapFit length must exceed 3 * hook")
|
|
8
|
+
let tipThick = thick * 0.55
|
|
9
|
+
let rootPad = thick * 0.45
|
|
10
|
+
let profile = Polygon(points: [
|
|
11
|
+
[-thick - rootPad, 0mm],
|
|
12
|
+
[rootPad, 0mm],
|
|
13
|
+
[0mm, rootPad * 1.4],
|
|
14
|
+
[0mm, length - hook * 2.2],
|
|
15
|
+
[hook, length - hook * 1.6],
|
|
16
|
+
[0mm, length],
|
|
17
|
+
[-tipThick, length],
|
|
18
|
+
[-thick, rootPad * 1.4]
|
|
19
|
+
])
|
|
20
|
+
if flat {
|
|
21
|
+
profile.extrude(height: width)
|
|
22
|
+
} else {
|
|
23
|
+
profile.extrude(height: width, center: true)
|
|
24
|
+
.rotate(y: -90deg)
|
|
25
|
+
.rotate(z: 90deg)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Matching receiver slot cutter for SnapFit() (use inside Difference)
|
|
30
|
+
component SnapSlot(width: Length = 6mm, catchH: Length = 3.2mm, depth: Length = 4mm, clearance: Length = 0.25mm) {
|
|
31
|
+
Box(width: width + 2 * clearance, depth: depth + 1mm, height: catchH + 2 * clearance)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Dovetail male pin (centered in X, protruding along +Y from y = 0..depth)
|
|
35
|
+
component DovetailPin(width: Length = 12mm, depth: Length = 6mm, height: Length = 10mm, angle: Angle = 60deg, clearance: Length = 0.2mm) {
|
|
36
|
+
assert(angle > 30deg && angle < 85deg, "DovetailPin angle must be between 30deg and 85deg")
|
|
37
|
+
let flare = depth / tan(angle)
|
|
38
|
+
let w0 = width - 2 * clearance
|
|
39
|
+
let w1 = width + 2 * flare - 2 * clearance
|
|
40
|
+
Polygon(points: [
|
|
41
|
+
[-w0 / 2, 0mm],
|
|
42
|
+
[w0 / 2, 0mm],
|
|
43
|
+
[w1 / 2, depth - clearance],
|
|
44
|
+
[-w1 / 2, depth - clearance]
|
|
45
|
+
]).extrude(height: height).chamfer(0.35mm, edges: .horizontal)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Dovetail female slot cutter matching DovetailPin() (use inside Difference)
|
|
49
|
+
component DovetailSlot(width: Length = 12mm, depth: Length = 6mm, height: Length = 10mm, angle: Angle = 60deg, clearance: Length = 0.2mm) {
|
|
50
|
+
assert(angle > 30deg && angle < 85deg, "DovetailSlot angle must be between 30deg and 85deg")
|
|
51
|
+
let flare = depth / tan(angle)
|
|
52
|
+
let w0 = width + 2 * clearance
|
|
53
|
+
let w1 = width + 2 * flare + 2 * clearance
|
|
54
|
+
Polygon(points: [
|
|
55
|
+
[-w0 / 2, -0.5mm],
|
|
56
|
+
[w0 / 2, -0.5mm],
|
|
57
|
+
[w1 / 2, depth + clearance],
|
|
58
|
+
[-w1 / 2, depth + clearance]
|
|
59
|
+
]).extrude(height: height + 1mm).at(z: -0.5mm)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Print-in-place self-centering 45-degree double-cone knuckle hinge along the X axis.
|
|
63
|
+
// Flattened bottom gives solid build-plate adhesion; conical pins eliminate horizontal bridging.
|
|
64
|
+
component Hinge(length: Length = 36mm, d: Length = 8mm, leaf: Length = 12mm, thick: Length = 3mm, knuckles: Number = 3, clearance: Length = 0.35mm) {
|
|
65
|
+
assert(knuckles >= 3, "Hinge requires at least 3 knuckles")
|
|
66
|
+
assert(d >= 5mm && clearance >= 0.2mm, "Hinge d >= 5mm and clearance >= 0.2mm")
|
|
67
|
+
let segW = length / knuckles
|
|
68
|
+
let coneR = d * 0.32
|
|
69
|
+
let coneH = min(coneR, segW * 0.42)
|
|
70
|
+
let flatDrop = 0.4mm
|
|
71
|
+
let axisZ = d / 2 - flatDrop
|
|
72
|
+
|
|
73
|
+
Intersection {
|
|
74
|
+
Union {
|
|
75
|
+
for i in 0..<knuckles {
|
|
76
|
+
let x0 = -length / 2 + i * segW + clearance / 2
|
|
77
|
+
let w = segW - clearance
|
|
78
|
+
let side = (i % 2 == 0) ? 1 : -1
|
|
79
|
+
let isPinKnuckle = (i % 2 == 0)
|
|
80
|
+
|
|
81
|
+
if isPinKnuckle {
|
|
82
|
+
Union {
|
|
83
|
+
Cylinder(d: d, h: w).rotate(y: 90deg).at(x: x0, z: axisZ)
|
|
84
|
+
Box(width: w, depth: leaf, height: thick).at(x: x0 + w / 2, y: side * (leaf / 2 + d * 0.25))
|
|
85
|
+
if i > 0 {
|
|
86
|
+
Cone(r1: coneR, r2: 0.4mm, h: coneH).rotate(y: -90deg).at(x: x0 + 0.1mm, z: axisZ)
|
|
87
|
+
}
|
|
88
|
+
if i < knuckles - 1 {
|
|
89
|
+
Cone(r1: coneR, r2: 0.4mm, h: coneH).rotate(y: 90deg).at(x: x0 + w - 0.1mm, z: axisZ)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
Difference {
|
|
94
|
+
Union {
|
|
95
|
+
Cylinder(d: d, h: w).rotate(y: 90deg).at(x: x0, z: axisZ)
|
|
96
|
+
Box(width: w, depth: leaf, height: thick).at(x: x0 + w / 2, y: side * (leaf / 2 + d * 0.25))
|
|
97
|
+
}
|
|
98
|
+
Cone(r1: coneR + clearance, r2: 0.4mm, h: coneH + clearance).rotate(y: 90deg).at(x: x0 - 0.1mm, z: axisZ)
|
|
99
|
+
Cone(r1: coneR + clearance, r2: 0.4mm, h: coneH + clearance).rotate(y: -90deg).at(x: x0 + w + 0.1mm, z: axisZ)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Clip cleanly at z = 0 to create a flat bed-adhesion surface on every knuckle
|
|
105
|
+
Box(width: length + 4mm, depth: 2 * leaf + 2 * d + 4mm, height: d + 4mm)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Alignment pin with tapered lead-in chamfer
|
|
110
|
+
component AlignmentPin(d: Length = 4mm, h: Length = 6mm) {
|
|
111
|
+
assert(d >= 1.5mm && h > 0mm, "AlignmentPin d >= 1.5mm and h > 0")
|
|
112
|
+
Cylinder(d: d, h: h).chamfer(min(0.6mm, d * 0.2), edges: .top)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Matching alignment hole cutter with lead-in chamfer (use inside Difference)
|
|
116
|
+
component AlignmentHole(d: Length = 4mm, h: Length = 6mm, clearance: Length = 0.2mm) {
|
|
117
|
+
let effD = d + 2 * clearance
|
|
118
|
+
Cylinder(d: effD, h: h + 0.6mm).at(z: -0.1mm)
|
|
119
|
+
Cone(d1: effD, d2: effD + 0.8mm, h: 0.4mm).at(z: h - 0.3mm)
|
|
120
|
+
}
|