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,43 +5,25 @@ description: ForgeCAD development skill — model authoring plus compiler intern
5
5
 
6
6
  # ForgeCAD
7
7
 
8
- Author or modify ForgeCAD models, sketches, assemblies, notebooks, and CLI workflows. Prefer documented primitives, import rules, placement strategies, and CLI commands over inventing new APIs.
8
+ Author or modify ForgeCAD models, sketches, assemblies, and CLI workflows. Prefer documented primitives, import rules, placement strategies, and CLI commands over inventing new APIs.
9
9
 
10
10
  ## Workflow
11
11
 
12
- 1. Identify the artifact: `.forge.js`, `.forge-notebook.json`, SVG asset, or CLI/export task.
13
- 2. Load only the docs the task needs (see Source Map below). Start from the top group, add others as needed.
14
- 3. Default to a concrete first pass easy iteration beats speculative design review.
15
- 4. If an existing model is broken, replace the weak structure rather than preserving bad architecture.
16
- 5. Validate with `forgecad run <file>` (add `--debug-imports` for import chain issues). This works for notebook preview cells too.
17
- 6. For `jointsView()` animations, keep wrapped revolute tracks continuous across branch cuts; do not assume the viewport will auto-fix `-180/180` jumps.
12
+ 1. Identify the artifact: `.forge.js`, SVG asset, or CLI/export task.
13
+ 2. **If the model has any moving parts, load the `assembly` group AND the `joint-design.md` recipe upfront** do not defer the kinematic structure to a refactor pass.
14
+ 3. Load only the docs the task needs (see Source Map below). Start from the top group, add others as needed.
15
+ 4. Default to a concrete first pass easy iteration beats speculative design review.
16
+ 5. If an existing model is broken, replace the weak structure rather than preserving bad architecture.
17
+ 6. Validate with `forgecad run <file>` (add `--debug-imports` for import chain issues).
18
+ 7. For `jointsView()` animations, keep wrapped revolute tracks continuous across branch cuts; do not assume the viewport will auto-fix `-180/180` jumps.
18
19
 
19
20
  ### Import and Composition
20
21
 
21
22
  - `require("./file.forge.js", { Param: value })` for any model file, with optional param overrides.
22
23
  - `importSvgSketch()` for SVG files (file format loader, not a module import).
23
- - `.withReferences()` + `.placeReference()` for reusable placement.
24
+ - `.placeReference('bottom', [0,0,0])` to align any built-in anchor to a world coordinate; also works with custom `.withReferences()`.
24
25
  - Plain `.js` modules for shared helpers/constants (not model imports).
25
26
 
26
- ### Notebooks
27
-
28
- Use `.forge-notebook.json` for stateful iteration and debugging. Cells share state, `show()` pins visible geometry, and the preview cell can be validated or rendered directly from the CLI.
29
-
30
- Prefer notebooks when:
31
-
32
- - the task is exploratory or the geometry strategy is still unclear
33
- - you are debugging booleans, placements, or assembly kinematics
34
- - you want to inspect intermediate shapes or sketches without rewriting the whole file
35
-
36
- Useful notebook loop:
37
-
38
- - keep stable setup in early cells and the current experiment in the preview cell
39
- - use `show(...)` for intermediate geometry you want pinned in the viewport
40
- - use `forgecad notebook view <file> preview` to inspect the notebook from the terminal
41
- - use `forgecad run <file>.forge-notebook.json` for preview-cell validation and spatial analysis
42
- - use `forgecad render <file>.forge-notebook.json` or `forgecad capture gif <file>.forge-notebook.json --list` to inspect the preview cell through the CLI
43
- - export to `.forge.js` when the exploratory phase is over and the structure is ready to stabilize
44
-
45
27
  ## Source Map
46
28
 
47
29
  Load groups top-to-bottom, stopping when you have what the task needs.
@@ -50,19 +32,9 @@ Load groups top-to-bottom, stopping when you have what the task needs.
50
32
 
51
33
  Execution model, colors, coordinate system, primitives, booleans, patterns, imports, parameters, topology, edge queries.
52
34
 
53
- - `{{SKILL_DIR}}/docs/API/core/reserved-terms.md`
54
35
  - `{{SKILL_DIR}}/docs/API/core/concepts.md`
55
- - `{{SKILL_DIR}}/docs/API/core/parameters.md`
56
- - `{{SKILL_DIR}}/docs/API/core/topology.md`
57
- - `{{SKILL_DIR}}/docs/API/core/edge-queries.md`
58
36
  - `{{SKILL_DIR}}/docs/generated/core.md`
59
37
 
60
- ### 1b. SDF Modeling (when using smooth booleans, TPMS, deformations, or fromFunction)
61
-
62
- Primitives, smooth booleans, TPMS lattices, twist/bend/displace, morph, custom functions, gotchas.
63
-
64
- - `{{SKILL_DIR}}/docs/API/core/sdf.md`
65
-
66
38
  ### 2. Geometry and Positioning (when placement/orientation matters)
67
39
 
68
40
  Axis conventions, winding rules, and placement strategy.
@@ -71,21 +43,10 @@ Axis conventions, winding rules, and placement strategy.
71
43
  - `{{SKILL_DIR}}/docs/guides/geometry-conventions.md`
72
44
  - `{{SKILL_DIR}}/docs/guides/positioning.md`
73
45
 
74
- ### 3. Sketch APIs (when the task is sketch-heavy)
46
+ ### 3. Sketch APIs
75
47
 
76
48
  2D construction, transforms, booleans, paths, on-face sketching, extrusion, anchors, text, regions.
77
49
 
78
- - `{{SKILL_DIR}}/docs/API/sketch/core.md`
79
- - `{{SKILL_DIR}}/docs/API/sketch/primitives.md`
80
- - `{{SKILL_DIR}}/docs/API/sketch/path.md`
81
- - `{{SKILL_DIR}}/docs/API/sketch/transforms.md`
82
- - `{{SKILL_DIR}}/docs/API/sketch/booleans.md`
83
- - `{{SKILL_DIR}}/docs/API/sketch/operations.md`
84
- - `{{SKILL_DIR}}/docs/API/sketch/on-face.md`
85
- - `{{SKILL_DIR}}/docs/API/sketch/extrude.md`
86
- - `{{SKILL_DIR}}/docs/API/sketch/anchor.md`
87
- - `{{SKILL_DIR}}/docs/API/sketch/text.md`
88
- - `{{SKILL_DIR}}/docs/API/sketch/regions.md`
89
50
  - `{{SKILL_DIR}}/docs/generated/sketch.md`
90
51
 
91
52
  ### 4. Curves and Surfacing (for lofts, sweeps, splines)
@@ -98,38 +59,31 @@ Smooth curves, Hermite splines, lofted and swept solids.
98
59
 
99
60
  Assembly graph, joint types, couplings, validation, robot export.
100
61
 
101
- - `{{SKILL_DIR}}/docs/API/assembly/assembly.md`
102
62
  - `{{SKILL_DIR}}/docs/generated/assembly.md`
103
63
 
104
64
  ### 6. Sheet Metal (for bent parts, K-factor, flat patterns)
105
65
 
106
66
  Bend operations, flat pattern unfolding, K-factor configuration.
107
67
 
108
- - `{{SKILL_DIR}}/docs/API/sheet-metal/sheet-metal.md`
109
68
  - `{{SKILL_DIR}}/docs/generated/sheet-metal.md`
110
69
 
111
70
  ### 7. Output and Export (for STL/3MF/STEP, BOM, dimensions)
112
71
 
113
72
  Mesh export, exact geometry export, bill of materials, dimension annotations.
114
73
 
115
- - `{{SKILL_DIR}}/docs/API/output/export.md`
116
- - `{{SKILL_DIR}}/docs/API/output/brep-export.md`
117
- - `{{SKILL_DIR}}/docs/API/output/bom.md`
118
- - `{{SKILL_DIR}}/docs/API/output/dimensions.md`
119
74
  - `{{SKILL_DIR}}/docs/generated/output.md`
120
75
 
121
76
  ### 8. Toolbox (fasteners and standard parts)
122
77
 
123
78
  Parametric bolts, nuts, washers, standard hardware, gears, pipes, and structural profiles.
124
79
 
125
- - `{{SKILL_DIR}}/docs/API/toolbox/fasteners.md`
126
80
  - `{{SKILL_DIR}}/docs/generated/lib.md`
81
+ - `{{SKILL_DIR}}/docs/generated/wood.md`
127
82
 
128
83
  ### 9. Runtime Viewport APIs (for cut planes, jointsView, and animation playback)
129
84
 
130
85
  Viewer-only APIs such as cutPlane, explodeView, jointsView, and animation behavior.
131
86
 
132
- - `{{SKILL_DIR}}/docs/API/runtime/viewport.md`
133
87
  - `{{SKILL_DIR}}/docs/generated/viewport.md`
134
88
 
135
89
  ### 10. Recipes and Debugging (for patterns and troubleshooting)
@@ -137,18 +91,26 @@ Viewer-only APIs such as cutPlane, explodeView, jointsView, and animation behavi
137
91
  Modeling patterns, debugging tactics, copyable snippets.
138
92
 
139
93
  - `{{SKILL_DIR}}/docs/guides/modeling-recipes.md`
94
+ - `{{SKILL_DIR}}/docs/guides/joint-design.md`
140
95
 
141
96
  ### 11. CLI (for validation/render/export tasks)
142
97
 
143
- Test-run, notebook execution, export pipelines, debug flags.
98
+ Test-run, export pipelines, debug flags.
144
99
 
145
100
  - `{{SKILL_DIR}}/docs/CLI.md`
146
101
 
102
+ ### SDF Modeling — Experimental (smooth booleans, TPMS, deformations, fromFunction)
103
+
104
+ Primitives, smooth booleans, TPMS lattices, twist/bend/displace, morph, custom functions, gotchas. Experimental — slower render, lower mesh quality than B-rep.
105
+
106
+ - `{{SKILL_DIR}}/docs/generated/sdf.md`
107
+
147
108
  ### 12. Internals — Compiler & Geometry Pipeline (for ForgeCAD developers)
148
109
 
149
110
  Semantic feature graphs, lowering strategy, compile plans. Read when working on the compiler or geometry backends.
150
111
 
151
112
  - `{{SKILL_DIR}}/docs/internals/compiler.md`
113
+ - `{{SKILL_DIR}}/docs/internals/sketch-2d-pipeline.md`
152
114
 
153
115
  ### 13. Internals — Constraint Solver (for solver work)
154
116
 
@@ -157,20 +119,14 @@ Solver architecture, phases, Gauss-Seidel/Newton-Raphson, quality tuning.
157
119
  - `{{SKILL_DIR}}/docs/internals/constraint-solver.md`
158
120
  - `{{SKILL_DIR}}/docs/internals/constraint-solver-quality.md`
159
121
 
160
- ### 14. Internals — Sketch 2D Pipeline
161
-
162
- 2D sketch pipeline stages, constraint evaluation, winding enforcement.
163
-
164
- - `{{SKILL_DIR}}/docs/internals/sketch-2d-pipeline.md`
165
-
166
122
  ### 15. Project Conventions (coding standards, releases)
167
123
 
168
124
  Coding best practices, PR guidelines, release checklist, deployment.
169
125
 
170
126
  - `{{SKILL_DIR}}/docs/coding-best-practices.md`
171
127
  - `{{SKILL_DIR}}/docs/coding.md`
172
- - `{{SKILL_DIR}}/docs/deployment.md`
173
- - `{{SKILL_DIR}}/docs/RELEASING.md`
128
+ - `{{SKILL_DIR}}/docs/blueprint-first.md`
129
+ - `{{SKILL_DIR}}/docs/component-model.md`
174
130
 
175
131
  ### 16. Skill System Maintenance
176
132
 
@@ -1,47 +1,29 @@
1
1
  ---
2
2
  name: forgecad
3
- description: ForgeCAD model authoring, editing, debugging, and execution guidance for .forge.js, .forge-notebook.json, SVG-import, assembly, and CLI workflows. Use when building or modifying ForgeCAD geometry, structuring multi-file projects, running notebook cells, validating scripts, or using ForgeCAD export/render tooling.
3
+ description: ForgeCAD model authoring, editing, debugging, and execution guidance for .forge.js, SVG-import, assembly, and CLI workflows. Use when building or modifying ForgeCAD geometry, structuring multi-file projects, validating scripts, or using ForgeCAD export/render tooling.
4
4
  ---
5
5
 
6
6
  # ForgeCAD
7
7
 
8
- Author or modify ForgeCAD models, sketches, assemblies, notebooks, and CLI workflows. Prefer documented primitives, import rules, placement strategies, and CLI commands over inventing new APIs.
8
+ Author or modify ForgeCAD models, sketches, assemblies, and CLI workflows. Prefer documented primitives, import rules, placement strategies, and CLI commands over inventing new APIs.
9
9
 
10
10
  ## Workflow
11
11
 
12
- 1. Identify the artifact: `.forge.js`, `.forge-notebook.json`, SVG asset, or CLI/export task.
13
- 2. Load only the docs the task needs (see Source Map below). Start from the top group, add others as needed.
14
- 3. Default to a concrete first pass easy iteration beats speculative design review.
15
- 4. If an existing model is broken, replace the weak structure rather than preserving bad architecture.
16
- 5. Validate with `forgecad run <file>` (add `--debug-imports` for import chain issues). This works for notebook preview cells too.
17
- 6. For `jointsView()` animations, keep wrapped revolute tracks continuous across branch cuts; do not assume the viewport will auto-fix `-180/180` jumps.
12
+ 1. Identify the artifact: `.forge.js`, SVG asset, or CLI/export task.
13
+ 2. **If the model has any moving parts, load the `assembly` group AND the `joint-design.md` recipe upfront** do not defer the kinematic structure to a refactor pass.
14
+ 3. Load only the docs the task needs (see Source Map below). Start from the top group, add others as needed.
15
+ 4. Default to a concrete first pass easy iteration beats speculative design review.
16
+ 5. If an existing model is broken, replace the weak structure rather than preserving bad architecture.
17
+ 6. Validate with `forgecad run <file>` (add `--debug-imports` for import chain issues).
18
+ 7. For `jointsView()` animations, keep wrapped revolute tracks continuous across branch cuts; do not assume the viewport will auto-fix `-180/180` jumps.
18
19
 
19
20
  ### Import and Composition
20
21
 
21
22
  - `require("./file.forge.js", { Param: value })` for any model file, with optional param overrides.
22
23
  - `importSvgSketch()` for SVG files (file format loader, not a module import).
23
- - `.withReferences()` + `.placeReference()` for reusable placement.
24
+ - `.placeReference('bottom', [0,0,0])` to align any built-in anchor to a world coordinate; also works with custom `.withReferences()`.
24
25
  - Plain `.js` modules for shared helpers/constants (not model imports).
25
26
 
26
- ### Notebooks
27
-
28
- Use `.forge-notebook.json` for stateful iteration and debugging. Cells share state, `show()` pins visible geometry, and the preview cell can be validated or rendered directly from the CLI.
29
-
30
- Prefer notebooks when:
31
-
32
- - the task is exploratory or the geometry strategy is still unclear
33
- - you are debugging booleans, placements, or assembly kinematics
34
- - you want to inspect intermediate shapes or sketches without rewriting the whole file
35
-
36
- Useful notebook loop:
37
-
38
- - keep stable setup in early cells and the current experiment in the preview cell
39
- - use `show(...)` for intermediate geometry you want pinned in the viewport
40
- - use `forgecad notebook view <file> preview` to inspect the notebook from the terminal
41
- - use `forgecad run <file>.forge-notebook.json` for preview-cell validation and spatial analysis
42
- - use `forgecad render <file>.forge-notebook.json` or `forgecad capture gif <file>.forge-notebook.json --list` to inspect the preview cell through the CLI
43
- - export to `.forge.js` when the exploratory phase is over and the structure is ready to stabilize
44
-
45
27
  ## Source Map
46
28
 
47
29
  Load groups top-to-bottom, stopping when you have what the task needs.
@@ -50,19 +32,9 @@ Load groups top-to-bottom, stopping when you have what the task needs.
50
32
 
51
33
  Execution model, colors, coordinate system, primitives, booleans, patterns, imports, parameters, topology, edge queries.
52
34
 
53
- - `{{SKILL_DIR}}/docs/API/core/reserved-terms.md`
54
35
  - `{{SKILL_DIR}}/docs/API/core/concepts.md`
55
- - `{{SKILL_DIR}}/docs/API/core/parameters.md`
56
- - `{{SKILL_DIR}}/docs/API/core/topology.md`
57
- - `{{SKILL_DIR}}/docs/API/core/edge-queries.md`
58
36
  - `{{SKILL_DIR}}/docs/generated/core.md`
59
37
 
60
- ### 1b. SDF Modeling (when using smooth booleans, TPMS, deformations, or fromFunction)
61
-
62
- Primitives, smooth booleans, TPMS lattices, twist/bend/displace, morph, custom functions, gotchas.
63
-
64
- - `{{SKILL_DIR}}/docs/API/core/sdf.md`
65
-
66
38
  ### 2. Geometry and Positioning (when placement/orientation matters)
67
39
 
68
40
  Axis conventions, winding rules, and placement strategy.
@@ -71,21 +43,10 @@ Axis conventions, winding rules, and placement strategy.
71
43
  - `{{SKILL_DIR}}/docs/guides/geometry-conventions.md`
72
44
  - `{{SKILL_DIR}}/docs/guides/positioning.md`
73
45
 
74
- ### 3. Sketch APIs (when the task is sketch-heavy)
46
+ ### 3. Sketch APIs
75
47
 
76
48
  2D construction, transforms, booleans, paths, on-face sketching, extrusion, anchors, text, regions.
77
49
 
78
- - `{{SKILL_DIR}}/docs/API/sketch/core.md`
79
- - `{{SKILL_DIR}}/docs/API/sketch/primitives.md`
80
- - `{{SKILL_DIR}}/docs/API/sketch/path.md`
81
- - `{{SKILL_DIR}}/docs/API/sketch/transforms.md`
82
- - `{{SKILL_DIR}}/docs/API/sketch/booleans.md`
83
- - `{{SKILL_DIR}}/docs/API/sketch/operations.md`
84
- - `{{SKILL_DIR}}/docs/API/sketch/on-face.md`
85
- - `{{SKILL_DIR}}/docs/API/sketch/extrude.md`
86
- - `{{SKILL_DIR}}/docs/API/sketch/anchor.md`
87
- - `{{SKILL_DIR}}/docs/API/sketch/text.md`
88
- - `{{SKILL_DIR}}/docs/API/sketch/regions.md`
89
50
  - `{{SKILL_DIR}}/docs/generated/sketch.md`
90
51
 
91
52
  ### 4. Curves and Surfacing (for lofts, sweeps, splines)
@@ -98,38 +59,31 @@ Smooth curves, Hermite splines, lofted and swept solids.
98
59
 
99
60
  Assembly graph, joint types, couplings, validation, robot export.
100
61
 
101
- - `{{SKILL_DIR}}/docs/API/assembly/assembly.md`
102
62
  - `{{SKILL_DIR}}/docs/generated/assembly.md`
103
63
 
104
64
  ### 6. Sheet Metal (for bent parts, K-factor, flat patterns)
105
65
 
106
66
  Bend operations, flat pattern unfolding, K-factor configuration.
107
67
 
108
- - `{{SKILL_DIR}}/docs/API/sheet-metal/sheet-metal.md`
109
68
  - `{{SKILL_DIR}}/docs/generated/sheet-metal.md`
110
69
 
111
70
  ### 7. Output and Export (for STL/3MF/STEP, BOM, dimensions)
112
71
 
113
72
  Mesh export, exact geometry export, bill of materials, dimension annotations.
114
73
 
115
- - `{{SKILL_DIR}}/docs/API/output/export.md`
116
- - `{{SKILL_DIR}}/docs/API/output/brep-export.md`
117
- - `{{SKILL_DIR}}/docs/API/output/bom.md`
118
- - `{{SKILL_DIR}}/docs/API/output/dimensions.md`
119
74
  - `{{SKILL_DIR}}/docs/generated/output.md`
120
75
 
121
76
  ### 8. Toolbox (fasteners and standard parts)
122
77
 
123
78
  Parametric bolts, nuts, washers, standard hardware, gears, pipes, and structural profiles.
124
79
 
125
- - `{{SKILL_DIR}}/docs/API/toolbox/fasteners.md`
126
80
  - `{{SKILL_DIR}}/docs/generated/lib.md`
81
+ - `{{SKILL_DIR}}/docs/generated/wood.md`
127
82
 
128
83
  ### 9. Runtime Viewport APIs (for cut planes, jointsView, and animation playback)
129
84
 
130
85
  Viewer-only APIs such as cutPlane, explodeView, jointsView, and animation behavior.
131
86
 
132
- - `{{SKILL_DIR}}/docs/API/runtime/viewport.md`
133
87
  - `{{SKILL_DIR}}/docs/generated/viewport.md`
134
88
 
135
89
  ### 10. Recipes and Debugging (for patterns and troubleshooting)
@@ -137,10 +91,17 @@ Viewer-only APIs such as cutPlane, explodeView, jointsView, and animation behavi
137
91
  Modeling patterns, debugging tactics, copyable snippets.
138
92
 
139
93
  - `{{SKILL_DIR}}/docs/guides/modeling-recipes.md`
94
+ - `{{SKILL_DIR}}/docs/guides/joint-design.md`
140
95
 
141
96
  ### 11. CLI (for validation/render/export tasks)
142
97
 
143
- Test-run, notebook execution, export pipelines, debug flags.
98
+ Test-run, export pipelines, debug flags.
144
99
 
145
100
  - `{{SKILL_DIR}}/docs/CLI.md`
146
101
 
102
+ ### SDF Modeling — Experimental (smooth booleans, TPMS, deformations, fromFunction)
103
+
104
+ Primitives, smooth booleans, TPMS lattices, twist/bend/displace, morph, custom functions, gotchas. Experimental — slower render, lower mesh quality than B-rep.
105
+
106
+ - `{{SKILL_DIR}}/docs/generated/sdf.md`
107
+
@@ -5,129 +5,74 @@ skill-order: 1
5
5
 
6
6
  # ForgeCAD Core Concepts
7
7
 
8
- ForgeCAD scripts are JavaScript code that returns geometry. The forge API is globally available — no imports needed.
9
-
10
- ## Basic Structure
8
+ ForgeCAD scripts are JavaScript that returns geometry. The forge API is globally available — no imports needed.
11
9
 
12
10
  ```javascript
13
- // 1. Declare parameters (creates UI sliders)
14
11
  const width = param("Width", 50, { min: 20, max: 100, unit: "mm" });
15
-
16
- // 2. Create geometry
17
- const shape = box(width, 30, 10);
18
-
19
- // 3. Return the final shape
20
- return shape;
12
+ return box(width, 30, 10);
21
13
  ```
22
14
 
23
15
  ## Execution Model
24
16
 
25
17
  - Scripts re-execute on every parameter change (400ms debounce)
26
- - All operations are **immutable** — they return new shapes, never modify in place
27
- - Must return one of:
28
- - A `Shape` (3D solid)
29
- - A `Sketch` (2D profile — rendered flat on XY plane)
30
- - A `TrackedShape` (3D solid with named faces/edges — auto-unwrapped)
31
- - A `ShapeGroup` (multiple shapes/sketches grouped for joint transforms)
32
- - An `Array` of shapes/sketches/groups (multi-object scene)
33
- - An `Array` of `{ name, shape?, sketch?, color? }` objects (named multi-object scene)
18
+ - All operations are **immutable** — return new shapes, never modify in place
19
+ - Must return one of: `Shape`, `Sketch`, `ShapeGroup`, `Array` of shapes/sketches/groups, `Array` of `{ name, shape?, sketch?, color? }`, or a **metadata object** (see below)
34
20
 
35
- ## Colors
21
+ ### Metadata Object Return
36
22
 
37
- Both `Shape` and `Sketch` support colors via `.color()`:
23
+ A script can return a plain object whose values include renderable geometry alongside non-renderable metadata. All renderable entries (Shape, Sketch, ShapeGroup, Assembly, or Array of named objects) are rendered; non-renderable entries are silently skipped. This is useful for multi-file projects where a part needs to publish interface data (bolt positions, dimensions) to other files:
38
24
 
39
25
  ```javascript
40
- const red = box(50, 50, 50).color('#ff0000');
41
- const blue = circle2d(25).color('#0066ff');
26
+ // motor-mount.forge.js renders standalone, exports metadata via require()
27
+ const holePositions = [[17, 15], [-29, 15], [17, -15], [-29, -15]];
28
+ return {
29
+ shape: mount.color('#556B2F'), // rendered
30
+ bolts: { dia: 5.3, pos: holePositions }, // metadata — skipped in render, available via require()
31
+ };
32
+
33
+ // base-body.forge.js — imports mount, accesses .bolts
34
+ const mount = require('./motor-mount.forge.js');
35
+ for (const [x, y] of mount.bolts.pos) { ... } // use metadata
36
+ // mount.shape is the Shape if you need it in an assembly
42
37
  ```
43
38
 
44
- Colors are preserved through transforms. In boolean operations the first operand's color wins.
45
-
46
- When returning multiple objects, set color per-object:
39
+ Arrays inside the object are also rendered:
47
40
 
48
41
  ```javascript
49
- return [
50
- { name: "Base", shape: box(100, 100, 5), color: "#888888" },
51
- { name: "Column", shape: cylinder(50, 10).translate(50, 50, 5), color: "#4488cc" },
52
- ];
42
+ return {
43
+ parts: [{ name: 'Left', shape: leftShape }, { name: 'Right', shape: rightShape }],
44
+ armWidth: 6, // metadata
45
+ };
53
46
  ```
54
47
 
55
- ## ⚠️ Unions Remove Colors
48
+ ## Coordinate System
56
49
 
57
- `union()` merges shapes into one solid mesh individual colors are lost:
50
+ Z-up right-handed: X = left/right, Y = forward/back, Z = up/down.
58
51
 
59
- ```javascript
60
- // ❌ BAD: Colors are lost after union
61
- const red = box(30, 30, 30).color('#ff0000');
62
- const blue = box(20, 20, 20).translate(30, 0, 0).color('#0066ff');
63
- return union(red, blue); // Result is all one color
64
- ```
52
+ ## Colors
53
+
54
+ `.color(hex)` works on `Shape` and `Sketch`. Colors survive transforms. In booleans the first operand's color wins.
65
55
 
66
- Return as named objects instead to keep each color:
56
+ **`union()` removes colors** shapes merge into one solid mesh. Return named objects instead:
67
57
 
68
58
  ```javascript
69
- // ✅ GOOD: Each object keeps its color
70
59
  return [
71
- { name: "Red Box", shape: box(30, 30, 30), color: '#ff0000' },
72
- { name: "Blue Box", shape: box(20, 20, 20).translate(30, 0, 0), color: '#0066ff' },
60
+ { name: "Base", shape: box(100, 100, 5), color: "#888888" },
61
+ { name: "Column", shape: cylinder(50, 10).translate(50, 50, 5), color: "#4488cc" },
73
62
  ];
74
63
  ```
75
64
 
76
- ## Coordinate System
77
-
78
- ForgeCAD uses **Z-up** right-handed coordinates:
79
- - **X** = left/right
80
- - **Y** = forward/back
81
- - **Z** = up/down
82
-
83
- See [coordinate-system.md](../guides/coordinate-system.md) for view mapping details.
84
-
85
65
  ## Face Operations
86
66
 
87
- Pocket, boss, and profile operations work on any planar face identified by string name or geometric query.
88
-
89
- ### Face Selection
90
-
91
- ```javascript
92
- // Canonical names (primitives and tracked shapes)
93
- shape.face('top') // topmost upward face
94
- shape.face('front') // front face (-Y normal)
95
-
96
- // Geometric queries (any shape — booleans, imports, complex bodies)
97
- shape.face({ normal: [0, 0, 1], pick: 'largest' }) // largest upward face
98
- shape.face({ normal: [0, 0, 1], nearest: [50, 50] }) // nearest to XY point
99
- shape.faces({ normal: [0, 0, 1] }) // all upward faces (FaceRef[])
100
- ```
101
-
102
- Query properties: `normal`, `nearest`, `at`, `pick` (`'largest'`/`'smallest'`/`'max-z'`/...), `area` (`{ min?, max? }`).
103
-
104
- ### Pocket and Boss
105
-
106
- ```javascript
107
- // Cut a pocket into the top face
108
- box(100, 100, 20).pocket('top', 8, { inset: 5 })
109
-
110
- // Add a boss from the top face
111
- box(100, 100, 20).boss('top', 5, { scale: 0.6 })
112
-
113
- // Target a specific face on a complex body with a query
114
- const body = box(100, 100, 20).pocket('top', 10, { inset: 5 });
115
- body.boss({ normal: [0, 0, 1], pick: 'smallest' }, 5) // boss from pocket floor
116
- ```
117
-
118
- Options: `inset` (shrink boundary, mm), `scale` (uniform scale, e.g. 0.8), `join` (`'Round'`/`'Square'`/`'Miter'`).
67
+ Shapes carry semantic face labels through their lifecycle. The flow is:
119
68
 
120
- ### Face Profile
69
+ 1. **Primitives** assign canonical names — `box()` gives you `top`, `bottom`, `side-left`, etc.; `cylinder()` gives `top`, `bottom`, `side`.
70
+ 2. **Extrusions** inherit labels from the sketch and add `top`/`bottom`.
71
+ 3. **Transforms** (translate, rotate, scale, mirror) preserve all labels.
72
+ 4. **Booleans** preserve labels from the first operand where geometry survives.
121
73
 
122
- Extract a face's 2D boundary as a `Sketch` for manual workflows:
123
-
124
- ```javascript
125
- const profile = faceProfile(box(100, 100, 20), 'top');
126
- const tool = profile.offset(-5).extrude(8); // shrink + extrude manually
127
- ```
74
+ You resolve labels to geometry with `.face(name)` or `.face(query)` see the Shape class docs for the full query API. Operations like `.pocket()`, `.boss()`, `.hole()`, and `faceProfile()` all consume face references.
128
75
 
129
76
  ## SDF Modeling
130
77
 
131
- For organic shapes, smooth blending, TPMS lattices, and surface deformations, ForgeCAD provides a parallel SDF (Signed Distance Field) pipeline via the `sdf` namespace. SDF shapes convert to regular `Shape` objects via `.toShape()`.
132
-
133
- See [sdf.md](sdf.md) for the full reference — primitives, smooth booleans, TPMS, twist/bend/displace, custom functions, and workflow tips.
78
+ For organic shapes, smooth blending, TPMS lattices, and surface deformations. SDF shapes convert via `.toShape()`. See [sdf-primitives.md](sdf-primitives.md).