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
@@ -1,52 +0,0 @@
1
- ---
2
- skill-group: cli
3
- skill-order: 4
4
- ---
5
-
6
- # ForgeCAD CLI: Studio & Publishing
7
-
8
- ## Studio & Dev Server
9
-
10
- ```bash
11
- forgecad dev [path] [--blank] [--port n] [--host] [--open] # Vite dev server
12
- forgecad studio [path] [--blank] [--port n] # Production static server
13
- forgecad web [--open] # Web/embeddable mode
14
- ```
15
-
16
- `forgecad open` is an alias for `forgecad studio`.
17
-
18
- ## New File from Template
19
-
20
- ```bash
21
- forgecad new mypart # Part template (default)
22
- forgecad new bracket --template sketch # Constrained sketch template
23
- forgecad new robot --template assembly # Multi-part assembly template
24
- ```
25
-
26
- ## Publishing & Sharing
27
-
28
- ```bash
29
- forgecad publish model.forge.js --title "My Model" # Publish; get shareable URL
30
- forgecad publish model.forge.js --no-sync # Publish without auto-pushing
31
- forgecad shares list # List all published models
32
- forgecad shares delete <share-id> [--force]
33
- forgecad link <gist-url-or-id> # Share link from GitHub Gist
34
- ```
35
-
36
- Published at `forgecad.io/m/<shareId>`. Shares are live references — always reflect current version, not a snapshot. Requires a project directory (`forgecad.json`).
37
-
38
- ## Adding New CLI Commands
39
-
40
- 1. Create/extend a module under `cli/`
41
- 2. Import from `../src/forge/headless`; call `await init()` then `runScript(code, fileName, allFiles)`
42
- 3. Register in `cli/forgecad.ts`
43
-
44
- Pass all project files (keyed by project-relative path) to `runScript` when using `require()` / `importSvgSketch()`. Use `require("./file.forge.js", { Param: value })` for model files; `importSvgSketch()` for SVG assets.
45
-
46
- ## Local Branch Cleanup
47
-
48
- ```bash
49
- uv run cli/forge-prune-local-branches.py [--dry-run] [--base mainline]
50
- ```
51
-
52
- Finds merged local branches with no matching remote, prompts before deleting. Removes linked worktrees first when a branch is checked out there.
@@ -1,66 +0,0 @@
1
- ---
2
- skill-group: cli
3
- skill-order: 2
4
- ---
5
-
6
- # ForgeCAD CLI: Validation & Debugging
7
-
8
- ## Script Validation
9
-
10
- ```bash
11
- forgecad run examples/cup.forge.js
12
- forgecad run examples/cup.forge.js --debug-imports
13
- forgecad run examples/cup.forge.js --param "Wall Thickness=3"
14
- forgecad run examples/cup.forge.js --param "Show Lid=0"
15
- forgecad run examples/cup.forge.js --param "Pan Style=wok"
16
- forgecad run examples/constraints/06-complex-spectrogram.forge.js --solver-debug-out tmp/spectrogram-debug
17
- ```
18
-
19
- `--param "Key=Value"` overrides: numeric, boolean (`1`/`0`), or string (displayed label) params.
20
-
21
- `--debug-imports` prints source file, target file, overrides, return type, and success/error phase.
22
-
23
- `--solver-debug-out <dir>` writes a per-sketch constructive transcript + SVG snapshots bundle.
24
-
25
- ## Parameter Validation
26
-
27
- ```bash
28
- forgecad check params examples/shoe-rack-doors.forge.js [--samples 10]
29
- ```
30
-
31
- Samples each parameter across its range; checks runtime errors, degenerate geometry (volume~0), and new collisions. `--samples N` (default 8).
32
-
33
- ## Check Commands
34
-
35
- ```bash
36
- forgecad check transforms # Math-level transform/frame composition invariants
37
- forgecad check compiler [--case <name>] [--update] # Compiler regression snapshots
38
- forgecad check query-propagation [--update] # Topology-rewrite propagation snapshots
39
- forgecad check examples [--family <f>] [--example <path>] # Checked example manifest
40
- forgecad check suite # Full invariant suite (CI / release gate)
41
- forgecad check suite --profile local # Faster local invariant suite
42
- forgecad check dimensions # Shape dimension propagation invariants
43
- ```
44
-
45
- ## Invariant Test Suite
46
-
47
- ```bash
48
- npm test # Faster local invariant suite
49
- npm run test:full # Full invariant suite
50
- npm run test:examples # Example architecture gate
51
- npm run test:compiler # Compiler snapshot suite
52
- npm run test:compiler:update # Refresh compiler snapshots after intentional change
53
- npm run test:query-propagation
54
- npm run test:query-propagation:update
55
- ```
56
-
57
- ## Debug Commands
58
-
59
- ```bash
60
- forgecad debug dimensions /path/to/file.forge.js [--all] [--dim-angle-tol 12]
61
- forgecad debug compiler /path/to/file.forge.js [--compact]
62
- ```
63
-
64
- `debug dimensions` prints total/per-view dimension counts, ownership routing, and coordinate list.
65
-
66
- `debug compiler` prints JSON with compile plans, CadQuery/OCCT lowering diagnostics, faceted fallback eligibility, and runtime/compiler Manifold summaries.
@@ -1,92 +0,0 @@
1
- ---
2
- skill-group: dev-sdf
3
- skill-order: 2
4
- ---
5
-
6
- # SDF Advanced Operations
7
-
8
- ## TPMS Lattices
9
-
10
- ```javascript
11
- sdf.gyroid({ cellSize, thickness }) // most common for 3D printing
12
- sdf.schwarzP({ cellSize, thickness }) // isotropic pores
13
- sdf.diamond({ cellSize, thickness }) // stiffest structure
14
- ```
15
-
16
- TPMS fills all space — **always clip with an intersect before `.toShape()`**:
17
-
18
- ```javascript
19
- const lattice = sdf.gyroid({ cellSize: 8, thickness: 1.2 })
20
- .intersect(sdf.sphere(25))
21
- .toShape();
22
- ```
23
-
24
- `cellSize`: larger = coarser. `thickness`: thicker = denser.
25
-
26
- ## Domain Operations
27
-
28
- ### Twist
29
- Rotates slices around Y axis as function of Y position.
30
- ```javascript
31
- sdf.cylinder(50, 8).twist(0.9).toShape() // 45° total over 50mm (0.9 deg/mm)
32
- ```
33
-
34
- ### Bend
35
- Bends around Z axis. Smaller radius = tighter arc.
36
- ```javascript
37
- sdf.cylinder(60, 5).bend(20).toShape() // arch shape
38
- ```
39
-
40
- ### Repeat
41
- Tiles in space. Spacing `0` = no repeat on that axis. Count `0` = infinite.
42
- ```javascript
43
- sdf.sphere(4).repeat([15, 15, 0], [3, 3, 0]).toShape() // 3×3 grid
44
- ```
45
-
46
- ### Shell
47
- Hollows to surface shell of given thickness.
48
- ```javascript
49
- sdf.sphere(20).shell(2).subtract(sdf.box(60, 60, 30).translate(0, 0, -15)).toShape()
50
- ```
51
-
52
- ### Displace
53
- Offsets surface by a function of position.
54
- ```javascript
55
- sdf.sphere(15).displace((x, y, z) => Math.sin(x * 0.8) * Math.sin(y * 0.8) * Math.sin(z * 0.8) * 2).toShape()
56
- ```
57
-
58
- **Critical gotcha for `displace()` and `fromFunction()`:** The function is serialized as a string and re-evaluated via `new Function("x","y","z", "return ...")`. This means:
59
- - **No closure variables** — cannot reference `param()` values inside
60
- - **Single expression only** — no `const`, `let`, `if`, `for`
61
- - Multi-statement blocks **silently produce bad geometry**
62
-
63
- ### Onion
64
- Concentric shells.
65
- ```javascript
66
- sdf.sphere(20).onion(3, 2).toShape() // 3 shells, 2mm apart
67
- ```
68
-
69
- ## Morphing
70
-
71
- Interpolate between two shapes. `t=0` = a, `t=1` = b.
72
- ```javascript
73
- sdf.morph(sdf.sphere(12), sdf.box(20, 20, 20), 0.5).toShape()
74
- a.morph(b, t) // method form
75
- ```
76
-
77
- ## Custom SDF Functions
78
-
79
- ```javascript
80
- sdf.fromFunction(fn, { min: [x0, y0, z0], max: [x1, y1, z1] })
81
- ```
82
-
83
- `fn(x, y, z)` returns signed distance: negative = inside, positive = outside, zero = surface. Bounds are required — provide tightly to avoid wasted computation.
84
-
85
- ```javascript
86
- const heart = sdf.fromFunction(
87
- (x, y, z) => (x*x + z*z*1.1 + y*y - 1)**3 - x*x*y*y*y - z*z*y*y*y * 0.11,
88
- { min: [-20, -25, -15], max: [20, 20, 15] }
89
- ).toShape();
90
- ```
91
-
92
- Same serialization gotcha as `displace()` — no closure variables, single expression only.
@@ -1,58 +0,0 @@
1
- ---
2
- skill-group: dev-sdf
3
- skill-order: 1
4
- ---
5
-
6
- # SDF Primitives & Booleans
7
-
8
- > **Experimental.** Slower render times than B-rep; lower mesh quality from marching-tetrahedra extraction. Use for organic forms, TPMS lattices, smooth blending. For mechanical parts, prefer B-rep.
9
-
10
- SDF operations are accessed via the globally available `sdf` namespace. All shapes live as a lazy expression tree until `.toShape()` is called.
11
-
12
- ## Primitives
13
-
14
- All centered at origin unless noted.
15
-
16
- ```javascript
17
- sdf.sphere(radius)
18
- sdf.box(x, y, z) // full dimensions — box(20,20,20) → 20mm cube
19
- sdf.cylinder(height, radius) // axis along Y (rotate 90,0,0 for Z-axis)
20
- sdf.torus(majorRadius, minorRadius) // ring in XZ plane (hole axis = Y)
21
- sdf.capsule(height, radius) // axis along Y
22
- sdf.cone(height, radius) // base at y=0, tip at y=height (not centered)
23
- ```
24
-
25
- ## Boolean Operations
26
-
27
- ```javascript
28
- // Sharp
29
- a.union(b, c, d); a.subtract(b); a.intersect(b)
30
-
31
- // Smooth — blend over transition radius
32
- sdf.smoothUnion(a, b, { radius: 5 }) // factory: radius in options object
33
- sdf.smoothDifference(a, b, { radius: 5 })
34
- sdf.smoothIntersection(a, b, { radius: 5 })
35
-
36
- a.smoothUnion(b, 5) // method: radius as direct number
37
- a.smoothSubtract(b, 5) // note: smoothSubtract, not smoothDifference
38
- a.smoothIntersect(b, 5)
39
- ```
40
-
41
- **API mismatch:** Factory functions take `{ radius }` (object). Instance methods take `radius` (number). Don't mix them.
42
-
43
- ## Transforms
44
-
45
- ```javascript
46
- shape.translate(x, y, z)
47
- shape.rotateX(deg) // also rotateY, rotateZ, rotate(axis, deg)
48
- shape.scale(factor) // uniform only
49
- ```
50
-
51
- ## Reserved Names
52
-
53
- The global scope defines `sphere`, `box`, `cylinder`, `torus`, `capsule`, `cone`, `shell` as B-rep primitives. Always use `sdf.*` prefix — and avoid naming local variables after these globals:
54
-
55
- ```javascript
56
- const orb = sdf.sphere(10); // correct — not 'sphere'
57
- const s = sdf.sphere(10); // bad — shadows global 'sphere' if named 'sphere'
58
- ```
@@ -1,42 +0,0 @@
1
- ---
2
- skill-group: dev-sdf
3
- skill-order: 3
4
- ---
5
-
6
- # SDF Workflow & Mesh Quality
7
-
8
- ## Converting to Shape
9
-
10
- ```javascript
11
- shape.toShape()
12
- shape.toShape({ edgeLength: 0.5 }) // finer mesh
13
- shape.toShape({ bounds: { min: [...], max: [...] } }) // override auto bounds
14
- ```
15
-
16
- | Option | Default | Effect |
17
- |--------|---------|--------|
18
- | `edgeLength` | `maxDim / 100` | Smaller = smoother, slower |
19
- | `bounds` | auto-estimated | Override sampling volume |
20
-
21
- For smooth shapes use `0.3–0.5`. For fast previews use `1–2`.
22
-
23
- After meshing, Laplacian smoothing + SDF projection runs automatically (2 iterations) to reduce axis-aligned triangle artifacts.
24
-
25
- ## Workflow Tips
26
-
27
- - **Start coarse, refine last** — design at `edgeLength: 2`, drop to `0.5` for output
28
- - **Clip TPMS before `toShape()`** — intersect with bounding shape first
29
- - **Compose before meshing** — do all booleans/deformations in SDF space, then call `.toShape()` once
30
- - **Mix with B-rep freely** — after `.toShape()`, use in `difference()`, `union()`, `.fillet()`, etc.
31
-
32
- ```javascript
33
- const organicBase = sdf.smoothUnion(sdf.sphere(20), sdf.box(30, 30, 10), { radius: 8 }).toShape();
34
- return difference(organicBase, cylinder(15, 3)); // B-rep cut on SDF result
35
- ```
36
-
37
- ## Serialization Gotcha
38
-
39
- `displace()` and `fromFunction()` serialize the function body via `new Function("x","y","z", "return ...")`:
40
- - **No closure variables** — cannot reference `param()` values
41
- - **Single expression only** — no `const`, `let`, `if`, `for`
42
- - Multi-statement blocks silently produce bad geometry
@@ -1,91 +0,0 @@
1
- ---
2
- skill-group: cli
3
- skill-order: 3
4
- ---
5
-
6
- # ForgeCAD CLI: Export Commands
7
-
8
- ## SVG Export
9
-
10
- ```bash
11
- forgecad export svg examples/constraints/01-fully-constrained-rect.forge.js [output.svg]
12
- ```
13
-
14
- Pure Node — no browser needed. Runs the sketch script through the forge engine and converts polygons to SVG paths.
15
-
16
- ## STEP / BREP Export (exact subset, CadQuery)
17
-
18
- ```bash
19
- forgecad export step examples/api/brep-exportable.forge.js [--output out/demo.step] [--python 3.11] [--uv /path/to/uv]
20
- forgecad export brep examples/api/brep-exportable.forge.js
21
- forgecad export step examples/chess-set.forge.js --allow-faceted
22
- ```
23
-
24
- `uv`-first: provisions CadQuery automatically. Exact-subset only by default — fails with a reason rather than silently exporting degraded geometry. With `--allow-faceted`, unsupported mesh solids export as faceted OCCT solids (tessellation-driven, not exact replay).
25
-
26
- The maintained feature matrix: `docs/permanent/API/output/brep-export.md`.
27
-
28
- ## G-code Toolpath Export
29
-
30
- ```bash
31
- forgecad export gcode examples/gcode/parametric-vase.forge.js [--output out/vase.gcode]
32
- ```
33
-
34
- The script must return a `GCodeBuilder` (from the `gcode()` factory). This is a toolpath scripting API, not a slicer — you define print movements in code. See `docs/permanent/API/output/gcode.md` for the full API.
35
-
36
- ## SDF Robot Export (Gazebo)
37
-
38
- ```bash
39
- forgecad export sdf examples/api/sdf-rover-demo.forge.js [--output out/forge_scout]
40
- ```
41
-
42
- Writes a Gazebo-friendly package: `model.sdf`, `model.config`, `meshes/*.stl`, optional world file. Script must call `robotExport({...})` with an `assembly(...)` graph.
43
-
44
- Launch flow (macOS — use split `-s`/`-g`):
45
- ```bash
46
- export GZ_SIM_RESOURCE_PATH="$PWD/out/forge_scout/models${GZ_SIM_RESOURCE_PATH:+:$GZ_SIM_RESOURCE_PATH}"
47
- gz sim -s -r out/forge_scout/worlds/forge_scout_trial.sdf
48
- gz sim -g out/forge_scout/worlds/forge_scout_trial.sdf
49
- ```
50
-
51
- ## URDF Export
52
-
53
- ```bash
54
- forgecad export urdf examples/api/sdf-rover-demo.forge.js
55
- ```
56
-
57
- ## PNG Render (requires Chrome/Puppeteer)
58
-
59
- ```bash
60
- forgecad render examples/cup.forge.js [output.png]
61
- forgecad render examples/cup.forge.js out/scene.png --scene '<json from viewport>'
62
- ```
63
-
64
- Options: `--angles <front,side,top,iso>`, `--size <px>`, `--port <n>`, `--camera <spec>`, `--scene <json>`, `--background <color>`, `--chrome-path <path>`.
65
-
66
- ## Animated Capture (GIF or MP4, requires Chrome)
67
-
68
- ```bash
69
- forgecad capture gif examples/cup.forge.js [output.gif]
70
- forgecad capture mp4 examples/cup.forge.js [output.mp4]
71
- forgecad capture mp4 examples/api/runtime-joints-view.forge.js out/step.mp4 --capture animation --animation Step
72
- forgecad capture gif examples/3d-printer.forge.js out/section.gif --cut-plane "Front Section"
73
- ```
74
-
75
- `--list` prints available animation clips and cut planes. Uses `ffmpeg` when available (better GIF colors, H.264 MP4); falls back to pure-JS GIF encoder.
76
-
77
- Key options: `--capture <orbit|animation>`, `--animation <name>`, `--cut-plane <name>`, `--camera <spec>`, `--scene <json>`, `--size <px>`, `--fps <n>`, `--frames-per-turn <n>`, `--quality <default|live|high>`.
78
-
79
- Use `Copy CLI --scene` from the View Panel to grab the current viewport framing and paste into `render` or `capture`.
80
-
81
- ## PDF Report
82
-
83
- ```bash
84
- forgecad export report examples/cup.forge.js [output.pdf] [--dim-angle-tol 18]
85
- ```
86
-
87
- Generates a searchable PDF with BOM page, combined model page, and per-component pages. Dimensions included per view when their axis aligns with that view's projection plane (within `--dim-angle-tol` degrees, default 12).
88
-
89
- ## STL Export
90
-
91
- Available in the browser UI via the Export panel (binary STL).
@@ -1,107 +0,0 @@
1
- ---
2
- skill-group: cli
3
- skill-order: 1
4
- ---
5
-
6
- # ForgeCAD CLI: Projects & Setup
7
-
8
- ## Install
9
-
10
- ```bash
11
- npm install -g forgecad
12
- # Developers working on ForgeCAD itself:
13
- npm install && npm link
14
- ```
15
-
16
- ## When to use what
17
-
18
- | Context | Use |
19
- |---------|-----|
20
- | Using ForgeCAD as a tool | `forgecad *` commands |
21
- | Developing ForgeCAD itself | `npm run dev` / `npm run build` |
22
- | CI / publishing | `npm run build && npm run test:full` |
23
-
24
- ## Dev vs production server
25
-
26
- ```bash
27
- forgecad dev [path] # Vite dev server, live reload
28
- forgecad studio [path] # Static server for production build (requires dist/)
29
- ```
30
-
31
- Both accept `--blank`, `--port <n>`, `--host`, `--open`, `--strict-port`.
32
-
33
- ## Licensing
34
-
35
- ```bash
36
- forgecad license # Show license status
37
- forgecad license activate <key> # Activate a Pro license key
38
- forgecad license deactivate # Remove license
39
- ```
40
-
41
- | Tier | Included |
42
- |------|----------|
43
- | Free | dev, studio, run, render, export stl/3mf/svg, all checks, debug |
44
- | Pro | export step/brep, render-hq, capture gif/mp4, gcode, report, cutting-layout, sdf, urdf, sketch-pdf |
45
-
46
- ## Authentication
47
-
48
- ```bash
49
- forgecad login # Interactive login
50
- forgecad login --server http://localhost:5174
51
- forgecad logout
52
- forgecad whoami # Show user, server, and license status
53
- ```
54
-
55
- Credentials stored in `~/.forgecad/auth.json`.
56
-
57
- ## Project Management
58
-
59
- ```bash
60
- forgecad project init "My Project" # Create on server + link current directory
61
- forgecad project clone my-project # Download into ./my-project/
62
- forgecad project push [--force] # Upload local changes
63
- forgecad project pull [--force] # Download remote changes
64
- forgecad project status # Show local vs remote diff
65
- forgecad project list
66
- forgecad project info
67
- forgecad project rename "New Name"
68
- forgecad project set-visibility public # private|shared|public
69
- forgecad project delete [--force]
70
- forgecad project open
71
- ```
72
-
73
- Projects are linked to remote via `forgecad.json`.
74
-
75
- ## File Management (Remote)
76
-
77
- ```bash
78
- forgecad file list [path]
79
- forgecad file read <path>
80
- forgecad file save <path> # Upload local file
81
- forgecad file save <path> --content "code here"
82
- cat model.forge.js | forgecad file save model.forge.js --stdin
83
- forgecad file delete <path> [--force]
84
- forgecad file rename <old> <new>
85
- forgecad file mkdir <path>
86
- forgecad file copy <source-slug> <path> [--dest <dest-path>]
87
- ```
88
-
89
- Requires the current directory to have `forgecad.json`.
90
-
91
- ## Member Management
92
-
93
- ```bash
94
- forgecad project members
95
- forgecad project add-member alice@example.com # editor by default
96
- forgecad project add-member bob@example.com --role viewer
97
- forgecad project remove-member alice@example.com
98
- forgecad project set-role bob@example.com editor
99
- ```
100
-
101
- Roles: **owner** (full control), **editor** (read/write), **viewer** (read-only).
102
-
103
- ## Shell Autocomplete
104
-
105
- ```bash
106
- forgecad completion bash # or zsh / fish
107
- ```
@@ -1,52 +0,0 @@
1
- ---
2
- skill-group: cli
3
- skill-order: 4
4
- ---
5
-
6
- # ForgeCAD CLI: Studio & Publishing
7
-
8
- ## Studio & Dev Server
9
-
10
- ```bash
11
- forgecad dev [path] [--blank] [--port n] [--host] [--open] # Vite dev server
12
- forgecad studio [path] [--blank] [--port n] # Production static server
13
- forgecad web [--open] # Web/embeddable mode
14
- ```
15
-
16
- `forgecad open` is an alias for `forgecad studio`.
17
-
18
- ## New File from Template
19
-
20
- ```bash
21
- forgecad new mypart # Part template (default)
22
- forgecad new bracket --template sketch # Constrained sketch template
23
- forgecad new robot --template assembly # Multi-part assembly template
24
- ```
25
-
26
- ## Publishing & Sharing
27
-
28
- ```bash
29
- forgecad publish model.forge.js --title "My Model" # Publish; get shareable URL
30
- forgecad publish model.forge.js --no-sync # Publish without auto-pushing
31
- forgecad shares list # List all published models
32
- forgecad shares delete <share-id> [--force]
33
- forgecad link <gist-url-or-id> # Share link from GitHub Gist
34
- ```
35
-
36
- Published at `forgecad.io/m/<shareId>`. Shares are live references — always reflect current version, not a snapshot. Requires a project directory (`forgecad.json`).
37
-
38
- ## Adding New CLI Commands
39
-
40
- 1. Create/extend a module under `cli/`
41
- 2. Import from `../src/forge/headless`; call `await init()` then `runScript(code, fileName, allFiles)`
42
- 3. Register in `cli/forgecad.ts`
43
-
44
- Pass all project files (keyed by project-relative path) to `runScript` when using `require()` / `importSvgSketch()`. Use `require("./file.forge.js", { Param: value })` for model files; `importSvgSketch()` for SVG assets.
45
-
46
- ## Local Branch Cleanup
47
-
48
- ```bash
49
- uv run cli/forge-prune-local-branches.py [--dry-run] [--base mainline]
50
- ```
51
-
52
- Finds merged local branches with no matching remote, prompts before deleting. Removes linked worktrees first when a branch is checked out there.
@@ -1,66 +0,0 @@
1
- ---
2
- skill-group: cli
3
- skill-order: 2
4
- ---
5
-
6
- # ForgeCAD CLI: Validation & Debugging
7
-
8
- ## Script Validation
9
-
10
- ```bash
11
- forgecad run examples/cup.forge.js
12
- forgecad run examples/cup.forge.js --debug-imports
13
- forgecad run examples/cup.forge.js --param "Wall Thickness=3"
14
- forgecad run examples/cup.forge.js --param "Show Lid=0"
15
- forgecad run examples/cup.forge.js --param "Pan Style=wok"
16
- forgecad run examples/constraints/06-complex-spectrogram.forge.js --solver-debug-out tmp/spectrogram-debug
17
- ```
18
-
19
- `--param "Key=Value"` overrides: numeric, boolean (`1`/`0`), or string (displayed label) params.
20
-
21
- `--debug-imports` prints source file, target file, overrides, return type, and success/error phase.
22
-
23
- `--solver-debug-out <dir>` writes a per-sketch constructive transcript + SVG snapshots bundle.
24
-
25
- ## Parameter Validation
26
-
27
- ```bash
28
- forgecad check params examples/shoe-rack-doors.forge.js [--samples 10]
29
- ```
30
-
31
- Samples each parameter across its range; checks runtime errors, degenerate geometry (volume~0), and new collisions. `--samples N` (default 8).
32
-
33
- ## Check Commands
34
-
35
- ```bash
36
- forgecad check transforms # Math-level transform/frame composition invariants
37
- forgecad check compiler [--case <name>] [--update] # Compiler regression snapshots
38
- forgecad check query-propagation [--update] # Topology-rewrite propagation snapshots
39
- forgecad check examples [--family <f>] [--example <path>] # Checked example manifest
40
- forgecad check suite # Full invariant suite (CI / release gate)
41
- forgecad check suite --profile local # Faster local invariant suite
42
- forgecad check dimensions # Shape dimension propagation invariants
43
- ```
44
-
45
- ## Invariant Test Suite
46
-
47
- ```bash
48
- npm test # Faster local invariant suite
49
- npm run test:full # Full invariant suite
50
- npm run test:examples # Example architecture gate
51
- npm run test:compiler # Compiler snapshot suite
52
- npm run test:compiler:update # Refresh compiler snapshots after intentional change
53
- npm run test:query-propagation
54
- npm run test:query-propagation:update
55
- ```
56
-
57
- ## Debug Commands
58
-
59
- ```bash
60
- forgecad debug dimensions /path/to/file.forge.js [--all] [--dim-angle-tol 12]
61
- forgecad debug compiler /path/to/file.forge.js [--compact]
62
- ```
63
-
64
- `debug dimensions` prints total/per-view dimension counts, ownership routing, and coordinate list.
65
-
66
- `debug compiler` prints JSON with compile plans, CadQuery/OCCT lowering diagnostics, faceted fallback eligibility, and runtime/compiler Manifold summaries.