forgecad 0.6.3 → 0.8.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.
Files changed (234) hide show
  1. package/README.md +3 -12
  2. package/dist/assets/{AdminPage-CeqCUUgu.js → AdminPage-D4bocK4E.js} +250 -151
  3. package/dist/assets/{BlogPage-P_AJP0v9.js → BlogPage-CJEXL_zJ.js} +94 -70
  4. package/dist/assets/{DocsPage-CKRV2iq2.js → DocsPage-D3A_g8V3.js} +329 -163
  5. package/dist/assets/{EditorApp-CnC2k4cW.css → EditorApp-BWYUSpUN.css} +590 -136
  6. package/dist/assets/EditorApp-Cihhqcsq.js +11692 -0
  7. package/dist/assets/{EmbedViewer-DBlzmQ5i.js → EmbedViewer-kWjKaC_t.js} +2 -4
  8. package/dist/assets/LandingPageProofDriven-Bg2IUc3l.css +856 -0
  9. package/dist/assets/LandingPageProofDriven-DXkKlyhI.js +601 -0
  10. package/dist/assets/PricingPage-BsU5vzEx.js +232 -0
  11. package/dist/assets/{SettingsPage-BqCh9JcC.js → SettingsPage-PqvpAKIs.js} +129 -5
  12. package/dist/assets/{evalWorker-Ql-aKwLA.js → evalWorker-C-hzNUMy.js} +8949 -3161
  13. package/dist/assets/{Viewport-CoB46f5R.js → index-Pz321YAt.js} +38382 -7501
  14. package/dist/assets/{index-2hfs_ub0.css → index-ay13WNfa.css} +726 -53
  15. package/dist/assets/{javascript-DCxGoE5Y.js → javascript-DAl8Gmyo.js} +1 -1
  16. package/dist/assets/{manifold-CqNMHHKO.js → manifold-BcbjWLIo.js} +4 -3
  17. package/dist/assets/{manifold-Cce9wRFz.js → manifold-DBckbFgx.js} +1 -1
  18. package/dist/assets/{manifold-D6BeHIOo.js → manifold-O2AAGXyj.js} +1 -1
  19. package/dist/assets/{reportWorker-sFEFonXf.js → reportWorker-Dxr-5A7w.js} +8760 -3559
  20. package/dist/assets/{vendor-react-Dt7-aaJH.js → vendor-react-CG3i_wp0.js} +65 -8
  21. package/dist/docs/index.html +2 -2
  22. package/dist/docs-raw/CLI.md +341 -718
  23. package/dist/docs-raw/generated/assembly.md +699 -112
  24. package/dist/docs-raw/generated/concepts.md +1834 -1346
  25. package/dist/docs-raw/generated/core.md +1012 -1059
  26. package/dist/docs-raw/generated/curves.md +759 -116
  27. package/dist/docs-raw/generated/lib.md +43 -748
  28. package/dist/docs-raw/generated/output.md +139 -245
  29. package/dist/docs-raw/generated/sdf.md +208 -0
  30. package/dist/docs-raw/generated/sheet-metal.md +473 -21
  31. package/dist/docs-raw/generated/sketch.md +1518 -362
  32. package/dist/docs-raw/generated/viewport.md +368 -299
  33. package/dist/docs-raw/generated/wood.md +104 -0
  34. package/dist/index.html +2 -2
  35. package/dist/landing/proof-ams-adapter.png +0 -0
  36. package/dist/landing/proof-bolt-and-nut.png +0 -0
  37. package/dist/landing/proof-fillet-enclosure.png +0 -0
  38. package/dist/landing/proof-glasses.png +0 -0
  39. package/dist/landing/proof-gyroid.png +0 -0
  40. package/dist/sitemap.xml +6 -6
  41. package/dist-cli/forgecad.js +12321 -5700
  42. package/dist-cli/forgecad.js.map +1 -0
  43. package/dist-cli/solver-46FFSK2U.js +363 -0
  44. package/dist-cli/solver-46FFSK2U.js.map +1 -0
  45. package/dist-skill/CONTEXT.md +4890 -6302
  46. package/dist-skill/SKILL-dev.md +22 -66
  47. package/dist-skill/SKILL.md +20 -59
  48. package/dist-skill/docs/API/core/concepts.md +37 -92
  49. package/dist-skill/docs/CLI.md +341 -718
  50. package/dist-skill/docs/generated/assembly.md +699 -112
  51. package/dist-skill/docs/generated/core.md +1012 -1059
  52. package/dist-skill/docs/generated/curves.md +759 -116
  53. package/dist-skill/docs/generated/lib.md +43 -748
  54. package/dist-skill/docs/generated/output.md +139 -245
  55. package/dist-skill/docs/generated/sdf.md +208 -0
  56. package/dist-skill/docs/generated/sheet-metal.md +473 -21
  57. package/dist-skill/docs/generated/sketch.md +1518 -362
  58. package/dist-skill/docs/generated/viewport.md +368 -299
  59. package/dist-skill/docs/generated/wood.md +104 -0
  60. package/dist-skill/docs/guides/coordinate-system.md +11 -17
  61. package/dist-skill/docs/guides/geometry-conventions.md +13 -70
  62. package/dist-skill/docs/guides/joint-design.md +78 -0
  63. package/dist-skill/docs/guides/modeling-recipes.md +22 -195
  64. package/dist-skill/docs/guides/positioning.md +88 -147
  65. package/dist-skill/docs-dev/API/core/concepts.md +78 -0
  66. package/dist-skill/docs-dev/CLI.md +488 -0
  67. package/dist-skill/{docs → docs-dev}/blueprint-first.md +5 -0
  68. package/dist-skill/{docs → docs-dev}/coding-best-practices.md +6 -8
  69. package/dist-skill/{docs → docs-dev}/coding.md +2 -4
  70. package/dist-skill/docs-dev/component-model.md +164 -0
  71. package/dist-skill/docs-dev/generated/assembly.md +779 -0
  72. package/dist-skill/docs-dev/generated/core.md +1676 -0
  73. package/dist-skill/docs-dev/generated/curves.md +855 -0
  74. package/dist-skill/docs-dev/generated/lib.md +55 -0
  75. package/dist-skill/docs-dev/generated/output.md +234 -0
  76. package/dist-skill/docs-dev/generated/sdf.md +208 -0
  77. package/dist-skill/docs-dev/generated/sheet-metal.md +506 -0
  78. package/dist-skill/docs-dev/generated/sketch.md +1753 -0
  79. package/dist-skill/docs-dev/generated/viewport.md +513 -0
  80. package/dist-skill/docs-dev/generated/wood.md +104 -0
  81. package/dist-skill/docs-dev/guides/coordinate-system.md +46 -0
  82. package/dist-skill/docs-dev/guides/geometry-conventions.md +52 -0
  83. package/dist-skill/docs-dev/guides/joint-design.md +78 -0
  84. package/dist-skill/docs-dev/guides/modeling-recipes.md +77 -0
  85. package/dist-skill/docs-dev/guides/positioning.md +151 -0
  86. package/dist-skill/{docs → docs-dev}/guides/skill-maintenance.md +21 -10
  87. package/dist-skill/{docs → docs-dev}/internals/compiler.md +5 -6
  88. package/dist-skill/{docs → docs-dev}/internals/constraint-solver-quality.md +0 -1
  89. package/dist-skill/{docs → docs-dev}/internals/constraint-solver.md +0 -1
  90. package/dist-skill/{docs → docs-dev}/internals/sketch-2d-pipeline.md +2 -3
  91. package/examples/api/attachTo-basics.forge.js +8 -8
  92. package/examples/api/bill-of-materials.forge.js +9 -9
  93. package/examples/api/bolt-pattern.forge.js +5 -5
  94. package/examples/api/boolean-operations.forge.js +5 -5
  95. package/examples/api/bounding-box-visualizer.forge.js +3 -3
  96. package/examples/api/clone-duplicate.forge.js +2 -2
  97. package/examples/api/colors-union-vs-array.forge.js +6 -6
  98. package/examples/api/connector-assembly.forge.js +8 -6
  99. package/examples/api/connector-basics.forge.js +7 -7
  100. package/examples/api/constrained-sketch-mechanical.forge.js +4 -4
  101. package/examples/api/elbow-test.forge.js +3 -3
  102. package/examples/api/extrude-options.forge.js +8 -14
  103. package/examples/api/feature-created-faces.forge.js +6 -10
  104. package/examples/api/fillet-showcase.forge.js +2 -2
  105. package/examples/api/folded-service-panel-cover.forge.js +2 -2
  106. package/examples/api/gears-tier1.forge.js +5 -5
  107. package/examples/api/group-test.forge.js +3 -3
  108. package/examples/api/group-vs-union.forge.js +1 -1
  109. package/examples/api/highlight-debug.forge.js +4 -0
  110. package/examples/api/js-module-pillars.js +1 -1
  111. package/examples/api/js-module-scene.js +2 -2
  112. package/examples/api/mesh-import-slats.forge.js +4 -4
  113. package/examples/api/patterns.forge.js +3 -3
  114. package/examples/api/pointAlong-orientation.forge.js +3 -3
  115. package/examples/api/profile-2020-b-slot6.forge.js +4 -5
  116. package/examples/api/route-perimeter-flange.forge.js +1 -1
  117. package/examples/api/sdf-rover-demo.forge.js +10 -10
  118. package/examples/api/sketch-on-face-demo.forge.js +2 -2
  119. package/examples/api/sketch-regions.forge.js +4 -4
  120. package/examples/api/sketch-rounding-strategies.forge.js +1 -1
  121. package/examples/api/smooth-curve-connections.forge.js +1 -1
  122. package/examples/api/transition-curves.forge.js +4 -4
  123. package/examples/api/variable-sweep-pure-sdf-test.forge.js +162 -0
  124. package/examples/api/variable-sweep-test.forge.js +2 -2
  125. package/examples/api/wood-joinery.forge.js +60 -0
  126. package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +3 -3
  127. package/examples/compiler-corpus/fastener-plate-variants.forge.js +2 -2
  128. package/examples/constraints/01-fully-constrained-rect.forge.js +2 -2
  129. package/examples/constraints/02-underconstrained-triangle.forge.js +1 -1
  130. package/examples/constraints/03-redundant-constraints.forge.js +2 -2
  131. package/examples/constraints/05-parallel-with-linedistance.forge.js +2 -2
  132. package/examples/constraints/06-complex-spectrogram.forge.js +1 -1
  133. package/examples/constraints/07-perpendicular-chain.forge.js +4 -4
  134. package/examples/constraints/08-symmetric-bracket.forge.js +4 -4
  135. package/examples/constraints/09-stress-spiral.forge.js +1 -1
  136. package/examples/constraints/10-stress-honeycomb.forge.js +1 -1
  137. package/examples/constraints/11-surface-grid.forge.js +2 -2
  138. package/examples/constraints/12-surface-nested.forge.js +4 -4
  139. package/examples/constraints/13-surface-complex.forge.js +1 -1
  140. package/examples/exact-arc-housing.forge.js +12 -0
  141. package/examples/experiments/drone-arm.forge.js +53 -0
  142. package/examples/furniture/adjustable-table.forge.js +15 -15
  143. package/examples/furniture/bathroom.forge.js +26 -26
  144. package/examples/furniture/chair.forge.js +13 -13
  145. package/examples/furniture/picture-frame.forge.js +6 -6
  146. package/examples/furniture/shoe-rack-doors.forge.js +8 -8
  147. package/examples/furniture/shoe-rack.forge.js +7 -7
  148. package/examples/furniture/table-lamp.forge.js +8 -8
  149. package/examples/gcode/lissajous-vase.forge.js +4 -4
  150. package/examples/gcode/math-surface.forge.js +3 -3
  151. package/examples/gcode/parametric-vase.forge.js +4 -4
  152. package/examples/gcode/spiral-tower.forge.js +4 -4
  153. package/examples/generative/crystal-growth.forge.js +9 -9
  154. package/examples/generative/frost-spires.forge.js +9 -9
  155. package/examples/generative/golden-spiral-tower.forge.js +11 -11
  156. package/examples/generative/molten-forge.forge.js +6 -6
  157. package/examples/generative/neon-coral.forge.js +7 -7
  158. package/examples/mechanical/3d-printer.forge.js +37 -37
  159. package/examples/mechanical/5-finger-robot-hand.forge.js +19 -19
  160. package/examples/mechanical/airplane-propeller.forge.js +9 -9
  161. package/examples/mechanical/bolt-and-nut.forge.js +10 -10
  162. package/examples/mechanical/door-with-hinges.forge.js +7 -7
  163. package/examples/mechanical/fillet-enclosure.forge.js +15 -11
  164. package/examples/mechanical/headphone-hanger-v2.forge.js +11 -11
  165. package/examples/mechanical/robot_hand.forge.js +24 -24
  166. package/examples/mechanical/robot_hand_2.forge.js +26 -26
  167. package/examples/nurbs-surface.forge.js +8 -0
  168. package/examples/nurbs-tube.forge.js +7 -0
  169. package/examples/products/bottle.forge.js +8 -8
  170. package/examples/products/chess-set.forge.js +25 -25
  171. package/examples/products/classical-piano.forge.js +20 -20
  172. package/examples/products/clock.forge.js +33 -33
  173. package/examples/products/cup.forge.js +5 -5
  174. package/examples/products/iphone.forge.js +20 -20
  175. package/examples/products/laptop.forge.js +24 -24
  176. package/examples/products/laser-cut-box.forge.js +6 -6
  177. package/examples/products/laser-cut-tray.forge.js +6 -6
  178. package/examples/products/liquid-soap-dispenser.forge.js +23 -23
  179. package/examples/products/origami-fish.forge.js +14 -12
  180. package/examples/products/spiderman-cake.forge.js +6 -6
  181. package/examples/shelf/container.forge.js +5 -5
  182. package/examples/shelf/shelf-unit.forge.js +6 -6
  183. package/examples/toolbox/bolted-joint.forge.js +7 -7
  184. package/package.json +9 -4
  185. package/dist/assets/EditorApp-B-vQvgam.js +0 -9888
  186. package/dist/assets/LandingPage-C5n9hDXI.js +0 -322
  187. package/dist/assets/PublishedModelPage-Dt7PCVBj.js +0 -146
  188. package/dist/assets/__vite-browser-external-CURh0WXD.js +0 -8
  189. package/dist/assets/deserializeRunResult-BLAFoiE0.js +0 -19365
  190. package/dist/assets/index-1CYp3zUp.js +0 -1455
  191. package/dist-skill/docs/API/API.md +0 -1666
  192. package/dist-skill/docs/API/README.md +0 -37
  193. package/dist-skill/docs/API/assembly/assembly.md +0 -617
  194. package/dist-skill/docs/API/core/edge-queries.md +0 -130
  195. package/dist-skill/docs/API/core/parameters.md +0 -122
  196. package/dist-skill/docs/API/core/reserved-terms.md +0 -137
  197. package/dist-skill/docs/API/core/sdf.md +0 -326
  198. package/dist-skill/docs/API/core/skill-cli.md +0 -194
  199. package/dist-skill/docs/API/core/skill-guide.md +0 -205
  200. package/dist-skill/docs/API/core/specs.md +0 -186
  201. package/dist-skill/docs/API/core/topology.md +0 -372
  202. package/dist-skill/docs/API/entities.md +0 -268
  203. package/dist-skill/docs/API/output/bom.md +0 -58
  204. package/dist-skill/docs/API/output/brep-export.md +0 -87
  205. package/dist-skill/docs/API/output/dimensions.md +0 -67
  206. package/dist-skill/docs/API/output/export.md +0 -110
  207. package/dist-skill/docs/API/output/gcode.md +0 -195
  208. package/dist-skill/docs/API/runtime/viewport.md +0 -420
  209. package/dist-skill/docs/API/sheet-metal/sheet-metal.md +0 -185
  210. package/dist-skill/docs/API/sketch/anchor.md +0 -37
  211. package/dist-skill/docs/API/sketch/booleans.md +0 -91
  212. package/dist-skill/docs/API/sketch/core.md +0 -73
  213. package/dist-skill/docs/API/sketch/extrude.md +0 -62
  214. package/dist-skill/docs/API/sketch/on-face.md +0 -104
  215. package/dist-skill/docs/API/sketch/operations.md +0 -78
  216. package/dist-skill/docs/API/sketch/path.md +0 -75
  217. package/dist-skill/docs/API/sketch/primitives.md +0 -146
  218. package/dist-skill/docs/API/sketch/regions.md +0 -80
  219. package/dist-skill/docs/API/sketch/text.md +0 -108
  220. package/dist-skill/docs/API/sketch/transforms.md +0 -65
  221. package/dist-skill/docs/API/toolbox/fasteners.md +0 -129
  222. package/dist-skill/docs/INDEX.md +0 -94
  223. package/dist-skill/docs/RELEASING.md +0 -55
  224. package/dist-skill/docs/cli-monetization.md +0 -111
  225. package/dist-skill/docs/deployment.md +0 -281
  226. package/dist-skill/docs/generated/concepts.md +0 -2112
  227. package/dist-skill/docs/internals/shape-from-slices.md +0 -152
  228. package/dist-skill/docs/platform/admin.md +0 -45
  229. package/dist-skill/docs/platform/architecture.md +0 -79
  230. package/dist-skill/docs/platform/auth.md +0 -110
  231. package/dist-skill/docs/platform/email.md +0 -67
  232. package/dist-skill/docs/platform/projects.md +0 -111
  233. package/dist-skill/docs/platform/sharing.md +0 -90
  234. package/dist-skill/docs/runbook.md +0 -345
@@ -5,756 +5,51 @@ skill-order: 100
5
5
 
6
6
  # Part Library
7
7
 
8
- > **Auto-generated** from `src/forge/forge-public-api.ts`. Do not edit by hand — run `npm run gen:docs` to regenerate.
9
-
10
8
  Pre-built fasteners, gears, pipes, structural profiles, and utility shapes. Access via `lib.*`.
11
9
 
12
- ## Functions
13
-
14
- ### Fasteners & Hardware
15
-
16
- Pre-built fastener shapes and hole helpers. Access via `lib.*`.
17
-
18
- #### `lib.boltHole()`
19
-
20
- ```ts
21
- lib.boltHole(diameter: number, depth: number): Shape
22
- ```
23
-
24
- Through-hole cylinder centered at origin, intended as a cutter (subtract from part).
25
-
26
- #### `lib.fastenerHole()`
27
-
28
- ```ts
29
- lib.fastenerHole(opts: FastenerHoleOptions): Shape
30
- ```
31
-
32
- Standardized metric fastener hole (through-hole/tap drill + optional counterbore/countersink). Returns hole geometry intended as a cutter (subtract from part).
33
-
34
- <details><summary><code>FastenerHoleOptions</code></summary>
35
-
36
- ```ts
37
- interface FastenerHoleOptions {
38
- standard?: "iso-metric";
39
- size: MetricSize;
40
- fit?: FastenerFit;
41
- depth: number;
42
- depth: number;
43
- diameter?: number;
44
- diameter: number;
45
- angleDeg?: number;
46
- center?: boolean;
47
- segments?: number;
48
- }
49
- ```
50
-
51
- </details>
52
-
53
- #### `lib.counterbore()`
54
-
55
- ```ts
56
- lib.counterbore(holeDia: number, boreDia: number, boreDepth: number, totalDepth: number): Shape
57
- ```
58
-
59
- Counterbore hole — through-hole with a wider recess at the top
60
-
61
- #### `lib.hexNut()`
62
-
63
- ```ts
64
- lib.hexNut(acrossFlats: number, height: number, holeDia: number): Shape
65
- ```
66
-
67
- Hex nut via intersection of three rotated slabs with a center bore.
68
-
69
- #### `lib.holePattern()`
70
-
71
- ```ts
72
- lib.holePattern(rows: number, cols: number, spacingX: number, spacingY: number, holeDia: number, depth: number): Shape
73
- ```
74
-
75
- Grid of cylindrical holes intended as a cutter pattern (subtract from part).
76
-
77
- #### `lib.thread()`
78
-
79
- ```ts
80
- lib.thread(diameter: number, pitch: number, length: number, options?: { depth?: number; segments?: number; }): Shape
81
- ```
82
-
83
- External thread via twisted extrusion — no SDF grid artifacts. The idea: build a cross-section that's a circle at the root diameter with one trapezoidal bump out to the crest diameter. Then twist-extrude it so the bump traces a helix. Manifold's extrude+twist produces clean structured geometry — quads split into triangles that follow the thread. Returns a threaded cylinder along +Z from z=0 to z=length.
84
-
85
- #### `lib.bolt()`
86
-
87
- ```ts
88
- lib.bolt(diameter: number, length: number, options?: { ... }): Shape
89
- ```
90
-
91
- Hex bolt with real helical threads. Head at z=0..headHeight, shaft extends downward along -Z.
92
-
93
- #### `lib.nut()`
94
-
95
- ```ts
96
- lib.nut(diameter: number, options?: { pitch?: number; height?: number; acrossFlats?: number; segments?: number; }): Shape
97
- ```
98
-
99
- Hex nut with threaded bore. Centered at origin, height along Z.
100
-
101
- #### `lib.washer()`
102
-
103
- ```ts
104
- lib.washer(size: MetricSize, options?: { standard?: WasherStandard; segments?: number; }): Shape
105
- ```
106
-
107
- Flat washer (DIN 125-A by default). Returns a flat ring centered at the origin, thickness along Z. Use `size` to select a standard metric thread size.
108
-
109
- #### `lib.fastenerSet()`
110
-
111
- ```ts
112
- lib.fastenerSet(size: MetricSize, boltLength: number, options?: FastenerSetOptions): FastenerSetResult
113
- ```
114
-
115
- Complete ISO metric fastener set — bolt, nut, optional washers, and matching hole cutters. All shapes are returned un-positioned (each centered on the Z-axis at z=0 or the convention described in `FastenerSetResult`). Place them yourself using `.translate()`.
116
-
117
- <details><summary><code>FastenerSetOptions</code></summary>
118
-
119
- ```ts
120
- interface FastenerSetOptions {
121
- /** Include a washer under the bolt head (default: true). */
122
- washerUnderHead?: boolean;
123
- /** Include a washer under the nut (default: true). */
124
- washerUnderNut?: boolean;
125
- /** Clearance hole fit (default: 'normal'). */
126
- fit?: FastenerFit;
127
- /** Thread segment count (default: 36). */
128
- segments?: number;
129
- }
130
- ```
131
-
132
- </details>
133
-
134
- <details><summary><code>FastenerSetResult</code></summary>
135
-
136
- ```ts
137
- interface FastenerSetResult {
138
- /** Hex bolt: head top at z=0, threaded shaft extends toward −Z by `boltLength`. */
139
- bolt: Shape;
140
- /** Hex nut centered at z=0. */
141
- nut: Shape;
142
- /** Flat washer centered at z=0. Null when washerUnderHead is false. */
143
- washerUnderHead: Shape | null;
144
- /** Flat washer centered at z=0. Null when washerUnderNut is false. */
145
- washerUnderNut: Shape | null;
146
- /** Clearance-hole cutter (cylinder) centered at z=0, for subtracting from a through-plate. */
147
- clearanceHole: Shape;
148
- /** Tap-drill cutter (cylinder) centered at z=0, for subtracting from a tapped plate. */
149
- tappedHole: Shape;
150
- /** Reference dimensions for BOM, placement calculations, and documentation. */
151
- dims: FastenerSetDimensions;
152
- }
153
- ```
154
-
155
- </details>
156
-
157
- <details><summary><code>FastenerSetDimensions</code></summary>
158
-
159
- ```ts
160
- interface FastenerSetDimensions {
161
- size: MetricSize;
162
- nominalDiameter: number;
163
- boltLength: number;
164
- clearanceDia: number;
165
- tapDia: number;
166
- nutAcrossFlats: number;
167
- nutHeight: number;
168
- washerOuterDia: number;
169
- washerInnerDia: number;
170
- washerThickness: number;
171
- }
172
- ```
173
-
174
- </details>
175
-
176
- ### Structural Profiles
177
-
178
- Extrusion profiles for aluminum framing and similar applications. Access via `lib.*`.
179
-
180
- #### `lib.tSlotProfile()`
181
-
182
- ```ts
183
- lib.tSlotProfile(options?: TSlotProfileOptions): Sketch
184
- ```
185
-
186
- Build a 2D T-slot cross-section sketch. Default parameters describe a 20x20 B-type profile with slot 6. Use this when you want a drawing-ready profile sketch before extrusion.
187
-
188
- <details><summary><code>TSlotProfileOptions</code></summary>
189
-
190
- ```ts
191
- interface TSlotProfileOptions {
192
- /** Outer profile size (square). */
193
- size?: number;
194
- /** Slot mouth width (the narrow opening at each side). */
195
- slotWidth?: number;
196
- /** Wider interior slot cavity width. Must be >= slotWidth. */
197
- slotInnerWidth?: number;
198
- /** Total slot depth from outer face inward. */
199
- slotDepth?: number;
200
- /** Depth of the narrow mouth before it widens into slotInnerWidth. */
201
- slotNeckDepth?: number;
202
- /** Outer shell wall thickness. */
203
- wall?: number;
204
- /** Central cross-web thickness. */
205
- web?: number;
206
- /** Center boss diameter (solid material around center bore). */
207
- centerBossDia?: number;
208
- /** Center bore diameter (for tapping/through-hole). Set 0 to disable. */
209
- centerBoreDia?: number;
210
- /** Outer corner radius. */
211
- outerCornerRadius?: number;
212
- /** Segment count used for circular features in 2D. */
213
- segments?: number;
214
- }
215
- ```
216
-
217
- </details>
218
-
219
- #### `lib.tSlotExtrusion()`
220
-
221
- ```ts
222
- lib.tSlotExtrusion(length: number, options?: TSlotExtrusionOptions): Shape
223
- ```
224
-
225
- Build a T-slot extrusion from the generated 2D profile. Extrudes along +Z by default.
226
-
227
-
228
- <details><summary><code>TSlotExtrusionOptions</code> extends TSlotProfileOptions</summary>
229
-
230
- ```ts
231
- interface TSlotExtrusionOptions extends TSlotProfileOptions {
232
- /** Center the extrusion around Z=0 instead of starting at Z=0. */
233
- center?: boolean;
234
- }
235
- ```
236
-
237
- </details>
238
-
239
- #### `lib.profile2020BSlot6Profile()`
240
-
241
- ```ts
242
- lib.profile2020BSlot6Profile(options?: Profile2020BSlot6ProfileOptions): Sketch
243
- ```
244
-
245
- Accurate-ish 2D profile for 20x20 B-type slot 6. Returns a drawing-ready Sketch centered at origin.
246
-
247
- <details><summary><code>Profile2020BSlot6ProfileOptions</code></summary>
248
-
249
- ```ts
250
- interface Profile2020BSlot6ProfileOptions {
251
- /** Slot mouth width. */
252
- slotWidth?: number;
253
- /** Wider inner slot width. */
254
- slotInnerWidth?: number;
255
- /** Slot depth from outer face. */
256
- slotDepth?: number;
257
- /** Depth of the narrow neck before widening into slotInnerWidth. */
258
- slotNeckDepth?: number;
259
- /** Center core bore diameter (set 0 to disable). */
260
- centerBoreDia?: number;
261
- /** Solid boss diameter around center bore (must exceed centerBoreDia when bore is enabled). */
262
- centerBossDia?: number;
263
- /** Width of diagonal ribs connecting center boss to corner regions. */
264
- diagonalWebWidth?: number;
265
- /** Outside corner radius. */
266
- outerCornerRadius?: number;
267
- /** Circle segment count. */
268
- segments?: number;
269
- }
270
- ```
271
-
272
- </details>
273
-
274
- #### `lib.profile2020BSlot6()`
275
-
276
- ```ts
277
- lib.profile2020BSlot6(length: number, options?: Profile2020BSlot6Options): Shape
278
- ```
279
-
280
- 20x20 B-type slot 6 extrusion with profile-accurate defaults. Pass option overrides if your supplier's profile differs slightly.
281
-
282
-
283
- <details><summary><code>Profile2020BSlot6Options</code> extends Profile2020BSlot6ProfileOptions</summary>
284
-
285
- ```ts
286
- interface Profile2020BSlot6Options extends Profile2020BSlot6ProfileOptions {
287
- /** Center the extrusion around Z=0 instead of starting at Z=0. */
288
- center?: boolean;
289
- }
290
- ```
291
-
292
- </details>
293
-
294
- ### Pipes & Routing
295
-
296
- Create pipe runs, elbows, and tubes. Access via `lib.*`.
297
-
298
- #### `lib.tube()`
299
-
300
- ```ts
301
- lib.tube(outerX: number, outerY: number, outerZ: number, wall: number): Shape
302
- ```
303
-
304
- Rectangular tube / hollow box
305
-
306
- #### `lib.pipe()`
307
-
308
- ```ts
309
- lib.pipe(height: number, outerRadius: number, wall: number, segments?: number): Shape
310
- ```
311
-
312
- Pipe — hollow cylinder
313
-
314
- #### `lib.pipeRoute()`
315
-
316
- ```ts
317
- lib.pipeRoute(points: [ number,
318
- ```
319
-
320
- Route a pipe (solid or hollow) through 3D waypoints with smooth bends. Each interior waypoint gets a torus-section bend. Straight segments connect them. Returns a single unioned Shape.
321
-
322
- #### `lib.elbow()`
323
-
324
- ```ts
325
- lib.elbow(pipeRadius: number, bendRadius: number, angle?: number | { ... }, options?: { ... }): Shape
326
- ```
327
-
328
- Pipe elbow — a curved pipe section (torus arc) for connecting two pipe directions. By default creates a bend in the XZ plane: incoming along +Z, outgoing rotated by `angle`. The bend starts at the origin, curving away from it.
329
-
330
- ### Gears
331
-
332
- Parametric gear geometry with meshing analysis. Access via `lib.*`.
333
-
334
- #### `lib.spurGear()`
335
-
336
- ```ts
337
- lib.spurGear(options: SpurGearOptions): Shape
338
- ```
339
-
340
- Involute external spur gear with optional center bore. Specify module, teeth, faceWidth as required parameters. Optional tuning includes pressureAngleDeg (default 20), backlash, clearance, addendum, dedendum, boreDiameter, and segmentsPerTooth (default 10).
341
-
342
- <details><summary><code>SpurGearOptions</code></summary>
343
-
344
- ```ts
345
- interface SpurGearOptions {
346
- module: number;
347
- teeth: number;
348
- pressureAngleDeg?: number;
349
- faceWidth: number;
350
- backlash?: number;
351
- clearance?: number;
352
- addendum?: number;
353
- dedendum?: number;
354
- boreDiameter?: number;
355
- center?: boolean;
356
- segmentsPerTooth?: number;
357
- }
358
- ```
10
+ ## Contents
359
11
 
360
- </details>
12
+ - [lib](#lib)
361
13
 
362
- #### `lib.bevelGear()`
363
-
364
- ```ts
365
- lib.bevelGear(options: BevelGearOptions): Shape
366
- ```
367
-
368
- Conical bevel gear generated from a tapered involute extrusion. Specify pitchAngleDeg directly or derive it from mateTeeth + shaftAngleDeg.
369
-
370
- <details><summary><code>BevelGearOptions</code></summary>
371
-
372
- ```ts
373
- interface BevelGearOptions {
374
- module: number;
375
- teeth: number;
376
- pressureAngleDeg?: number;
377
- faceWidth: number;
378
- backlash?: number;
379
- clearance?: number;
380
- addendum?: number;
381
- dedendum?: number;
382
- boreDiameter?: number;
383
- pitchAngleDeg?: number;
384
- mateTeeth?: number;
385
- shaftAngleDeg?: number;
386
- center?: boolean;
387
- segmentsPerTooth?: number;
388
- }
389
- ```
390
-
391
- </details>
392
-
393
- #### `lib.faceGear()`
394
-
395
- ```ts
396
- lib.faceGear(options: FaceGearOptions): Shape
397
- ```
398
-
399
- Face gear (crown style) where teeth are on one face (top or bottom) instead of the outer rim. Uses the same involute tooth sizing as spurGear, then projects the tooth band axially from one side. Alias for sideGear (which is kept for backward compatibility).
400
-
401
-
402
- <details><summary><code>SideGearOptions</code> extends SpurGearOptions</summary>
403
-
404
- ```ts
405
- interface SideGearOptions extends SpurGearOptions {
406
- side?: "top" | "bottom";
407
- toothHeight?: number;
408
- }
409
- ```
410
-
411
- </details>
412
-
413
- <details><summary><code>FaceGearOptions</code> extends SideGearOptions</summary>
414
-
415
- ```ts
416
- interface FaceGearOptions extends SideGearOptions {
417
- }
418
- ```
419
-
420
- </details>
421
-
422
- #### `lib.sideGear()`
423
-
424
- ```ts
425
- lib.sideGear(options: SideGearOptions): Shape
426
- ```
427
-
428
- Crown/face style gear where the teeth project from one side of the disk instead of the outer cylindrical rim.
429
-
430
- #### `lib.ringGear()`
431
-
432
- ```ts
433
- lib.ringGear(options: RingGearOptions): Shape
434
- ```
435
-
436
- Internal ring gear with involute-derived tooth spaces. Specify rimWidth or outerDiameter for the annular body.
437
-
438
- <details><summary><code>RingGearOptions</code></summary>
439
-
440
- ```ts
441
- interface RingGearOptions {
442
- module: number;
443
- teeth: number;
444
- pressureAngleDeg?: number;
445
- faceWidth: number;
446
- backlash?: number;
447
- clearance?: number;
448
- addendum?: number;
449
- dedendum?: number;
450
- rimWidth?: number;
451
- outerDiameter?: number;
452
- center?: boolean;
453
- segmentsPerTooth?: number;
454
- }
455
- ```
456
-
457
- </details>
458
-
459
- #### `lib.rackGear()`
460
-
461
- ```ts
462
- lib.rackGear(options: RackGearOptions): Shape
463
- ```
464
-
465
- Linear rack gear with pressure-angle flanks. Use with spurGear for rack-and-pinion mechanisms.
466
-
467
- <details><summary><code>RackGearOptions</code></summary>
468
-
469
- ```ts
470
- interface RackGearOptions {
471
- module: number;
472
- teeth: number;
473
- pressureAngleDeg?: number;
474
- faceWidth: number;
475
- backlash?: number;
476
- clearance?: number;
477
- addendum?: number;
478
- dedendum?: number;
479
- baseHeight?: number;
480
- center?: boolean;
481
- }
482
- ```
483
-
484
- </details>
485
-
486
- #### `lib.gearPair()`
487
-
488
- ```ts
489
- lib.gearPair(options: GearPairOptions): GearPairResult
490
- ```
491
-
492
- Build or validate a spur-gear pair and return ratio, backlash, and mesh diagnostics. Accepts either shapes from spurGear() or analytical specs for each member. When place is true (default), the gear is auto-positioned at the correct center distance.
493
-
494
- <details><summary><code>GearPairOptions</code></summary>
495
-
496
- ```ts
497
- interface GearPairOptions {
498
- pinion: Shape | GearPairSpec;
499
- gear: Shape | GearPairSpec;
500
- backlash?: number;
501
- centerDistance?: number;
502
- place?: boolean;
503
- phaseDeg?: number;
504
- }
505
- ```
506
-
507
- </details>
508
-
509
- <details><summary><code>GearPairSpec</code></summary>
510
-
511
- ```ts
512
- interface GearPairSpec {
513
- module: number;
514
- teeth: number;
515
- pressureAngleDeg?: number;
516
- faceWidth?: number;
517
- backlash?: number;
518
- clearance?: number;
519
- addendum?: number;
520
- dedendum?: number;
521
- boreDiameter?: number;
522
- segmentsPerTooth?: number;
523
- }
524
- ```
525
-
526
- </details>
527
-
528
- <details><summary><code>GearPairResult</code></summary>
529
-
530
- ```ts
531
- interface GearPairResult {
532
- pinion: Shape;
533
- gear: Shape;
534
- centerDistance: number;
535
- centerDistanceNominal: number;
536
- backlash: number;
537
- pressureAngleDeg: number;
538
- workingPressureAngleDeg: number;
539
- contactRatio: number;
540
- jointRatio: number;
541
- speedReduction: number;
542
- /** Phase rotation (degrees) for the gear around its shaft axis for correct tooth mesh alignment. When `place: true` this is already baked into `gear`. When `place: false`, rotate the gear by this amount before positioning. */
543
- phaseDeg: number;
544
- diagnostics: GearPairDiagnostic[];
545
- status: "ok" | "warn" | "error";
546
- }
547
- ```
548
-
549
- </details>
550
-
551
- <details><summary><code>GearPairDiagnostic</code></summary>
552
-
553
- ```ts
554
- interface GearPairDiagnostic {
555
- level: "info" | "warn" | "error";
556
- code: string;
557
- message: string;
558
- }
559
- ```
560
-
561
- </details>
562
-
563
- #### `lib.bevelGearPair()`
564
-
565
- ```ts
566
- lib.bevelGearPair(options: BevelGearPairOptions): BevelGearPairResult
567
- ```
568
-
569
- Build or validate a bevel-gear pair and return ratio diagnostics plus recommended joint placement vectors.
570
-
571
- <details><summary><code>BevelGearPairOptions</code></summary>
572
-
573
- ```ts
574
- interface BevelGearPairOptions {
575
- pinion: Shape | BevelGearPairSpec;
576
- gear: Shape | BevelGearPairSpec;
577
- shaftAngleDeg?: number;
578
- backlash?: number;
579
- place?: boolean;
580
- phaseDeg?: number;
581
- }
582
- ```
583
-
584
- </details>
585
-
586
-
587
- <details><summary><code>BevelGearPairSpec</code> extends GearPairSpec</summary>
588
-
589
- ```ts
590
- interface BevelGearPairSpec extends GearPairSpec {
591
- }
592
- ```
593
-
594
- </details>
595
-
596
- <details><summary><code>GearMeshPlacement</code></summary>
597
-
598
- ```ts
599
- interface GearMeshPlacement {
600
- }
601
- ```
602
-
603
- </details>
604
-
605
- <details><summary><code>BevelGearPairResult</code> extends GearMeshPlacement</summary>
606
-
607
- ```ts
608
- interface BevelGearPairResult extends GearMeshPlacement {
609
- pinion: Shape;
610
- gear: Shape;
611
- shaftAngleDeg: number;
612
- pinionPitchAngleDeg: number;
613
- gearPitchAngleDeg: number;
614
- coneDistance: number;
615
- backlash: number;
616
- jointRatio: number;
617
- speedReduction: number;
618
- /** Phase rotation (degrees) for gear tooth mesh alignment. See GearPairResult.phaseDeg. */
619
- phaseDeg: number;
620
- diagnostics: GearPairDiagnostic[];
621
- status: "ok" | "warn" | "error";
622
- }
623
- ```
624
-
625
- </details>
626
-
627
- #### `lib.faceGearPair()`
628
-
629
- ```ts
630
- lib.faceGearPair(options: FaceGearPairOptions): FaceGearPairResult
631
- ```
632
-
633
- Build or validate a perpendicular pair between a face gear and a vertical spur gear.
634
-
635
- <details><summary><code>FaceGearPairOptions</code></summary>
636
-
637
- ```ts
638
- interface FaceGearPairOptions {
639
- face: Shape | FaceGearSpec;
640
- vertical: Shape | GearPairSpec;
641
- backlash?: number;
642
- centerDistance?: number;
643
- meshPlaneZ?: number;
644
- place?: boolean;
645
- phaseDeg?: number;
646
- }
647
- ```
648
-
649
- </details>
650
-
651
-
652
- <details><summary><code>SideGearSpec</code> extends GearPairSpec</summary>
653
-
654
- ```ts
655
- interface SideGearSpec extends GearPairSpec {
656
- side?: "top" | "bottom";
657
- toothHeight?: number;
658
- }
659
- ```
660
-
661
- </details>
662
-
663
- <details><summary><code>FaceGearSpec</code> extends SideGearSpec</summary>
664
-
665
- ```ts
666
- interface FaceGearSpec extends SideGearSpec {
667
- }
668
- ```
669
-
670
- </details>
671
-
672
- <details><summary><code>FaceGearPairResult</code></summary>
673
-
674
- ```ts
675
- interface FaceGearPairResult {
676
- face: Shape;
677
- vertical: Shape;
678
- centerDistance: number;
679
- centerDistanceNominal: number;
680
- backlash: number;
681
- pressureAngleDeg: number;
682
- meshPlaneZ: number;
683
- radialOverlap: number;
684
- jointRatio: number;
685
- speedReduction: number;
686
- /** Phase rotation (degrees) for the vertical gear. See GearPairResult.phaseDeg. */
687
- phaseDeg: number;
688
- diagnostics: GearPairDiagnostic[];
689
- status: "ok" | "warn" | "error";
690
- }
691
- ```
692
-
693
- </details>
694
-
695
- #### `lib.sideGearPair()`
696
-
697
- ```ts
698
- lib.sideGearPair(options: SideGearPairOptions): SideGearPairResult
699
- ```
700
-
701
- Pair helper for side (crown/face) gear + perpendicular "vertical" spur gear. Auto-placement rotates the spur around +Y and positions it to mesh at the side tooth band.
702
-
703
- <details><summary><code>SideGearPairOptions</code></summary>
704
-
705
- ```ts
706
- interface SideGearPairOptions {
707
- side: Shape | SideGearSpec;
708
- vertical: Shape | GearPairSpec;
709
- backlash?: number;
710
- centerDistance?: number;
711
- meshPlaneZ?: number;
712
- place?: boolean;
713
- phaseDeg?: number;
714
- }
715
- ```
716
-
717
- </details>
718
-
719
- <details><summary><code>SideGearPairResult</code></summary>
720
-
721
- ```ts
722
- interface SideGearPairResult {
723
- side: Shape;
724
- vertical: Shape;
725
- centerDistance: number;
726
- centerDistanceNominal: number;
727
- backlash: number;
728
- pressureAngleDeg: number;
729
- meshPlaneZ: number;
730
- radialOverlap: number;
731
- jointRatio: number;
732
- speedReduction: number;
733
- /** Phase rotation (degrees) for the vertical gear. See GearPairResult.phaseDeg. */
734
- phaseDeg: number;
735
- diagnostics: GearPairDiagnostic[];
736
- status: "ok" | "warn" | "error";
737
- }
738
- ```
739
-
740
- </details>
741
-
742
- ### Utility Shapes
743
-
744
- Pre-built parametric shapes for common patterns. Access via `lib.*`.
745
-
746
- #### `lib.roundedBox()`
747
-
748
- ```ts
749
- lib.roundedBox(x: number, y: number, z: number, radius: number): Shape
750
- ```
751
-
752
- Box with all 12 edges filleted.
753
-
754
- #### `lib.bracket()`
755
-
756
- ```ts
757
- lib.bracket(width: number, height: number, depth: number, thick: number, holeDia?: number): Shape
758
- ```
14
+ ---
759
15
 
760
- L-shaped mounting bracket with optional through-holes in both the base and wall.
16
+ ## Constants
17
+
18
+ ### `lib`
19
+
20
+ Pre-built parametric parts available in user scripts as `lib.*`. **Details** Every key in this object becomes a method on the `lib` namespace exposed to `.forge.js` scripts. The catalog includes: **Fasteners:** `bolt`, `nut`, `washer`, `fastenerSet`, `fastenerHole`, `boltHole`, `counterbore`, `hexNut`, `holePattern` **Structure:** `tube`, `pipe`, `bracket`, `pipeRoute`, `elbow`, `tSlotProfile`, `tSlotExtrusion`, `profile2020BSlot6Profile`, `profile2020BSlot6` **Threads:** `thread` **Gears:** `spurGear`, `bevelGear`, `faceGear`, `sideGear`, `ringGear`, `rackGear`, `gearPair`, `bevelGearPair`, `faceGearPair`, `sideGearPair` **Gear ratios (pure math helpers):** `gearRatio`, `rackRatio`, `planetaryRatio` **Bolt patterns:** `boltPattern` — define hole positions once, cut them from multiple parts **Utilities:** `explode` Extend this by adding new entries here and registering the corresponding runner binding in `runner.ts`. Sizes outside the supported ranges will throw at runtime with a descriptive error.
21
+
22
+ - `boltHole(diameter: number, depth: number): Shape` — Simple cylindrical through-hole cutter centered on Z=0. Subtract the result from a part to produce a plain cylindrical clearance hole. For ISO metric sizes with fit classes and counterbore/countersink, use {
23
+ - `fastenerHole(opts: FastenerHoleOptions): Shape` — ISO metric fastener hole cutter with optional counterbore or countersink. **Details** Returns a cutter shape (subtract from a solid to produce the hole). Sizes outside M2–M10 will throw. Extend `METRIC_HOLE_TABLE` in this file to add new sizes. **Example** ```ts const plate = box(60, 40, 8, true) .subtract(lib.fastenerHole({ size: 'M5', fit: 'normal', depth: 8 }) .translate(15, 10, 4)); ```
24
+ - `counterbore(holeDia: number, boreDia: number, boreDepth: number, totalDepth: number): Shape` — Counterbore hole cutter — through-hole with a wider cylindrical recess at the top. Use for socket-head cap screws that must sit flush. Subtract from a solid. For ISO metric sizing and fit classes, prefer {
25
+ - `tube(outerX: number, outerY: number, outerZ: number, wall: number): Shape` — Rectangular hollow tube (thin-wall box section). Both the outer and inner boxes are centered on the XY plane with their base at Z=0.
26
+ - `pipe(height: number, outerRadius: number, wall: number, segments?: number): Shape` — Hollow cylindrical pipe. Centered on the XY plane, extending upward along +Z from z=0 to z=height. For complex routed pipe geometry, see `lib.pipeRoute`.
27
+ - `explode<T extends ExplodeItem[] | ShapeGroup>(items: T, options?: ExplodeOptions): T` — Apply deterministic exploded-view offsets to an assembly tree. **Details** Traverses arrays of shapes/sketches/named items, nested `{ name, group: [...] }` structures, and [`ShapeGroup`](/docs/core#shapegroup) outputs, translating each node by a computed offset while preserving names, colors, and nesting. Returns the same structure type as the input. In `radial` mode the algorithm is branch-aware and parent-relative: each node fans out from its immediate parent's center, so nested assemblies peel apart level by level. Named items may also include an inline `explode: { stage?, direction?, axisLock? }` property to override per-item behavior. Use this function when you want to bake the explode offset into the geometry before returning (e.g. to drive the amount with a `param()` slider). For a viewport-only explode slider without rerunning the script, use [`explodeView()`](/docs/viewport#explodeview) instead. **Example** ```js const explodeAmt = param('Explode', 0, { min: 0, max: 40, unit: 'mm' }); return lib.explode(assembly, { amount: explodeAmt, stages: [0.4, 0.8], mode: 'radial', byName: { Shaft: { direction: [1, 0, 0], stage: 1.4 } }, }); ```
28
+ - `hexNut(acrossFlats: number, height: number, holeDia: number): Shape` — Generic hex nut with a cylindrical bore. Constructed via intersection of three rotated rectangular slabs, then a bore is subtracted. Centered at origin, height along Z. For standard ISO metric nuts by thread size, use `lib.nut` instead.
29
+ - `bracket(width: number, height: number, depth: number, thick: number, holeDia?: number): Shape` — L-shaped mounting bracket with optional through-holes. Produces a right-angle bracket: a horizontal base plate and a vertical wall. Both legs share `width`. Optional holes are drilled through the base (along Z) and the wall (along Y).
30
+ - `holePattern(rows: number, cols: number, spacingX: number, spacingY: number, holeDia: number, depth: number): Shape` — Rectangular grid of cylindrical hole cutters. Returns the union of `rows × cols` cylinders laid out on a regular grid. Subtract from a solid to produce the full pattern. **Example** ```ts const pattern = lib.holePattern(3, 4, 20, 20, 4, 10); const panel = box(80, 70, 10, true).subtract(pattern.translate(-30, -30, 5)); ```
31
+ - `thread(diameter: number, pitch: number, length: number, options?: { depth?: number; segments?: number; }): Shape` — External helical thread — clean mesh, no SDF grid artifacts. **Details** Builds a cross-section with a single trapezoidal tooth from the root radius out to the crest radius, then twist-extrudes it so the tooth traces a helix. Manifold's extrude+twist produces structured quad-based geometry that follows the thread profile cleanly. Returns a threaded cylinder along +Z from z=0 to z=length. **Example** ```ts const t = lib.thread(5, 0.8, 12); // M5 × 0.8 pitch, 12 mm long ```
32
+ - `bolt(diameter: number, length: number, options?: { ... }): Shape` — ISO-style hex bolt with real helical threads. **Details** The hex head sits from z=0 up to z=headHeight. The shaft extends downward along −Z by `length` mm. An unthreaded shank section is included when `threadLength < length`. Default proportions follow ISO 4762 loosely: pitch ≈ 0.15×diameter, head height ≈ 0.65×diameter, across-flats ≈ 1.6×diameter. For standard M-size bolts pre-configured for a complete joint, use { **Example** ```ts const b = lib.bolt(5, 20); // M5 × 20 mm ```
33
+ - `nut(diameter: number, options?: { pitch?: number; height?: number; acrossFlats?: number; segments?: number; }): Shape` — ISO-style hex nut with a threaded bore. **Details** Constructed from the intersection of three rotated slabs with a cylindrical bore subtracted. The nut is centered at the origin, height along Z. Default proportions follow ISO 4032 loosely: height ≈ 0.8×diameter, across-flats ≈ 1.6×diameter. The bore is a clearance bore (not modelled with helical threads) for rendering efficiency. For standard M-size nuts pre-configured for a complete joint, use { **Example** ```ts const n = lib.nut(5); // M5 nut ```
34
+ - `washer(size: MetricSize, options?: { standard?: WasherStandard; segments?: number; }): Shape` — ISO metric flat washer (DIN 125-A). **Details** Returns a flat ring centered at the origin, thickness along Z. Dimensions are taken from { **Example** ```ts const w = lib.washer('M5'); // DIN 125-A M5 washer ```
35
+ - `fastenerSet(size: MetricSize, boltLength: number, options?: FastenerSetOptions): FastenerSetResult` — Complete ISO metric fastener set — bolt, nut, optional washers, and matching hole cutters. **Details** Returns all geometry for one bolted joint: the bolt, nut, up to two washers, a clearance-hole cutter, and a tap-drill cutter. All shapes are returned **un-positioned** (each on the Z-axis). Place them with `.translate()`. Sizes outside M4–M10 are supported for the washer (M2–M10); unsupported combinations will throw. **Example** ```ts const hw = lib.fastenerSet('M5', 20); const topPlate = box(60, 40, 8, true) .subtract(hw.clearanceHole.translate(15, 10, 0)); const botPlate = box(60, 40, 8, true).translate(0, 0, -16) .subtract(hw.tappedHole.translate(15, 10, -8)); return [ { name: 'Top Plate', shape: topPlate }, { name: 'Bot Plate', shape: botPlate }, { name: 'Bolt', shape: hw.bolt.translate(15, 10, 4) }, { name: 'Nut', shape: hw.nut.translate(15, 10, -19) }, ]; ```
36
+ - `pipeRoute(points: [ number` — Route a pipe (solid or hollow) through 3D waypoints with smooth bends. Each interior waypoint gets a torus-section bend. Straight segments connect them. Returns a single unioned Shape.
37
+ - `elbow(pipeRadius: number, bendRadius: number, angle?: number | { ... }, options?: { ... }): Shape` — Pipe elbow — a curved pipe section (torus arc) for connecting two pipe directions. By default creates a bend in the XZ plane: incoming along +Z, outgoing rotated by `angle`. The bend starts at the origin, curving away from it.
38
+ - `tSlotProfile(options?: TSlotProfileOptions): Sketch` — Build a 2D T-slot cross-section sketch. Default parameters describe a 20x20 B-type profile with slot 6. Use this when you want a drawing-ready profile sketch before extrusion.
39
+ - `tSlotExtrusion(length: number, options?: TSlotExtrusionOptions): Shape` — Build a T-slot extrusion from the generated 2D profile. Extrudes along +Z by default.
40
+ - `profile2020BSlot6Profile(options?: Profile2020BSlot6ProfileOptions): Sketch` — Accurate-ish 2D profile for 20x20 B-type slot 6. Returns a drawing-ready Sketch centered at origin.
41
+ - `profile2020BSlot6(length: number, options?: Profile2020BSlot6Options): Shape` — 20x20 B-type slot 6 extrusion with profile-accurate defaults. Pass option overrides if your supplier's profile differs slightly.
42
+ - `spurGear(options: SpurGearOptions): Shape` — Involute external spur gear with optional center bore. Specify module, teeth, faceWidth as required parameters. Optional tuning includes pressureAngleDeg (default 20), backlash, clearance, addendum, dedendum, boreDiameter, and segmentsPerTooth (default 10). **Connectors (for assembly-based positioning):** - `bore`: revolute connector at the bore center, axis along +Z. Carries measurements: `{ module, teeth, pitchRadius, outerRadius, faceWidth }`. Use `.connect("Housing.seat", "Gear.bore")` to mount a gear on a shaft seat.
43
+ - `bevelGear(options: BevelGearOptions): Shape` — Conical bevel gear generated from a tapered involute extrusion. Specify pitchAngleDeg directly or derive it from mateTeeth + shaftAngleDeg. **Connectors (for assembly-based positioning):** - `bore`: revolute connector at the large-end bore center (Z=0), axis along -Z (away from teeth). - `apex`: connector at the cone apex above the gear (the point where the pitch cone converges), axis along +Z. Useful for meshing two bevel gears — their apices should coincide. Carries measurements: `{ module, teeth, pitchRadius, pitchAngleDeg, coneDistance, faceWidth }`.
44
+ - `faceGear(options: FaceGearOptions): Shape` — Face gear (crown style) where teeth are on one face (top or bottom) instead of the outer rim. Uses the same involute tooth sizing as spurGear, then projects the tooth band axially from one side. Alias for sideGear (which is kept for backward compatibility).
45
+ - `sideGear(options: SideGearOptions): Shape` — Crown/face style gear where the teeth project from one side of the disk instead of the outer cylindrical rim.
46
+ - `ringGear(options: RingGearOptions): Shape` — Internal ring gear with involute-derived tooth spaces. Specify rimWidth or outerDiameter for the annular body. **Connectors (for assembly-based positioning):** - `bore`: connector at the ring center, axis along +Z. For planetary gearboxes, this is where the ring mounts to the housing. Carries measurements: `{ module, teeth, pitchRadius, innerRadius, outerRadius, faceWidth }`.
47
+ - `rackGear(options: RackGearOptions): Shape` — Linear rack gear with pressure-angle flanks. Use with spurGear for rack-and-pinion mechanisms. **Orientation:** teeth run along the X axis with tooth tips pointing +Y (pitch line at Y=0). The rack is extruded +Z by `faceWidth`. Rotate the rack to align with a different slide axis. **Connectors (for assembly-based positioning):** - `teeth`: prismatic connector at the pitch line center, axis along +X (slide direction). Carries measurements: `{ module, teeth, faceWidth, length }`. Connect to a housing's rack channel: ```js housing.withConnectors({ rack_channel: connector("rack-channel", { origin: [pitchR, 0, channelZ], axis: [1, 0, 0], kind: "prismatic", }), }); assembly.connect("Housing.rack_channel", "Rack.teeth", { as: "slide" }); ```
48
+ - `gearPair(options: GearPairOptions): GearPairResult` — Build or validate a spur-gear pair and return ratio, backlash, and mesh diagnostics. Accepts either shapes from spurGear() or analytical specs for each member. When place is true (default), the gear is auto-positioned at the correct center distance.
49
+ - `bevelGearPair(options: BevelGearPairOptions): BevelGearPairResult` — Build or validate a bevel-gear pair and return ratio diagnostics plus recommended joint placement vectors.
50
+ - `faceGearPair(options: FaceGearPairOptions): FaceGearPairResult` — Build or validate a perpendicular pair between a face gear and a vertical spur gear.
51
+ - `sideGearPair(options: SideGearPairOptions): SideGearPairResult` — Pair helper for side (crown/face) gear + perpendicular "vertical" spur gear. Auto-placement rotates the spur around +Y and positions it to mesh at the side tooth band.
52
+ - `gearRatio(teethA: number, teethB: number, options?: { internal?: boolean; }): number` — Coupling ratio between two meshed spur gears. When gear A turns 1°, gear B turns `-teethA / teethB` degrees (negative because meshed external gears rotate in opposite directions). ```js assembly.addJointCoupling("B_spin", { terms: [{ joint: "A_spin", ratio: lib.gearRatio(12, 24) }], // -0.5 }); ``` Pass `{ internal: true }` for internal gear pairs (ring gear + spur/planet), where the two rotate in the same direction.
53
+ - `rackRatio(module: number, pinionTeeth: number): number` — Coupling ratio between a pinion and a rack. When the pinion rotates by `θ` degrees, the rack slides by `θ × (π × module × teeth / 360)` mm. Equivalently, 1mm of rack travel = `180 / (π × pitchRadius)` degrees of pinion rotation. ```js // Pinion spin driven by rack slide: assembly.addJointCoupling("pinion_spin", { terms: [{ joint: "rack_slide", ratio: lib.rackRatio(1.5, 12) }], // ~6.37 deg/mm }); ```
54
+ - `planetaryRatio(sunTeeth: number, ringTeeth: number): number` — Planetary gear reduction ratio when the ring is held fixed. Input: sun. Output: carrier. Ratio: `1 + ringTeeth / sunTeeth`. One turn of the sun produces `1 / ratio` turns of the carrier.
55
+ - `boltPattern(options: BoltPatternOptions): BoltPattern` — Define a bolt pattern once and cut it from multiple parts. ```js const bolts = lib.boltPattern({ size: 'M5', positions: [[20, 15], [-20, 15], [20, -15], [-20, -15]], }); const base = bolts.cut(box(60, 50, 10), 12, { from: -1 }); const cover = bolts.cut(box(60, 50, 3), 5, { from: -1 }); // Same positions in both parts — guaranteed aligned. ```