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.
- package/README.md +3 -12
- package/dist/assets/{AdminPage-CeqCUUgu.js → AdminPage-D4bocK4E.js} +250 -151
- package/dist/assets/{BlogPage-P_AJP0v9.js → BlogPage-CJEXL_zJ.js} +94 -70
- package/dist/assets/{DocsPage-CKRV2iq2.js → DocsPage-D3A_g8V3.js} +329 -163
- package/dist/assets/{EditorApp-CnC2k4cW.css → EditorApp-BWYUSpUN.css} +590 -136
- package/dist/assets/EditorApp-Cihhqcsq.js +11692 -0
- package/dist/assets/{EmbedViewer-DBlzmQ5i.js → EmbedViewer-kWjKaC_t.js} +2 -4
- package/dist/assets/LandingPageProofDriven-Bg2IUc3l.css +856 -0
- package/dist/assets/LandingPageProofDriven-DXkKlyhI.js +601 -0
- package/dist/assets/PricingPage-BsU5vzEx.js +232 -0
- package/dist/assets/{SettingsPage-BqCh9JcC.js → SettingsPage-PqvpAKIs.js} +129 -5
- package/dist/assets/{evalWorker-Ql-aKwLA.js → evalWorker-C-hzNUMy.js} +8949 -3161
- package/dist/assets/{Viewport-CoB46f5R.js → index-Pz321YAt.js} +38382 -7501
- package/dist/assets/{index-2hfs_ub0.css → index-ay13WNfa.css} +726 -53
- package/dist/assets/{javascript-DCxGoE5Y.js → javascript-DAl8Gmyo.js} +1 -1
- package/dist/assets/{manifold-CqNMHHKO.js → manifold-BcbjWLIo.js} +4 -3
- package/dist/assets/{manifold-Cce9wRFz.js → manifold-DBckbFgx.js} +1 -1
- package/dist/assets/{manifold-D6BeHIOo.js → manifold-O2AAGXyj.js} +1 -1
- package/dist/assets/{reportWorker-sFEFonXf.js → reportWorker-Dxr-5A7w.js} +8760 -3559
- package/dist/assets/{vendor-react-Dt7-aaJH.js → vendor-react-CG3i_wp0.js} +65 -8
- package/dist/docs/index.html +2 -2
- package/dist/docs-raw/CLI.md +341 -718
- package/dist/docs-raw/generated/assembly.md +699 -112
- package/dist/docs-raw/generated/concepts.md +1834 -1346
- package/dist/docs-raw/generated/core.md +1012 -1059
- package/dist/docs-raw/generated/curves.md +759 -116
- package/dist/docs-raw/generated/lib.md +43 -748
- package/dist/docs-raw/generated/output.md +139 -245
- package/dist/docs-raw/generated/sdf.md +208 -0
- package/dist/docs-raw/generated/sheet-metal.md +473 -21
- package/dist/docs-raw/generated/sketch.md +1518 -362
- package/dist/docs-raw/generated/viewport.md +368 -299
- package/dist/docs-raw/generated/wood.md +104 -0
- package/dist/index.html +2 -2
- package/dist/landing/proof-ams-adapter.png +0 -0
- package/dist/landing/proof-bolt-and-nut.png +0 -0
- package/dist/landing/proof-fillet-enclosure.png +0 -0
- package/dist/landing/proof-glasses.png +0 -0
- package/dist/landing/proof-gyroid.png +0 -0
- package/dist/sitemap.xml +6 -6
- package/dist-cli/forgecad.js +12321 -5700
- package/dist-cli/forgecad.js.map +1 -0
- package/dist-cli/solver-46FFSK2U.js +363 -0
- package/dist-cli/solver-46FFSK2U.js.map +1 -0
- package/dist-skill/CONTEXT.md +4890 -6302
- package/dist-skill/SKILL-dev.md +22 -66
- package/dist-skill/SKILL.md +20 -59
- package/dist-skill/docs/API/core/concepts.md +37 -92
- package/dist-skill/docs/CLI.md +341 -718
- package/dist-skill/docs/generated/assembly.md +699 -112
- package/dist-skill/docs/generated/core.md +1012 -1059
- package/dist-skill/docs/generated/curves.md +759 -116
- package/dist-skill/docs/generated/lib.md +43 -748
- package/dist-skill/docs/generated/output.md +139 -245
- package/dist-skill/docs/generated/sdf.md +208 -0
- package/dist-skill/docs/generated/sheet-metal.md +473 -21
- package/dist-skill/docs/generated/sketch.md +1518 -362
- package/dist-skill/docs/generated/viewport.md +368 -299
- package/dist-skill/docs/generated/wood.md +104 -0
- package/dist-skill/docs/guides/coordinate-system.md +11 -17
- package/dist-skill/docs/guides/geometry-conventions.md +13 -70
- package/dist-skill/docs/guides/joint-design.md +78 -0
- package/dist-skill/docs/guides/modeling-recipes.md +22 -195
- package/dist-skill/docs/guides/positioning.md +88 -147
- package/dist-skill/docs-dev/API/core/concepts.md +78 -0
- package/dist-skill/docs-dev/CLI.md +488 -0
- package/dist-skill/{docs → docs-dev}/blueprint-first.md +5 -0
- package/dist-skill/{docs → docs-dev}/coding-best-practices.md +6 -8
- package/dist-skill/{docs → docs-dev}/coding.md +2 -4
- package/dist-skill/docs-dev/component-model.md +164 -0
- package/dist-skill/docs-dev/generated/assembly.md +779 -0
- package/dist-skill/docs-dev/generated/core.md +1676 -0
- package/dist-skill/docs-dev/generated/curves.md +855 -0
- package/dist-skill/docs-dev/generated/lib.md +55 -0
- package/dist-skill/docs-dev/generated/output.md +234 -0
- package/dist-skill/docs-dev/generated/sdf.md +208 -0
- package/dist-skill/docs-dev/generated/sheet-metal.md +506 -0
- package/dist-skill/docs-dev/generated/sketch.md +1753 -0
- package/dist-skill/docs-dev/generated/viewport.md +513 -0
- package/dist-skill/docs-dev/generated/wood.md +104 -0
- package/dist-skill/docs-dev/guides/coordinate-system.md +46 -0
- package/dist-skill/docs-dev/guides/geometry-conventions.md +52 -0
- package/dist-skill/docs-dev/guides/joint-design.md +78 -0
- package/dist-skill/docs-dev/guides/modeling-recipes.md +77 -0
- package/dist-skill/docs-dev/guides/positioning.md +151 -0
- package/dist-skill/{docs → docs-dev}/guides/skill-maintenance.md +21 -10
- package/dist-skill/{docs → docs-dev}/internals/compiler.md +5 -6
- package/dist-skill/{docs → docs-dev}/internals/constraint-solver-quality.md +0 -1
- package/dist-skill/{docs → docs-dev}/internals/constraint-solver.md +0 -1
- package/dist-skill/{docs → docs-dev}/internals/sketch-2d-pipeline.md +2 -3
- package/examples/api/attachTo-basics.forge.js +8 -8
- package/examples/api/bill-of-materials.forge.js +9 -9
- package/examples/api/bolt-pattern.forge.js +5 -5
- package/examples/api/boolean-operations.forge.js +5 -5
- package/examples/api/bounding-box-visualizer.forge.js +3 -3
- package/examples/api/clone-duplicate.forge.js +2 -2
- package/examples/api/colors-union-vs-array.forge.js +6 -6
- package/examples/api/connector-assembly.forge.js +8 -6
- package/examples/api/connector-basics.forge.js +7 -7
- package/examples/api/constrained-sketch-mechanical.forge.js +4 -4
- package/examples/api/elbow-test.forge.js +3 -3
- package/examples/api/extrude-options.forge.js +8 -14
- package/examples/api/feature-created-faces.forge.js +6 -10
- package/examples/api/fillet-showcase.forge.js +2 -2
- package/examples/api/folded-service-panel-cover.forge.js +2 -2
- package/examples/api/gears-tier1.forge.js +5 -5
- package/examples/api/group-test.forge.js +3 -3
- package/examples/api/group-vs-union.forge.js +1 -1
- package/examples/api/highlight-debug.forge.js +4 -0
- package/examples/api/js-module-pillars.js +1 -1
- package/examples/api/js-module-scene.js +2 -2
- package/examples/api/mesh-import-slats.forge.js +4 -4
- package/examples/api/patterns.forge.js +3 -3
- package/examples/api/pointAlong-orientation.forge.js +3 -3
- package/examples/api/profile-2020-b-slot6.forge.js +4 -5
- package/examples/api/route-perimeter-flange.forge.js +1 -1
- package/examples/api/sdf-rover-demo.forge.js +10 -10
- package/examples/api/sketch-on-face-demo.forge.js +2 -2
- package/examples/api/sketch-regions.forge.js +4 -4
- package/examples/api/sketch-rounding-strategies.forge.js +1 -1
- package/examples/api/smooth-curve-connections.forge.js +1 -1
- package/examples/api/transition-curves.forge.js +4 -4
- package/examples/api/variable-sweep-pure-sdf-test.forge.js +162 -0
- package/examples/api/variable-sweep-test.forge.js +2 -2
- package/examples/api/wood-joinery.forge.js +60 -0
- package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +3 -3
- package/examples/compiler-corpus/fastener-plate-variants.forge.js +2 -2
- package/examples/constraints/01-fully-constrained-rect.forge.js +2 -2
- package/examples/constraints/02-underconstrained-triangle.forge.js +1 -1
- package/examples/constraints/03-redundant-constraints.forge.js +2 -2
- package/examples/constraints/05-parallel-with-linedistance.forge.js +2 -2
- package/examples/constraints/06-complex-spectrogram.forge.js +1 -1
- package/examples/constraints/07-perpendicular-chain.forge.js +4 -4
- package/examples/constraints/08-symmetric-bracket.forge.js +4 -4
- package/examples/constraints/09-stress-spiral.forge.js +1 -1
- package/examples/constraints/10-stress-honeycomb.forge.js +1 -1
- package/examples/constraints/11-surface-grid.forge.js +2 -2
- package/examples/constraints/12-surface-nested.forge.js +4 -4
- package/examples/constraints/13-surface-complex.forge.js +1 -1
- package/examples/exact-arc-housing.forge.js +12 -0
- package/examples/experiments/drone-arm.forge.js +53 -0
- package/examples/furniture/adjustable-table.forge.js +15 -15
- package/examples/furniture/bathroom.forge.js +26 -26
- package/examples/furniture/chair.forge.js +13 -13
- package/examples/furniture/picture-frame.forge.js +6 -6
- package/examples/furniture/shoe-rack-doors.forge.js +8 -8
- package/examples/furniture/shoe-rack.forge.js +7 -7
- package/examples/furniture/table-lamp.forge.js +8 -8
- package/examples/gcode/lissajous-vase.forge.js +4 -4
- package/examples/gcode/math-surface.forge.js +3 -3
- package/examples/gcode/parametric-vase.forge.js +4 -4
- package/examples/gcode/spiral-tower.forge.js +4 -4
- package/examples/generative/crystal-growth.forge.js +9 -9
- package/examples/generative/frost-spires.forge.js +9 -9
- package/examples/generative/golden-spiral-tower.forge.js +11 -11
- package/examples/generative/molten-forge.forge.js +6 -6
- package/examples/generative/neon-coral.forge.js +7 -7
- package/examples/mechanical/3d-printer.forge.js +37 -37
- package/examples/mechanical/5-finger-robot-hand.forge.js +19 -19
- package/examples/mechanical/airplane-propeller.forge.js +9 -9
- package/examples/mechanical/bolt-and-nut.forge.js +10 -10
- package/examples/mechanical/door-with-hinges.forge.js +7 -7
- package/examples/mechanical/fillet-enclosure.forge.js +15 -11
- package/examples/mechanical/headphone-hanger-v2.forge.js +11 -11
- package/examples/mechanical/robot_hand.forge.js +24 -24
- package/examples/mechanical/robot_hand_2.forge.js +26 -26
- package/examples/nurbs-surface.forge.js +8 -0
- package/examples/nurbs-tube.forge.js +7 -0
- package/examples/products/bottle.forge.js +8 -8
- package/examples/products/chess-set.forge.js +25 -25
- package/examples/products/classical-piano.forge.js +20 -20
- package/examples/products/clock.forge.js +33 -33
- package/examples/products/cup.forge.js +5 -5
- package/examples/products/iphone.forge.js +20 -20
- package/examples/products/laptop.forge.js +24 -24
- package/examples/products/laser-cut-box.forge.js +6 -6
- package/examples/products/laser-cut-tray.forge.js +6 -6
- package/examples/products/liquid-soap-dispenser.forge.js +23 -23
- package/examples/products/origami-fish.forge.js +14 -12
- package/examples/products/spiderman-cake.forge.js +6 -6
- package/examples/shelf/container.forge.js +5 -5
- package/examples/shelf/shelf-unit.forge.js +6 -6
- package/examples/toolbox/bolted-joint.forge.js +7 -7
- package/package.json +9 -4
- package/dist/assets/EditorApp-B-vQvgam.js +0 -9888
- package/dist/assets/LandingPage-C5n9hDXI.js +0 -322
- package/dist/assets/PublishedModelPage-Dt7PCVBj.js +0 -146
- package/dist/assets/__vite-browser-external-CURh0WXD.js +0 -8
- package/dist/assets/deserializeRunResult-BLAFoiE0.js +0 -19365
- package/dist/assets/index-1CYp3zUp.js +0 -1455
- package/dist-skill/docs/API/API.md +0 -1666
- package/dist-skill/docs/API/README.md +0 -37
- package/dist-skill/docs/API/assembly/assembly.md +0 -617
- package/dist-skill/docs/API/core/edge-queries.md +0 -130
- package/dist-skill/docs/API/core/parameters.md +0 -122
- package/dist-skill/docs/API/core/reserved-terms.md +0 -137
- package/dist-skill/docs/API/core/sdf.md +0 -326
- package/dist-skill/docs/API/core/skill-cli.md +0 -194
- package/dist-skill/docs/API/core/skill-guide.md +0 -205
- package/dist-skill/docs/API/core/specs.md +0 -186
- package/dist-skill/docs/API/core/topology.md +0 -372
- package/dist-skill/docs/API/entities.md +0 -268
- package/dist-skill/docs/API/output/bom.md +0 -58
- package/dist-skill/docs/API/output/brep-export.md +0 -87
- package/dist-skill/docs/API/output/dimensions.md +0 -67
- package/dist-skill/docs/API/output/export.md +0 -110
- package/dist-skill/docs/API/output/gcode.md +0 -195
- package/dist-skill/docs/API/runtime/viewport.md +0 -420
- package/dist-skill/docs/API/sheet-metal/sheet-metal.md +0 -185
- package/dist-skill/docs/API/sketch/anchor.md +0 -37
- package/dist-skill/docs/API/sketch/booleans.md +0 -91
- package/dist-skill/docs/API/sketch/core.md +0 -73
- package/dist-skill/docs/API/sketch/extrude.md +0 -62
- package/dist-skill/docs/API/sketch/on-face.md +0 -104
- package/dist-skill/docs/API/sketch/operations.md +0 -78
- package/dist-skill/docs/API/sketch/path.md +0 -75
- package/dist-skill/docs/API/sketch/primitives.md +0 -146
- package/dist-skill/docs/API/sketch/regions.md +0 -80
- package/dist-skill/docs/API/sketch/text.md +0 -108
- package/dist-skill/docs/API/sketch/transforms.md +0 -65
- package/dist-skill/docs/API/toolbox/fasteners.md +0 -129
- package/dist-skill/docs/INDEX.md +0 -94
- package/dist-skill/docs/RELEASING.md +0 -55
- package/dist-skill/docs/cli-monetization.md +0 -111
- package/dist-skill/docs/deployment.md +0 -281
- package/dist-skill/docs/generated/concepts.md +0 -2112
- package/dist-skill/docs/internals/shape-from-slices.md +0 -152
- package/dist-skill/docs/platform/admin.md +0 -45
- package/dist-skill/docs/platform/architecture.md +0 -79
- package/dist-skill/docs/platform/auth.md +0 -110
- package/dist-skill/docs/platform/email.md +0 -67
- package/dist-skill/docs/platform/projects.md +0 -111
- package/dist-skill/docs/platform/sharing.md +0 -90
- package/dist-skill/docs/runbook.md +0 -345
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sdf
|
|
3
|
-
skill-order: 1
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SDF Modeling
|
|
7
|
-
|
|
8
|
-
> **Experimental.** The SDF pipeline is functional but has known limitations: render times are significantly slower than B-rep, and the triangulated mesh output has lower quality due to the marching-tetrahedra isosurface extraction. Use SDF for prototyping organic forms or TPMS lattices where these trade-offs are acceptable. For mechanical parts, prefer the B-rep pipeline.
|
|
9
|
-
|
|
10
|
-
ForgeCAD exposes a Signed Distance Field (SDF) modeling layer that runs parallel to the standard B-rep pipeline. SDF unlocks operations impossible in B-rep: smooth shape blending, TPMS lattice infill, surface displacement, twist/bend deformations, and morphing between shapes.
|
|
11
|
-
|
|
12
|
-
All SDF operations are accessed via the globally available `sdf` namespace.
|
|
13
|
-
|
|
14
|
-
## Mental Model
|
|
15
|
-
|
|
16
|
-
SDF shapes live in **SDF space** — a lazy expression tree — until `.toShape()` is called. At that point ForgeCAD evaluates the SDF over a 3D grid, extracts the isosurface via Manifold's levelSet(), and returns a regular `Shape` you can color, export, boolean with B-rep shapes, etc.
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
sdf.sphere(10) → SdfShape (lazy expression)
|
|
20
|
-
.smoothUnion(...) → SdfShape (still lazy)
|
|
21
|
-
.toShape() → Shape (meshed, now in B-rep world)
|
|
22
|
-
.color('#4488cc') → Shape (regular ForgeCAD from here)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Key distinction:** SDF booleans operate on the *distance field* — shapes blend smoothly. B-rep booleans operate on exact geometry — edges stay sharp. Use SDF for organic forms; use B-rep for mechanical parts.
|
|
26
|
-
|
|
27
|
-
## Primitives
|
|
28
|
-
|
|
29
|
-
All primitives are centered at the origin unless noted.
|
|
30
|
-
|
|
31
|
-
```javascript
|
|
32
|
-
sdf.sphere(radius)
|
|
33
|
-
sdf.box(x, y, z) // full dimensions — box(20,20,20) → 20mm cube
|
|
34
|
-
sdf.cylinder(height, radius) // axis along Y
|
|
35
|
-
sdf.torus(majorRadius, minorRadius) // lies in the XZ plane
|
|
36
|
-
sdf.capsule(height, radius) // axis along Y
|
|
37
|
-
sdf.cone(height, radius) // base at y=0, tip at y=height
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**Orientation notes:**
|
|
41
|
-
- `cylinder` and `capsule` — axis along **Y**. To orient along Z, add `.rotate(90, 0, 0)`.
|
|
42
|
-
- `torus` — the ring lies flat in the **XZ** plane (the "hole" axis is Y).
|
|
43
|
-
- `cone` — not centered; base sits at `y=0`. Translate up by `height/2` to center it.
|
|
44
|
-
|
|
45
|
-
## Boolean Operations
|
|
46
|
-
|
|
47
|
-
### Sharp booleans
|
|
48
|
-
|
|
49
|
-
```javascript
|
|
50
|
-
// Method style
|
|
51
|
-
a.union(b)
|
|
52
|
-
a.subtract(b) // removes b from a
|
|
53
|
-
a.intersect(b)
|
|
54
|
-
|
|
55
|
-
// All accept multiple operands
|
|
56
|
-
a.union(b, c, d)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Smooth booleans
|
|
60
|
-
|
|
61
|
-
Smooth booleans blend shapes over a transition `radius`. Larger radius = wider blend.
|
|
62
|
-
|
|
63
|
-
Two equivalent styles — **pick one per script**:
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
66
|
-
// Factory style (radius in options object)
|
|
67
|
-
sdf.smoothUnion(a, b, { radius: 5 })
|
|
68
|
-
sdf.smoothDifference(a, b, { radius: 5 })
|
|
69
|
-
sdf.smoothIntersection(a, b, { radius: 5 })
|
|
70
|
-
|
|
71
|
-
// Method style (radius as direct argument)
|
|
72
|
-
a.smoothUnion(b, 5)
|
|
73
|
-
a.smoothSubtract(b, 5) // note: smoothSubtract, not smoothDifference
|
|
74
|
-
a.smoothIntersect(b, 5)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
> **API mismatch:** The factory functions take `{ radius }` (object). The instance methods take `radius` (number) directly. Don't mix them up.
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
80
|
-
// Example: rounded blob from sphere + box
|
|
81
|
-
const blob = sdf.smoothUnion(
|
|
82
|
-
sdf.sphere(15),
|
|
83
|
-
sdf.box(20, 20, 20),
|
|
84
|
-
{ radius: 6 }
|
|
85
|
-
).toShape().color('#4488cc');
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## TPMS Lattices
|
|
89
|
-
|
|
90
|
-
Triply Periodic Minimal Surfaces — ideal for lightweight infill, heat exchangers, and meta-materials.
|
|
91
|
-
|
|
92
|
-
```javascript
|
|
93
|
-
sdf.gyroid({ cellSize, thickness }) // most common for 3D printing
|
|
94
|
-
sdf.schwarzP({ cellSize, thickness }) // isotropic pores
|
|
95
|
-
sdf.diamond({ cellSize, thickness }) // stiffest TPMS structure
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
TPMS shapes fill all of space. **Always clip them** with an intersect:
|
|
99
|
-
|
|
100
|
-
```javascript
|
|
101
|
-
const lattice = sdf.gyroid({ cellSize: 8, thickness: 1.2 })
|
|
102
|
-
.intersect(sdf.sphere(25))
|
|
103
|
-
.toShape()
|
|
104
|
-
.color('#ffaa44');
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
| Parameter | Effect |
|
|
108
|
-
|-----------|--------|
|
|
109
|
-
| `cellSize` | Pattern scale — larger = coarser lattice |
|
|
110
|
-
| `thickness` | Wall thickness — thicker = denser |
|
|
111
|
-
|
|
112
|
-
## Transforms
|
|
113
|
-
|
|
114
|
-
```javascript
|
|
115
|
-
shape.translate(x, y, z)
|
|
116
|
-
shape.rotate(xDeg, yDeg, zDeg) // Euler angles, applied X→Y→Z
|
|
117
|
-
shape.scale(factor) // uniform scale only
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Domain Operations
|
|
121
|
-
|
|
122
|
-
Domain operations warp **space itself** rather than moving the shape. This creates effects impossible with standard transforms.
|
|
123
|
-
|
|
124
|
-
### Twist
|
|
125
|
-
|
|
126
|
-
Rotates slices around the Y axis as a function of Y position.
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
shape.twist(degreesPerUnit) // degrees per mm along Y
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
```javascript
|
|
133
|
-
// Twisted column: 45° total over 50mm height
|
|
134
|
-
const column = sdf.cylinder(50, 8).twist(0.9).toShape();
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Bend
|
|
138
|
-
|
|
139
|
-
Bends the shape around the Z axis in an arc.
|
|
140
|
-
|
|
141
|
-
```javascript
|
|
142
|
-
shape.bend(radius) // bend radius in mm — smaller = tighter arc
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
```javascript
|
|
146
|
-
// Arch: bend a cylinder into a half-circle
|
|
147
|
-
const arch = sdf.cylinder(60, 5).bend(20).toShape();
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Repeat
|
|
151
|
-
|
|
152
|
-
Tiles the shape in space. Spacing `0` on an axis = no repeat on that axis. Count `0` = infinite.
|
|
153
|
-
|
|
154
|
-
```javascript
|
|
155
|
-
shape.repeat([spacingX, spacingY, spacingZ])
|
|
156
|
-
shape.repeat([spacingX, spacingY, spacingZ], [countX, countY, countZ])
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```javascript
|
|
160
|
-
// 3×3×1 grid of spheres, 15mm apart
|
|
161
|
-
const grid = sdf.sphere(4).repeat([15, 15, 0], [3, 3, 0]).toShape();
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Shell
|
|
165
|
-
|
|
166
|
-
Hollows out a solid, keeping only a surface shell of given thickness.
|
|
167
|
-
|
|
168
|
-
```javascript
|
|
169
|
-
shape.shell(thickness)
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
```javascript
|
|
173
|
-
// Hollow sphere, cut open to show interior
|
|
174
|
-
const vessel = sdf.sphere(20)
|
|
175
|
-
.shell(2)
|
|
176
|
-
.subtract(sdf.box(60, 60, 30).translate(0, 0, -15))
|
|
177
|
-
.toShape();
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Displace
|
|
181
|
-
|
|
182
|
-
Offsets the surface by a function of position. Useful for surface texture, noise, and organic variation.
|
|
183
|
-
|
|
184
|
-
```javascript
|
|
185
|
-
shape.displace((x, y, z) => expression)
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
```javascript
|
|
189
|
-
// Bumpy sphere from sin-wave displacement
|
|
190
|
-
const bumpy = sdf.sphere(15)
|
|
191
|
-
.displace((x, y, z) => Math.sin(x * 0.8) * Math.sin(y * 0.8) * Math.sin(z * 0.8) * 2)
|
|
192
|
-
.toShape();
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
> **Critical gotcha:** The function body is serialized as a string and re-evaluated in a sandboxed context via `new Function("x","y","z", "return ...")`. This means:
|
|
196
|
-
> - **No closure variables** — you cannot reference `const speed = param(...)` inside the function
|
|
197
|
-
> - **Single expression only** — no `const`, `let`, `if`, `for` statements inside
|
|
198
|
-
> - Inline all constants: `(x, y, z) => Math.sin(x * 0.8) * 2.5` ✓
|
|
199
|
-
> - Multi-statement blocks **silently produce bad geometry**: `(x, y, z) => { const r = ...; return r; }` ✗
|
|
200
|
-
|
|
201
|
-
### Onion
|
|
202
|
-
|
|
203
|
-
Creates concentric shells like an onion cross-section.
|
|
204
|
-
|
|
205
|
-
```javascript
|
|
206
|
-
shape.onion(layers, thickness)
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
```javascript
|
|
210
|
-
// 3 concentric shells, 2mm apart
|
|
211
|
-
const onionSphere = sdf.sphere(20).onion(3, 2).toShape();
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Morphing
|
|
215
|
-
|
|
216
|
-
Interpolate between two SDF shapes. `t=0` returns `a`, `t=1` returns `b`.
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
sdf.morph(a, b, t) // factory
|
|
220
|
-
a.morph(b, t) // method
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
```javascript
|
|
224
|
-
// Show 5 morph stages
|
|
225
|
-
const stages = [0, 0.25, 0.5, 0.75, 1].map((t, i) =>
|
|
226
|
-
sdf.morph(sdf.sphere(12), sdf.box(20, 20, 20), t)
|
|
227
|
-
.toShape()
|
|
228
|
-
.translate(i * 30, 0, 0)
|
|
229
|
-
);
|
|
230
|
-
return stages;
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Custom SDF Functions
|
|
234
|
-
|
|
235
|
-
Define arbitrary geometry by writing a signed distance function directly.
|
|
236
|
-
|
|
237
|
-
```javascript
|
|
238
|
-
sdf.fromFunction(fn, { min: [x0, y0, z0], max: [x1, y1, z1] })
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
The function `fn(x, y, z)` must return the signed distance to the surface:
|
|
242
|
-
- **Negative** = point is inside the shape
|
|
243
|
-
- **Positive** = point is outside
|
|
244
|
-
- **Zero** = point is on the surface
|
|
245
|
-
|
|
246
|
-
Bounds are **required** — provide them tightly to avoid wasted computation.
|
|
247
|
-
|
|
248
|
-
```javascript
|
|
249
|
-
// Heart shape using algebraic SDF
|
|
250
|
-
const heart = sdf.fromFunction(
|
|
251
|
-
(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,
|
|
252
|
-
{ min: [-20, -25, -15], max: [20, 20, 15] }
|
|
253
|
-
).toShape();
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
> **Same gotcha as `displace()`:** The function body is serialized and re-evaluated — no closure variables, single expression only. All constants must be inlined.
|
|
257
|
-
|
|
258
|
-
### Hyperboloid example
|
|
259
|
-
|
|
260
|
-
```javascript
|
|
261
|
-
// Hyperboloid of one sheet: x²/a² + z²/b² - y²/c² = 1
|
|
262
|
-
const hyp = sdf.fromFunction(
|
|
263
|
-
(x, y, z) => Math.sqrt(x*x/100 + z*z/100) - Math.sqrt(1 + y*y/400) * 7,
|
|
264
|
-
{ min: [-25, -30, -25], max: [25, 30, 25] }
|
|
265
|
-
).toShape();
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## Converting to Shape
|
|
269
|
-
|
|
270
|
-
```javascript
|
|
271
|
-
shape.toShape()
|
|
272
|
-
shape.toShape({ edgeLength: 0.5 }) // finer mesh
|
|
273
|
-
shape.toShape({ bounds: { min: [...], max: [...] } }) // override auto bounds
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
| Option | Default | Effect |
|
|
277
|
-
|--------|---------|--------|
|
|
278
|
-
| `edgeLength` | `maxDim / 100` | Mesh resolution. Smaller = smoother but slower |
|
|
279
|
-
| `bounds` | auto-estimated | Override the sampling volume |
|
|
280
|
-
|
|
281
|
-
The auto edge length targets ~100 cells across the largest dimension. For smooth organic shapes, `edgeLength: 0.3–0.5` gives good results. For previews, `edgeLength: 1–2` is much faster.
|
|
282
|
-
|
|
283
|
-
## Mesh Quality
|
|
284
|
-
|
|
285
|
-
After meshing, ForgeCAD applies Laplacian smoothing + SDF projection to reduce the axis-aligned triangle pattern from Marching Tetrahedra. This runs automatically with 2 iterations.
|
|
286
|
-
|
|
287
|
-
## Workflow Tips
|
|
288
|
-
|
|
289
|
-
**Start coarse, refine last.** Use `edgeLength: 2` while designing, then drop to `0.5` for final output.
|
|
290
|
-
|
|
291
|
-
**Clip TPMS before toShape.** The lattice fills infinite space — always intersect with a bounding shape first, then call `.toShape()` on the intersected result.
|
|
292
|
-
|
|
293
|
-
**Compose before meshing.** Keep everything in SDF space as long as possible. Do all smooth booleans, deformations, and intersections before calling `.toShape()`. After conversion you're back in B-rep land and lose SDF capabilities.
|
|
294
|
-
|
|
295
|
-
**Mix with B-rep freely.** Once `.toShape()` is called, the result is a regular ForgeCAD Shape — use it in B-rep `difference()`, `union()`, `.fillet()`, etc.
|
|
296
|
-
|
|
297
|
-
```javascript
|
|
298
|
-
// SDF organic base + B-rep mechanical features
|
|
299
|
-
const organicBase = sdf.smoothUnion(sdf.sphere(20), sdf.box(30, 30, 10), { radius: 8 })
|
|
300
|
-
.toShape();
|
|
301
|
-
const hole = cylinder(15, 3);
|
|
302
|
-
return difference(organicBase, hole);
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
## Reserved Names
|
|
306
|
-
|
|
307
|
-
ForgeCAD's global scope defines `sphere`, `box`, `cylinder`, `torus`, `capsule`, `cone`, `shell` as top-level B-rep primitives. Inside SDF scripts, always access them via the `sdf.*` namespace prefix to avoid conflicts:
|
|
308
|
-
|
|
309
|
-
```javascript
|
|
310
|
-
// ✗ Ambiguous / shadows global
|
|
311
|
-
const s = sphere(10); // this is the B-rep sphere, not SDF
|
|
312
|
-
|
|
313
|
-
// ✓ Explicit
|
|
314
|
-
const s = sdf.sphere(10); // SDF sphere — correct
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
When naming local variables, avoid shadowing these globals:
|
|
318
|
-
|
|
319
|
-
```javascript
|
|
320
|
-
// ✗ Shadows global 'sphere'
|
|
321
|
-
const sphere = sdf.sphere(10).smoothUnion(...);
|
|
322
|
-
|
|
323
|
-
// ✓ Use a descriptive name
|
|
324
|
-
const orb = sdf.sphere(10).smoothUnion(...);
|
|
325
|
-
const boundSphere = sdf.sphere(30);
|
|
326
|
-
```
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: cli
|
|
3
|
-
skill-order: 1
|
|
4
|
-
skill-tiers: [one-file]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# ForgeCAD CLI — Commands for AI Agents
|
|
8
|
-
|
|
9
|
-
The CLI is the primary interface for AI agents working with ForgeCAD. Models are authored as `.forge.js` scripts and managed as projects on **forgecad.io**.
|
|
10
|
-
|
|
11
|
-
## Workflow
|
|
12
|
-
|
|
13
|
-
1. **`forgecad.io`** is the main platform — projects, shared files, collaboration, and the web editor all live there.
|
|
14
|
-
2. **`forgecad dev`** / **`forgecad studio`** run the editor locally for offline work or development.
|
|
15
|
-
3. **CLI project/file commands** let agents create, manage, and sync projects without a browser.
|
|
16
|
-
|
|
17
|
-
For developer/CI commands, see the full [CLI.md](../../CLI.md).
|
|
18
|
-
|
|
19
|
-
## Authentication
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
forgecad login # Authenticate with forgecad.io
|
|
23
|
-
forgecad login --server http://localhost:5174 # Local dev server
|
|
24
|
-
forgecad logout
|
|
25
|
-
forgecad whoami # Show user, server, license
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Project Management
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# Create and sync
|
|
32
|
-
forgecad project init "My Project" # Create project on server + link current dir
|
|
33
|
-
forgecad project init "My Project" --slug my-project --visibility public
|
|
34
|
-
forgecad project clone my-project # Download project to ./my-project/
|
|
35
|
-
forgecad project push [--force] # Upload local changes
|
|
36
|
-
forgecad project pull [--force] # Download remote changes
|
|
37
|
-
forgecad project status # Show local vs remote diff
|
|
38
|
-
|
|
39
|
-
# Inspect and modify
|
|
40
|
-
forgecad project list # List all your projects
|
|
41
|
-
forgecad project info # Show current project details
|
|
42
|
-
forgecad project rename "New Name" # Rename the project
|
|
43
|
-
forgecad project set-visibility public # Change visibility (private|shared|public)
|
|
44
|
-
forgecad project delete [--force] # Permanently delete project and all files
|
|
45
|
-
forgecad project open # Open in browser
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## File Management (Remote)
|
|
49
|
-
|
|
50
|
-
Operate directly on remote project files without push/pull:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
forgecad file list [path] # List remote files
|
|
54
|
-
forgecad file read <path> # Print file contents to stdout
|
|
55
|
-
forgecad file save <path> # Upload local file to remote
|
|
56
|
-
forgecad file save <path> --content "code here" # Save inline content
|
|
57
|
-
cat model.forge.js | forgecad file save model.forge.js --stdin # Pipe content
|
|
58
|
-
forgecad file delete <path> [--force] # Delete remote file
|
|
59
|
-
forgecad file rename <old> <new> # Rename/move remote file
|
|
60
|
-
forgecad file mkdir <path> # Create remote directory
|
|
61
|
-
forgecad file copy <source-slug> <path> [--dest <dest-path>] # Copy from another project
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Member Management
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
forgecad project members # List project members
|
|
68
|
-
forgecad project add-member alice@example.com # Add as editor (default)
|
|
69
|
-
forgecad project add-member bob@example.com --role viewer # Add as viewer
|
|
70
|
-
forgecad project remove-member alice@example.com
|
|
71
|
-
forgecad project set-role bob@example.com editor
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Roles: **owner** (full control), **editor** (read/write files), **viewer** (read-only).
|
|
75
|
-
|
|
76
|
-
## Publishing & Sharing
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
forgecad publish model.forge.js --title "My Model" # Publish, get shareable URL
|
|
80
|
-
forgecad shares list # List all published models
|
|
81
|
-
forgecad shares delete <share-id> [--force] # Unpublish
|
|
82
|
-
forgecad link <gist-url-or-id> # Share link from GitHub Gist
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Published models are viewable at `forgecad.io/m/<shareId>`. Shares are **live references** to project files — always the current version, not a snapshot. Publishing requires a project.
|
|
86
|
-
|
|
87
|
-
## New File from Template
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
forgecad new mypart # Part template (default)
|
|
91
|
-
forgecad new bracket --template sketch # Sketch template
|
|
92
|
-
forgecad new robot --template assembly # Assembly template
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Script Validation
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
forgecad run examples/cup.forge.js
|
|
99
|
-
forgecad run examples/demo.forge-notebook.json
|
|
100
|
-
forgecad run examples/cup.forge.js --debug-imports
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Runs a `.forge.js` or notebook preview cell in the real runtime and prints object stats, diagnostics, and execution time. `--debug-imports` traces import chains.
|
|
104
|
-
|
|
105
|
-
## Notebook Cells
|
|
106
|
-
|
|
107
|
-
Notebooks live in `.forge-notebook.json` files. Cells share state top-to-bottom. `show(value)` pins geometry in the viewport.
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# Append and run a new cell
|
|
111
|
-
forgecad notebook examples/demo.forge-notebook.json --code "show(box(40, 20, 10));"
|
|
112
|
-
|
|
113
|
-
# Re-run the preview cell
|
|
114
|
-
forgecad notebook examples/demo.forge-notebook.json
|
|
115
|
-
|
|
116
|
-
# View notebook in terminal
|
|
117
|
-
forgecad notebook view examples/demo.forge-notebook.json preview
|
|
118
|
-
|
|
119
|
-
# Export to .forge.js
|
|
120
|
-
forgecad notebook export examples/demo.forge-notebook.json
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Passing `.forge-notebook.json` to `run`, `render`, or `capture` uses the preview cell automatically.
|
|
124
|
-
|
|
125
|
-
## PNG Render
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
forgecad render examples/cup.forge.js [output.png]
|
|
129
|
-
forgecad render examples/demo.forge-notebook.json [output.png]
|
|
130
|
-
forgecad render examples/cup.forge.js out/scene.png --scene '<json>'
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Renders 3D shapes to PNG from multiple camera angles. Uses headless Chrome with WebGL.
|
|
134
|
-
|
|
135
|
-
**Options:** `--angles <front,side,top,iso>`, `--size <px>`, `--camera <spec>`, `--scene <json>`, `--background <color>`
|
|
136
|
-
|
|
137
|
-
## Animated Capture (GIF / MP4)
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
forgecad capture gif examples/cup.forge.js [output.gif]
|
|
141
|
-
forgecad capture mp4 examples/cup.forge.js [output.mp4]
|
|
142
|
-
forgecad capture gif examples/demo.forge.js --capture animation --animation "Walk Cycle"
|
|
143
|
-
forgecad capture gif examples/demo.forge.js --cut-plane "Front Section"
|
|
144
|
-
forgecad capture gif examples/demo.forge.js --list # show available animations/cut planes
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Creates animated captures: orbit, `jointsView()` animation clips, or named cut-plane sweeps.
|
|
148
|
-
|
|
149
|
-
**Key options:** `--capture <orbit|animation>`, `--animation <name>`, `--size <px>`, `--fps <n>`, `--frames-per-turn <n>`, `--camera <spec>`, `--scene <json>`
|
|
150
|
-
|
|
151
|
-
**UI handoff:** Use `Copy CLI --scene` in the View Panel to grab the current viewport state.
|
|
152
|
-
|
|
153
|
-
## Parameter Validation
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
forgecad check params examples/shoe-rack.forge.js [--samples 10]
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Samples each parameter across its range and checks for runtime errors, degenerate geometry (volume ≈ 0), and part collisions.
|
|
160
|
-
|
|
161
|
-
## Export Commands
|
|
162
|
-
|
|
163
|
-
### SVG Export
|
|
164
|
-
```bash
|
|
165
|
-
forgecad export svg examples/sketch.forge.js [output.svg]
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### STEP / BREP Export
|
|
169
|
-
```bash
|
|
170
|
-
forgecad export step examples/part.forge.js
|
|
171
|
-
forgecad export step examples/part.forge.js --output out/demo.step --allow-faceted
|
|
172
|
-
```
|
|
173
|
-
Exact-subset only by default. `--allow-faceted` allows mesh fallback for unsupported solids.
|
|
174
|
-
|
|
175
|
-
### G-code Toolpath Export
|
|
176
|
-
```bash
|
|
177
|
-
forgecad export gcode examples/gcode/vase.forge.js
|
|
178
|
-
```
|
|
179
|
-
Script must return a `GCodeBuilder` instance. This is a toolpath scripting API, not a slicer.
|
|
180
|
-
|
|
181
|
-
### SDF Robot Export (Gazebo)
|
|
182
|
-
```bash
|
|
183
|
-
forgecad export sdf examples/rover.forge.js
|
|
184
|
-
```
|
|
185
|
-
Writes a Gazebo-friendly package with SDF models, STL meshes, and optional demo world.
|
|
186
|
-
|
|
187
|
-
### PDF Report
|
|
188
|
-
```bash
|
|
189
|
-
forgecad export report examples/cup.forge.js [output.pdf]
|
|
190
|
-
```
|
|
191
|
-
Generates a searchable PDF with projected drawing views, BOM page, and `dim()` annotations.
|
|
192
|
-
|
|
193
|
-
### STL Export
|
|
194
|
-
Available in the browser UI via the Export panel.
|