forgecad 0.7.0 → 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 (158) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{AdminPage-DAu1C1ST.js → AdminPage-D4bocK4E.js} +1 -1
  3. package/dist/assets/{DocsPage-Gc_BCdqC.js → DocsPage-D3A_g8V3.js} +85 -45
  4. package/dist/assets/{EditorApp-DG1-oUSV.css → EditorApp-BWYUSpUN.css} +133 -51
  5. package/dist/assets/EditorApp-Cihhqcsq.js +11692 -0
  6. package/dist/assets/{EmbedViewer-CEO8XbV8.js → EmbedViewer-kWjKaC_t.js} +1 -1
  7. package/dist/assets/LandingPageProofDriven-Bg2IUc3l.css +856 -0
  8. package/dist/assets/LandingPageProofDriven-DXkKlyhI.js +601 -0
  9. package/dist/assets/{PricingPage-BSrxu6d7.js → PricingPage-BsU5vzEx.js} +1 -1
  10. package/dist/assets/{SettingsPage-FUCSIRq6.js → SettingsPage-PqvpAKIs.js} +1 -1
  11. package/dist/assets/{evalWorker-KoR0SNKq.js → evalWorker-C-hzNUMy.js} +2218 -286
  12. package/dist/assets/{index-wTEK39at.js → index-Pz321YAt.js} +7416 -1481
  13. package/dist/assets/{index-CyVd1D4D.css → index-ay13WNfa.css} +501 -2
  14. package/dist/assets/{manifold-B1sGWdYk.js → manifold-BcbjWLIo.js} +3 -3
  15. package/dist/assets/{manifold-D7o0N50J.js → manifold-DBckbFgx.js} +1 -1
  16. package/dist/assets/{manifold-G5sBaXzi.js → manifold-O2AAGXyj.js} +1 -1
  17. package/dist/assets/{reportWorker-DYcRHhv9.js → reportWorker-Dxr-5A7w.js} +2003 -259
  18. package/dist/docs/index.html +2 -2
  19. package/dist/docs-raw/CLI.md +488 -0
  20. package/dist/docs-raw/generated/assembly.md +19 -11
  21. package/dist/docs-raw/generated/concepts.md +1023 -360
  22. package/dist/docs-raw/generated/core.md +1165 -264
  23. package/dist/docs-raw/generated/curves.md +168 -1
  24. package/dist/docs-raw/generated/lib.md +10 -5
  25. package/dist/docs-raw/generated/output.md +1 -1
  26. package/dist/docs-raw/generated/sdf.md +208 -0
  27. package/dist/docs-raw/generated/sketch.md +1281 -329
  28. package/dist/docs-raw/generated/viewport.md +29 -2
  29. package/dist/index.html +2 -2
  30. package/dist/landing/proof-ams-adapter.png +0 -0
  31. package/dist/landing/proof-bolt-and-nut.png +0 -0
  32. package/dist/landing/proof-fillet-enclosure.png +0 -0
  33. package/dist/landing/proof-glasses.png +0 -0
  34. package/dist/landing/proof-gyroid.png +0 -0
  35. package/dist/sitemap.xml +6 -6
  36. package/dist-cli/forgecad.js +3148 -555
  37. package/dist-cli/forgecad.js.map +1 -1
  38. package/dist-cli/{solver-FV7TJZGI.js → solver-46FFSK2U.js} +1 -3
  39. package/dist-cli/{solver-FV7TJZGI.js.map → solver-46FFSK2U.js.map} +1 -1
  40. package/dist-skill/CONTEXT.md +3700 -1153
  41. package/dist-skill/SKILL-dev.md +15 -17
  42. package/dist-skill/SKILL.md +14 -9
  43. package/dist-skill/docs/API/core/concepts.md +28 -1
  44. package/dist-skill/docs/CLI.md +488 -0
  45. package/dist-skill/docs/generated/assembly.md +19 -11
  46. package/dist-skill/docs/generated/core.md +1165 -264
  47. package/dist-skill/docs/generated/curves.md +168 -1
  48. package/dist-skill/docs/generated/lib.md +10 -5
  49. package/dist-skill/docs/generated/output.md +1 -1
  50. package/dist-skill/docs/generated/sdf.md +208 -0
  51. package/dist-skill/docs/generated/sketch.md +1281 -329
  52. package/dist-skill/docs/generated/viewport.md +29 -2
  53. package/dist-skill/docs/guides/joint-design.md +78 -0
  54. package/dist-skill/docs-dev/API/core/concepts.md +28 -1
  55. package/dist-skill/docs-dev/CLI.md +488 -0
  56. package/dist-skill/docs-dev/coding.md +1 -1
  57. package/dist-skill/docs-dev/component-model.md +164 -0
  58. package/dist-skill/docs-dev/generated/assembly.md +19 -11
  59. package/dist-skill/docs-dev/generated/core.md +1165 -264
  60. package/dist-skill/docs-dev/generated/curves.md +168 -1
  61. package/dist-skill/docs-dev/generated/lib.md +10 -5
  62. package/dist-skill/docs-dev/generated/output.md +1 -1
  63. package/dist-skill/docs-dev/generated/sdf.md +208 -0
  64. package/dist-skill/docs-dev/generated/sketch.md +1281 -329
  65. package/dist-skill/docs-dev/generated/viewport.md +29 -2
  66. package/dist-skill/docs-dev/guides/joint-design.md +78 -0
  67. package/examples/api/attachTo-basics.forge.js +3 -3
  68. package/examples/api/bill-of-materials.forge.js +9 -9
  69. package/examples/api/bolt-pattern.forge.js +5 -5
  70. package/examples/api/boolean-operations.forge.js +2 -2
  71. package/examples/api/bounding-box-visualizer.forge.js +1 -1
  72. package/examples/api/clone-duplicate.forge.js +1 -1
  73. package/examples/api/connector-assembly.forge.js +4 -2
  74. package/examples/api/connector-basics.forge.js +5 -5
  75. package/examples/api/constrained-sketch-mechanical.forge.js +4 -4
  76. package/examples/api/elbow-test.forge.js +3 -3
  77. package/examples/api/extrude-options.forge.js +4 -4
  78. package/examples/api/fillet-showcase.forge.js +1 -1
  79. package/examples/api/gears-tier1.forge.js +5 -5
  80. package/examples/api/group-test.forge.js +2 -2
  81. package/examples/api/mesh-import-slats.forge.js +3 -3
  82. package/examples/api/patterns.forge.js +3 -3
  83. package/examples/api/pointAlong-orientation.forge.js +2 -2
  84. package/examples/api/profile-2020-b-slot6.forge.js +4 -4
  85. package/examples/api/sketch-rounding-strategies.forge.js +1 -1
  86. package/examples/api/smooth-curve-connections.forge.js +1 -1
  87. package/examples/api/transition-curves.forge.js +3 -3
  88. package/examples/constraints/01-fully-constrained-rect.forge.js +2 -2
  89. package/examples/constraints/02-underconstrained-triangle.forge.js +1 -1
  90. package/examples/constraints/03-redundant-constraints.forge.js +2 -2
  91. package/examples/constraints/05-parallel-with-linedistance.forge.js +2 -2
  92. package/examples/constraints/06-complex-spectrogram.forge.js +1 -1
  93. package/examples/constraints/07-perpendicular-chain.forge.js +4 -4
  94. package/examples/constraints/08-symmetric-bracket.forge.js +4 -4
  95. package/examples/constraints/09-stress-spiral.forge.js +1 -1
  96. package/examples/constraints/10-stress-honeycomb.forge.js +1 -1
  97. package/examples/constraints/11-surface-grid.forge.js +2 -2
  98. package/examples/constraints/12-surface-nested.forge.js +4 -4
  99. package/examples/constraints/13-surface-complex.forge.js +1 -1
  100. package/examples/exact-arc-housing.forge.js +12 -0
  101. package/examples/furniture/adjustable-table.forge.js +13 -13
  102. package/examples/furniture/bathroom.forge.js +15 -15
  103. package/examples/furniture/chair.forge.js +12 -12
  104. package/examples/furniture/picture-frame.forge.js +6 -6
  105. package/examples/furniture/shoe-rack-doors.forge.js +8 -8
  106. package/examples/furniture/shoe-rack.forge.js +7 -7
  107. package/examples/furniture/table-lamp.forge.js +8 -8
  108. package/examples/gcode/lissajous-vase.forge.js +4 -4
  109. package/examples/gcode/math-surface.forge.js +3 -3
  110. package/examples/gcode/parametric-vase.forge.js +4 -4
  111. package/examples/gcode/spiral-tower.forge.js +4 -4
  112. package/examples/generative/crystal-growth.forge.js +7 -7
  113. package/examples/generative/frost-spires.forge.js +6 -6
  114. package/examples/generative/golden-spiral-tower.forge.js +8 -8
  115. package/examples/generative/molten-forge.forge.js +6 -6
  116. package/examples/generative/neon-coral.forge.js +7 -7
  117. package/examples/mechanical/3d-printer.forge.js +9 -9
  118. package/examples/mechanical/5-finger-robot-hand.forge.js +4 -4
  119. package/examples/mechanical/airplane-propeller.forge.js +7 -7
  120. package/examples/mechanical/bolt-and-nut.forge.js +10 -10
  121. package/examples/mechanical/door-with-hinges.forge.js +7 -7
  122. package/examples/mechanical/fillet-enclosure.forge.js +14 -10
  123. package/examples/mechanical/headphone-hanger-v2.forge.js +9 -9
  124. package/examples/mechanical/robot_hand.forge.js +10 -10
  125. package/examples/mechanical/robot_hand_2.forge.js +17 -17
  126. package/examples/nurbs-surface.forge.js +8 -0
  127. package/examples/nurbs-tube.forge.js +7 -0
  128. package/examples/products/bottle.forge.js +7 -7
  129. package/examples/products/chess-set.forge.js +6 -6
  130. package/examples/products/classical-piano.forge.js +9 -9
  131. package/examples/products/clock.forge.js +21 -21
  132. package/examples/products/cup.forge.js +5 -5
  133. package/examples/products/iphone.forge.js +12 -12
  134. package/examples/products/laptop.forge.js +9 -9
  135. package/examples/products/laser-cut-box.forge.js +6 -6
  136. package/examples/products/laser-cut-tray.forge.js +6 -6
  137. package/examples/products/liquid-soap-dispenser.forge.js +5 -5
  138. package/examples/products/origami-fish.forge.js +6 -6
  139. package/examples/products/spiderman-cake.forge.js +2 -2
  140. package/examples/shelf/container.forge.js +5 -5
  141. package/examples/shelf/shelf-unit.forge.js +6 -6
  142. package/examples/toolbox/bolted-joint.forge.js +5 -5
  143. package/package.json +3 -1
  144. package/dist/assets/EditorApp-D9bJvtf7.js +0 -11338
  145. package/dist/assets/LandingPage-CdCuEOdC.js +0 -451
  146. package/dist-cli/chunk-PZ5AY32C.js +0 -10
  147. package/dist-cli/chunk-PZ5AY32C.js.map +0 -1
  148. package/dist-skill/docs/CLI/export.md +0 -91
  149. package/dist-skill/docs/CLI/projects.md +0 -107
  150. package/dist-skill/docs/CLI/studio_publishing.md +0 -52
  151. package/dist-skill/docs/CLI/validation.md +0 -66
  152. package/dist-skill/docs-dev/API/core/sdf-advanced.md +0 -92
  153. package/dist-skill/docs-dev/API/core/sdf-primitives.md +0 -58
  154. package/dist-skill/docs-dev/API/core/sdf-workflow.md +0 -42
  155. package/dist-skill/docs-dev/CLI/export.md +0 -91
  156. package/dist-skill/docs-dev/CLI/projects.md +0 -107
  157. package/dist-skill/docs-dev/CLI/studio_publishing.md +0 -52
  158. package/dist-skill/docs-dev/CLI/validation.md +0 -66
@@ -10,11 +10,12 @@ Author or modify ForgeCAD models, sketches, assemblies, and CLI workflows. Prefe
10
10
  ## Workflow
11
11
 
12
12
  1. Identify the artifact: `.forge.js`, 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).
17
- 6. For `jointsView()` animations, keep wrapped revolute tracks continuous across branch cuts; do not assume the viewport will auto-fix `-180/180` jumps.
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
 
@@ -90,15 +91,19 @@ Viewer-only APIs such as cutPlane, explodeView, jointsView, and animation behavi
90
91
  Modeling patterns, debugging tactics, copyable snippets.
91
92
 
92
93
  - `{{SKILL_DIR}}/docs/guides/modeling-recipes.md`
94
+ - `{{SKILL_DIR}}/docs/guides/joint-design.md`
93
95
 
94
96
  ### 11. CLI (for validation/render/export tasks)
95
97
 
96
98
  Test-run, export pipelines, debug flags.
97
99
 
98
- - `{{SKILL_DIR}}/docs/CLI/projects.md`
99
- - `{{SKILL_DIR}}/docs/CLI/validation.md`
100
- - `{{SKILL_DIR}}/docs/CLI/export.md`
101
- - `{{SKILL_DIR}}/docs/CLI/studio_publishing.md`
100
+ - `{{SKILL_DIR}}/docs/CLI.md`
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`
102
107
 
103
108
  ### 12. Internals — Compiler & Geometry Pipeline (for ForgeCAD developers)
104
109
 
@@ -121,6 +126,7 @@ Coding best practices, PR guidelines, release checklist, deployment.
121
126
  - `{{SKILL_DIR}}/docs/coding-best-practices.md`
122
127
  - `{{SKILL_DIR}}/docs/coding.md`
123
128
  - `{{SKILL_DIR}}/docs/blueprint-first.md`
129
+ - `{{SKILL_DIR}}/docs/component-model.md`
124
130
 
125
131
  ### 16. Skill System Maintenance
126
132
 
@@ -128,11 +134,3 @@ How to add docs, maintain standard vs dev skill, build and install flow.
128
134
 
129
135
  - `{{SKILL_DIR}}/docs/guides/skill-maintenance.md`
130
136
 
131
- ### 1b. SDF Modeling — Experimental (smooth booleans, TPMS, deformations, fromFunction)
132
-
133
- Primitives, smooth booleans, TPMS lattices, twist/bend/displace, morph, custom functions, gotchas. Experimental — slower render, lower mesh quality than B-rep.
134
-
135
- - `{{SKILL_DIR}}/docs/API/core/sdf-primitives.md`
136
- - `{{SKILL_DIR}}/docs/API/core/sdf-advanced.md`
137
- - `{{SKILL_DIR}}/docs/API/core/sdf-workflow.md`
138
-
@@ -10,11 +10,12 @@ Author or modify ForgeCAD models, sketches, assemblies, and CLI workflows. Prefe
10
10
  ## Workflow
11
11
 
12
12
  1. Identify the artifact: `.forge.js`, 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).
17
- 6. For `jointsView()` animations, keep wrapped revolute tracks continuous across branch cuts; do not assume the viewport will auto-fix `-180/180` jumps.
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
 
@@ -90,13 +91,17 @@ Viewer-only APIs such as cutPlane, explodeView, jointsView, and animation behavi
90
91
  Modeling patterns, debugging tactics, copyable snippets.
91
92
 
92
93
  - `{{SKILL_DIR}}/docs/guides/modeling-recipes.md`
94
+ - `{{SKILL_DIR}}/docs/guides/joint-design.md`
93
95
 
94
96
  ### 11. CLI (for validation/render/export tasks)
95
97
 
96
98
  Test-run, export pipelines, debug flags.
97
99
 
98
- - `{{SKILL_DIR}}/docs/CLI/projects.md`
99
- - `{{SKILL_DIR}}/docs/CLI/validation.md`
100
- - `{{SKILL_DIR}}/docs/CLI/export.md`
101
- - `{{SKILL_DIR}}/docs/CLI/studio_publishing.md`
100
+ - `{{SKILL_DIR}}/docs/CLI.md`
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`
102
107
 
@@ -16,7 +16,34 @@ return box(width, 30, 10);
16
16
 
17
17
  - Scripts re-execute on every parameter change (400ms debounce)
18
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, or `Array` of `{ name, shape?, sketch?, color? }`
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)
20
+
21
+ ### Metadata Object Return
22
+
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:
24
+
25
+ ```javascript
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
37
+ ```
38
+
39
+ Arrays inside the object are also rendered:
40
+
41
+ ```javascript
42
+ return {
43
+ parts: [{ name: 'Left', shape: leftShape }, { name: 'Right', shape: rightShape }],
44
+ armWidth: 6, // metadata
45
+ };
46
+ ```
20
47
 
21
48
  ## Coordinate System
22
49
 
@@ -0,0 +1,488 @@
1
+ ---
2
+ skill-group: cli
3
+ skill-order: 1
4
+ ---
5
+
6
+ # ForgeCAD CLI
7
+
8
+ Run, export, render, and publish `.forge.js` models from your terminal. Everything stays in code.
9
+
10
+ ## Quick Start
11
+
12
+ ```bash
13
+ # 1. Install
14
+ npm install -g forgecad
15
+
16
+ # 2. Create a model
17
+ forgecad new cup
18
+
19
+ # 3. Run it
20
+ forgecad run cup.forge.js
21
+
22
+ # 4. Open the editor (live reload)
23
+ forgecad dev
24
+
25
+ # 5. Export
26
+ forgecad export stl cup.forge.js
27
+ ```
28
+
29
+ ## Editor
30
+
31
+ ForgeCAD includes a local editor with live reload. Edit a `.forge.js` file, save, and the 3D view updates instantly — parameters become interactive sliders.
32
+
33
+ | Command | Description |
34
+ |---------|-------------|
35
+ | `dev` | Start the Vite dev server with live reload. No build step required — the preferred way to run ForgeCAD during active development. |
36
+ | `studio` | Serve the production build of the studio (requires dist/ — run `npm run build` first). |
37
+ | `web` | Start a local dev server in web/playground mode (no filesystem, localStorage only). |
38
+ | `open` | Alias for `forgecad studio`. |
39
+
40
+ <details>
41
+ <summary>Common flags for dev / studio</summary>
42
+
43
+ | Option | Description |
44
+ |--------|-------------|
45
+ | `--blank` | Start without a project folder |
46
+ | `--port <n>` | Bind to a specific port |
47
+ | `--host [host]` | Expose the server on the network |
48
+ | `--open` | Open a browser window automatically |
49
+ | `--strict-port` | Fail instead of selecting another port |
50
+
51
+ </details>
52
+
53
+ ## Run & Render
54
+
55
+ Execute scripts and produce images headless — no browser window. Renders use Chrome under the hood.
56
+
57
+ ### `forgecad run`
58
+
59
+ Execute a Forge script and print full geometry diagnostics — object summary, collision detection, spatial analysis, verification results, and solver profiling.
60
+
61
+ The primary validation command. Runs your script with the real geometry kernel (no browser needed) and prints a comprehensive report:
62
+
63
+ **Object summary** — lists every named shape with its volume, bounding box, and body count. For constrained sketches, shows solver status (FULLY / UNDER / OVER constrained), DOF, and error residuals. Problematic constraints (conflicting, redundant, or high-residual) are flagged individually.
64
+
65
+ **Construction history** — shows the build sequence for each shape (primitives, operations, modifications) so you can verify the modeling intent.
66
+
67
+ **Feature summary** — tallies geometry features across all objects (e.g. `3 extrude, 2 fillet, 1 chamfer`).
68
+
69
+ **Verification results** — runs any `verify.*` checks in the script and reports pass/fail with expected vs actual values.
70
+
71
+ **Automatic collision detection** — performs an all-pairs collision check on every named shape. For each pair whose bounding boxes overlap, computes the boolean intersection and reports overlap above 0.1 mm³:
72
+
73
+ ```
74
+ ⚠ COLLISION: bolt ∩ base (shared vol: 42.3mm³)
75
+ ```
76
+
77
+ Intra-group pairs (same assembly group) and mock-to-mock pairs are skipped. If a part passes through a boolean-subtracted hole, no collision is reported — the material is gone.
78
+
79
+ **Spatial analysis** — reports directional relationships and gap distances between nearby objects (e.g. `bracket is ABOVE base (gap: 5mm)`). When no issues are found: `(no collisions, all objects well-separated)`.
80
+
81
+ **Parameters** — lists all declared parameters with their current values. Overridden values are marked with `*`.
82
+
83
+ **Solver profiling** — when constraint solving occurs, shows timing breakdown (clone, solve, redundancy detection, surface building) and solver internals.
84
+
85
+ ```bash
86
+ forgecad run examples/cup.forge.js
87
+ forgecad run examples/cup.forge.js --focus
88
+ forgecad run examples/cup.forge.js --focus bracket,hinge
89
+ forgecad run examples/cup.forge.js --hide "wall,bolt"
90
+ forgecad run examples/cup.forge.js --backend occt
91
+ forgecad run examples/cup.forge.js --debug-imports
92
+ forgecad run examples/cup.forge.js -p "Wall Thickness=3" -p "Body Height=200"
93
+ forgecad run examples/constraints/06-complex-spectrogram.forge.js --solver-debug-out tmp/spectrogram-debug
94
+ ```
95
+
96
+ ### `forgecad render`
97
+
98
+ Render a Forge scene. Use a subcommand — `3d`, `section`, `wireframe`, `sketch`, or `hq`.
99
+
100
+ `forgecad render` is a group of rendering subcommands. Pick one based on what you want:
101
+
102
+ - `render 3d` — standard viewport PNG, the usual way to visually verify geometry
103
+ - `render wireframe` — edges only, no shading
104
+ - `render section` — 2D cross-section cut by a plane (SVG or PNG)
105
+ - `render sketch` — 2D sketch script to PNG
106
+ - `render hq` — path-traced via Blender Cycles, for documentation and marketing shots
107
+
108
+ ```bash
109
+ forgecad render 3d examples/cup.forge.js
110
+ forgecad render wireframe examples/cup.forge.js
111
+ forgecad render section examples/furniture/01-table.forge.js --plane XZ
112
+ forgecad render hq examples/cup.forge.js --preset dramatic
113
+ ```
114
+
115
+ ### `forgecad render 3d`
116
+
117
+ Render a Forge scene to PNG using the real viewport renderer.
118
+
119
+ Launches a headless Chrome instance, renders the scene with the same WebGL viewport as the editor, and saves a PNG. The output path defaults to `<script-name>.png` next to the input file.
120
+
121
+ Use `--focus` to isolate specific parts (hides everything else) or `--hide` to remove clutter like mock objects. The `--camera` flag accepts named views (`front`, `top`, `iso`) or `azimuth:elevation` angles — pass it multiple times to render several viewpoints in one run.
122
+
123
+ Use `--edges=<off|thin|bold>` to control the edge overlay. For a pure wireframe look, use `render wireframe` instead.
124
+
125
+ This is the standard way to visually verify geometry from the CLI or in agent workflows. For higher quality (path-traced, materials, HDRI lighting), use `render hq` instead.
126
+
127
+ ```bash
128
+ forgecad render 3d examples/cup.forge.js
129
+ forgecad render 3d examples/cup.forge.js --focus
130
+ forgecad render 3d examples/cup.forge.js --focus bracket
131
+ forgecad render 3d examples/cup.forge.js --hide "wall,bolt"
132
+ forgecad render 3d model.forge.js --camera 45:30
133
+ forgecad render 3d model.forge.js --camera front --camera side
134
+ forgecad render 3d model.forge.js --edges bold
135
+ forgecad render 3d model.forge.js --edges off
136
+ ```
137
+
138
+ ### `forgecad render wireframe`
139
+
140
+ Render a Forge scene as a wireframe (edges only, no shading).
141
+
142
+ Same as `render 3d` but renders only the edge geometry — no shaded surfaces. Useful for construction-style documentation or highlighting structural features without material detail.
143
+
144
+ ```bash
145
+ forgecad render wireframe examples/cup.forge.js
146
+ forgecad render wireframe examples/cup.forge.js --camera iso
147
+ ```
148
+
149
+ ### `forgecad render hq` **\[Pro\]**
150
+
151
+ High-quality render via Blender Cycles — path-traced, HDRI, material presets.
152
+
153
+ Exports the scene to Blender and renders with Cycles (path tracer). Requires Blender installed and on PATH.
154
+
155
+ Choose a `--preset` for the look: `studio` (neutral product shot), `dramatic` (high-contrast), `clay` (matte, no color), `glass`, `metallic`, `toon`, `xray`, `normals`, `silhouette`, and more. Control quality vs speed with `--samples` (default 256). Use `--transparent` for a transparent background (compositing-ready).
156
+
157
+ Output defaults to `<script-name>-hq.png`. Great for documentation, marketing renders, and social media.
158
+
159
+ ```bash
160
+ forgecad render hq examples/cup.forge.js
161
+ forgecad render hq examples/cup.forge.js hero.png --preset dramatic --samples 1024
162
+ forgecad render hq examples/cup.forge.js --preset clay --size 2048
163
+ forgecad render hq examples/cup.forge.js --transparent --preset glass
164
+ ```
165
+
166
+ ### `forgecad capture gif|mp4` **\[Pro\]**
167
+
168
+ Animated orbit or joint playback.
169
+
170
+ Renders an animated sequence by either orbiting the camera around the model or playing back a `jointsView` animation. Use `--capture orbit` (default) for a turntable rotation, or `--capture animation --animation <name>` to play a named joints clip. Supports `--cut-plane` to animate with a cross-section visible.
171
+
172
+ ```bash
173
+ forgecad capture gif examples/cup.forge.js
174
+ forgecad capture gif examples/3d-printer.forge.js out/section.gif --cut-plane "Front Section"
175
+ forgecad capture mp4 examples/cup.forge.js
176
+ forgecad capture mp4 examples/api/runtime-joints-view.forge.js out/step.mp4 --capture animation --animation Step
177
+ ```
178
+
179
+ ### `forgecad render section`
180
+
181
+ Render a 2D cross-section of a 3D model (cut by a plane) to SVG or PNG.
182
+
183
+ Cuts all shapes in the scene with an axis-aligned plane and produces a 2D cross-section drawing. The default plane is XY at Z=0. Use `--plane XZ` or `--plane YZ` for other orientations, and `--offset` to shift the cut position.
184
+
185
+ Output format is determined by the file extension: `.svg` (default, vector) or `.png` (rasterized at `--size` pixels). Use `--edges=<off|thin|bold>` to control the outline stroke on cut shapes.
186
+
187
+ Useful for verifying internal geometry, wall thicknesses, and fit checks that aren't visible in 3D renders.
188
+
189
+ ```bash
190
+ forgecad render section examples/furniture/01-table.forge.js
191
+ forgecad render section examples/furniture/01-table.forge.js out/section.svg --plane XZ --offset 10
192
+ forgecad render section examples/furniture/01-table.forge.js out/section.png --size 2048
193
+ forgecad render section examples/furniture/01-table.forge.js out/bold.svg --edges bold
194
+ ```
195
+
196
+ | Command | Description |
197
+ |---------|-------------|
198
+ | `render sketch` | Render a 2D sketch .forge.js to PNG. |
199
+
200
+ <details>
201
+ <summary>All render / capture flags</summary>
202
+
203
+ | Option | Description |
204
+ |--------|-------------|
205
+ | `--focus <names>` | Focus: no arg hides mocks; comma-separated names shows only those |
206
+ | `--hide <names>` | Hide comma-separated object names |
207
+ | `--camera <front\|side\|top\|iso\|az:el\|az:el:dist\|spec>` | Camera preset, spherical (az:el), or full spec. Repeatable. |
208
+ | `--size <px>` | Image size in pixels |
209
+ | `--scene <json>` | Viewport scene state JSON |
210
+ | `--background <color>` | Canvas background override |
211
+ | `--render-mode <solid\|wireframe>` | Shaded solid (default) or wireframe only |
212
+ | `--edges <off\|thin\|bold>` | Edge overlay preset in solid mode (default: thin) |
213
+ | `--port <n>` | Vite dev server port |
214
+ | `--chrome-path <path>` | Chrome or Chromium executable path |
215
+ | `--output <path>` | Output file path |
216
+ | `--preset <name>` | Material/lighting preset |
217
+ | `--width <px>` | Output width in pixels |
218
+ | `--height <px>` | Output height in pixels |
219
+ | `--samples <n>` | Render samples (more = higher quality, slower) |
220
+ | `--engine <cycles\|eevee>` | Render engine |
221
+ | `--transparent` | Transparent background (RGBA) |
222
+ | `--no-denoise` | Disable denoising |
223
+ | `--hdri <path.hdr>` | Custom HDRI environment map path |
224
+ | `--video` | Render orbit turntable video (MP4) |
225
+ | `--frames <n>` | Video frames per revolution |
226
+ | `--fps <n>` | Video frame rate |
227
+ | `--pitch <deg>` | Camera pitch angle in degrees |
228
+ | `--quality <default\|live\|high>` | Mesh tessellation quality |
229
+ | `--backend <manifold\|occt>` | Geometry backend |
230
+ | `--format <gif\|mp4>` | Output format |
231
+ | `--capture <orbit\|animation>` | Capture preset |
232
+ | `--animation <name>` | Named jointsView animation clip |
233
+ | `--animation-loops <n>` | Repeat the selected animation clip |
234
+ | `--cut-plane <name>` | Enable a named cut plane |
235
+ | `--wireframe-pass` | Enable an extra wireframe pass (off by default) |
236
+ | `--no-wireframe-pass` | Disable the extra wireframe pass |
237
+ | `--pixel-ratio <n>` | Render supersampling factor |
238
+ | `--frames-per-turn <n>` | Frames for one orbit turn |
239
+ | `--hold-frames <n>` | Freeze frames before each pass |
240
+ | `--encoder <auto\|ffmpeg\|js>` | GIF encoder strategy |
241
+ | `--crf <n>` | ffmpeg/libx264 quality |
242
+ | `--ffmpeg-path <path>` | ffmpeg executable path |
243
+ | `--list` | Print available animations and cut planes |
244
+
245
+ </details>
246
+
247
+ ## Export
248
+
249
+ Export to every format you need. Free-tier formats work out of the box.
250
+
251
+ | Command | Format | Use case |
252
+ |---------|--------|----------|
253
+ | `export svg` | SVG | 2D vector output from sketches |
254
+ | `export sketch-pdf` **\[Pro\]** | PDF | Sketch with dimensions and constraints |
255
+ | `export step` **\[Pro\]** | STEP | CAD interchange (exact geometry) |
256
+ | `export brep` **\[Pro\]** | BREP | Boundary representation |
257
+ | `export 3mf` | 3MF | 3D printing (color, multi-part) |
258
+ | `export stl` | STL | 3D printing |
259
+ | `export gcode` **\[Pro\]** | G-code | Toolpath (scripted, not sliced) |
260
+ | `export sdf` **\[Pro\]** | SDF package | Gazebo robot simulation |
261
+ | `export urdf` **\[Pro\]** | URDF package | ROS / PyBullet / MuJoCo |
262
+ | `export report` **\[Pro\]** | PDF report | Multi-view report with BOM and dimensions |
263
+ | `export cutting-layout` **\[Pro\]** | PDF | Sheet cutting layout with cut sequence |
264
+ | `link` | URL | Generate a ForgeCAD share link from a GitHub Gist URL or ID and copy it to clipboard. |
265
+
266
+ ```bash
267
+ # 3D printing
268
+ forgecad export stl bracket.forge.js
269
+ forgecad export 3mf bracket.forge.js --quality high
270
+
271
+ # CAD interchange
272
+ forgecad export step bracket.forge.js
273
+ forgecad export step bracket.forge.js --allow-faceted
274
+
275
+ # Technical drawings
276
+ forgecad export report bracket.forge.js out/report.pdf
277
+
278
+ # Robot simulation
279
+ forgecad export sdf rover.forge.js --output out/forge_scout
280
+ ```
281
+
282
+ <details>
283
+ <summary>Export flags</summary>
284
+
285
+ | Option | Description |
286
+ |--------|-------------|
287
+ | `--output <path>` | Output STEP path |
288
+ | `--python <path>` | Python interpreter for uv |
289
+ | `--uv <path>` | uv executable path |
290
+ | `--allow-faceted` | Allow faceted fallback for closed mesh solids |
291
+ | `--quality <default\|live\|high>` | Forge quality preset |
292
+ | `--backend <manifold\|occt>` | Geometry backend |
293
+ | `--dim-angle-tol <deg>` | Dimension routing tolerance in degrees |
294
+ | `--sheet-width <mm>` | Stock sheet width in mm |
295
+ | `--sheet-height <mm>` | Stock sheet height in mm |
296
+ | `--kerf <mm>` | Cutting clearance (saw blade width) in mm |
297
+
298
+ </details>
299
+
300
+ ## Projects & Publishing
301
+
302
+ ForgeCAD has a hosted platform at [forgecad.io](https://forgecad.io). The CLI connects your local files to it.
303
+
304
+ ### Get started
305
+
306
+ ```bash
307
+ forgecad login
308
+ forgecad project init "Spool Adapter"
309
+ ```
310
+
311
+ ### Sync
312
+
313
+ ```bash
314
+ forgecad project push # Upload local changes
315
+ forgecad project pull # Download remote changes
316
+ forgecad project status # See what's different
317
+ ```
318
+
319
+ ### Publish
320
+
321
+ ```bash
322
+ forgecad publish adapter.forge.js --title "AMS Lite Adapter"
323
+ ```
324
+
325
+ Shares are live references — always the current version, not a snapshot.
326
+
327
+ <details>
328
+ <summary>All project commands</summary>
329
+
330
+ **Authentication**
331
+
332
+ | Command | Description |
333
+ |---------|-------------|
334
+ | `login` | Authenticate with ForgeCAD (email/password). |
335
+ | `logout` | Clear stored authentication credentials. |
336
+ | `whoami` | Show the current user, server, and license status. |
337
+
338
+ **Projects**
339
+
340
+ | Command | Description |
341
+ |---------|-------------|
342
+ | `project init` | Initialize the current directory as a ForgeCAD project and create it on the server. |
343
+ | `project clone` | Download a remote project into a new local directory. |
344
+ | `project pull` | Download remote changes into the current project. |
345
+ | `project push` | Upload local changes to the remote project. |
346
+ | `project status` | Show differences between local and remote project files. |
347
+ | `project list` | List your remote projects. |
348
+ | `project open` | Open the current project in the browser. |
349
+ | `project info` | Show details of the current project (name, visibility, files, URL). |
350
+ | `project rename` | Rename the current project. |
351
+ | `project set-visibility` | Change project visibility. |
352
+ | `project delete` | Permanently delete the current project and all its files on the server. |
353
+
354
+ **Members**
355
+
356
+ | Command | Description |
357
+ |---------|-------------|
358
+ | `project members` | List members of the current project. |
359
+ | `project add-member` | Add a member to the current project. |
360
+ | `project remove-member` | Remove a member from the current project. |
361
+ | `project set-role` | Change a member's role. |
362
+
363
+ **Files (remote)**
364
+
365
+ | Command | Description |
366
+ |---------|-------------|
367
+ | `file list` | List remote files in the current project. |
368
+ | `file read` | Read a remote file and print its contents. |
369
+ | `file save` | Create or update a remote file. Reads from local file, --content, or --stdin. |
370
+ | `file delete` | Delete a remote file. |
371
+ | `file rename` | Rename or move a remote file. |
372
+ | `file mkdir` | Create a directory in the remote project. |
373
+ | `file copy` | Copy a file from another project into the current one. |
374
+
375
+ **Shares**
376
+
377
+ | Command | Description |
378
+ |---------|-------------|
379
+ | `publish` | Publish a model and get a shareable link. Auto-syncs project if inside one. |
380
+ | `shares list` | List your published models. |
381
+ | `shares delete` | Unpublish a shared model. |
382
+
383
+ **API Tokens**
384
+
385
+ | Command | Description |
386
+ |---------|-------------|
387
+ | `token create` | Create a new API token for CLI and CI/CD access. |
388
+ | `token list` | List your API tokens. |
389
+ | `token revoke` | Revoke an API token. |
390
+
391
+ **Scaffolding**
392
+
393
+ | Command | Description |
394
+ |---------|-------------|
395
+ | `new` | Create a new .forge.js file from a template. |
396
+
397
+ </details>
398
+
399
+ ## AI Integration
400
+
401
+ ForgeCAD files are plain JavaScript. AI coding agents write and iterate on them directly. The CLI closes the loop.
402
+
403
+ ```bash
404
+ # Give your agent full ForgeCAD API knowledge
405
+ forgecad skill install
406
+
407
+ # Or export a single context file for chat UIs (Claude.ai, ChatGPT, ...)
408
+ forgecad skill one-file ~/Desktop/forgecad-context.md
409
+ ```
410
+
411
+ > **Workflow:** Agent writes the model → `forgecad run` validates it → `forgecad check params` sweeps the parameter range → `forgecad export stl` ships the result. All in the terminal.
412
+
413
+ ## Validation
414
+
415
+ Test parameter ranges and run invariant suites.
416
+
417
+ ### `forgecad check params`
418
+
419
+ Sweep parameter ranges and report runtime failures, degeneracy, and new collisions.
420
+
421
+ For each declared parameter, samples `N` values evenly across its `[min, max]` range (default 8) while holding all other parameters at their defaults. At each sample, checks for:
422
+
423
+ 1. **Runtime errors** — script crashes at certain parameter values
424
+ 2. **Degenerate geometry** — shapes with near-zero volume (collapsed geometry)
425
+ 3. **New collisions** — part pairs that collide at the sampled value but not at the default
426
+
427
+ Baseline collisions (those present at default parameter values) are listed but not flagged as issues — only *new* collisions introduced by parameter changes are reported. Results are grouped by parameter with the problematic value ranges shown.
428
+
429
+ ```bash
430
+ forgecad check params examples/shoe-rack-doors.forge.js
431
+ forgecad check params path/to/model.forge.js --samples 12
432
+ ```
433
+
434
+ <details>
435
+ <summary>All check commands (CI / development)</summary>
436
+
437
+ | Command | Description |
438
+ |---------|-------------|
439
+ | `check suite` | Run the repo invariant suite, with local and full profiles for everyday checks vs CI gates. |
440
+ | `check transforms` | Run transform and assembly invariants. |
441
+ | `check dimensions` | Run dimension propagation invariants. |
442
+ | `check placement` | Run placement reference invariants. |
443
+ | `check js-modules` | Run JavaScript module import invariants. |
444
+ | `check brep` | Run exact BREP export invariants. |
445
+ | `check constraints` | Run constraint solver invariants and snapshot regression tests. |
446
+ | `check compiler` | Run compiler routing snapshots and runtime-vs-lowered invariants. |
447
+ | `check query-propagation` | Run focused topology-rewrite query-propagation snapshots and invariants. |
448
+ | `check examples` | Run the example architecture gate across the checked manifest for `examples/`. |
449
+ | `check api` | Run script API contract invariants. |
450
+ | `check text` | Run text2d geometry contract tests. |
451
+ | `check occt-lower` | Run OCCT lowerer geometry invariant tests. |
452
+ | `check backend-parity` | Compare Manifold vs OCCT backend outputs across example files. |
453
+
454
+ </details>
455
+
456
+ <details>
457
+ <summary>Debug commands (ForgeCAD development)</summary>
458
+
459
+ | Command | Description |
460
+ |---------|-------------|
461
+ | `debug compiler` | Inspect compiler routes, lowered plans, and runtime snapshots for a script. |
462
+ | `debug dimensions` | Inspect report-dimension routing for a script. |
463
+ | `debug faces` | Inspect face transformation histories for a script. |
464
+
465
+ </details>
466
+
467
+ ## Setup & Licensing
468
+
469
+ | Command | Description |
470
+ |---------|-------------|
471
+ | `completion` | Generate shell completion scripts for bash, zsh, or fish. |
472
+ | `whoami` | Show the current user, server, and license status. |
473
+ | `new` | Create a new .forge.js file from a template. |
474
+ | `doctor` | Check system dependencies for all CLI features. |
475
+
476
+ ### Licensing
477
+
478
+ The CLI is free for core workflows. Advanced exports and rendering are Pro.
479
+
480
+ | Free | Pro |
481
+ |------|-----|
482
+ | `run`, `dev`, `studio`, `render 3d`, `export stl`, `export 3mf`, `export svg`, `check params`, `check suite` | `render hq`, `capture gif`, `capture mp4`, `export sketch-pdf`, `export step`, `export brep`, `export gcode`, `export sdf`, `export urdf`, `export report`, `export cutting-layout` |
483
+
484
+ ```bash
485
+ forgecad license # Check status
486
+ forgecad license activate # Activate Pro
487
+ forgecad license deactivate # Remove license
488
+ ```