forgecad 0.6.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/README.md +3 -12
  2. package/dist/assets/{AdminPage-CeqCUUgu.js → AdminPage-D4bocK4E.js} +250 -151
  3. package/dist/assets/{BlogPage-P_AJP0v9.js → BlogPage-CJEXL_zJ.js} +94 -70
  4. package/dist/assets/{DocsPage-CKRV2iq2.js → DocsPage-D3A_g8V3.js} +329 -163
  5. package/dist/assets/{EditorApp-CnC2k4cW.css → EditorApp-BWYUSpUN.css} +590 -136
  6. package/dist/assets/EditorApp-Cihhqcsq.js +11692 -0
  7. package/dist/assets/{EmbedViewer-DBlzmQ5i.js → EmbedViewer-kWjKaC_t.js} +2 -4
  8. package/dist/assets/LandingPageProofDriven-Bg2IUc3l.css +856 -0
  9. package/dist/assets/LandingPageProofDriven-DXkKlyhI.js +601 -0
  10. package/dist/assets/PricingPage-BsU5vzEx.js +232 -0
  11. package/dist/assets/{SettingsPage-BqCh9JcC.js → SettingsPage-PqvpAKIs.js} +129 -5
  12. package/dist/assets/{evalWorker-Ql-aKwLA.js → evalWorker-C-hzNUMy.js} +8949 -3161
  13. package/dist/assets/{Viewport-CoB46f5R.js → index-Pz321YAt.js} +38382 -7501
  14. package/dist/assets/{index-2hfs_ub0.css → index-ay13WNfa.css} +726 -53
  15. package/dist/assets/{javascript-DCxGoE5Y.js → javascript-DAl8Gmyo.js} +1 -1
  16. package/dist/assets/{manifold-CqNMHHKO.js → manifold-BcbjWLIo.js} +4 -3
  17. package/dist/assets/{manifold-Cce9wRFz.js → manifold-DBckbFgx.js} +1 -1
  18. package/dist/assets/{manifold-D6BeHIOo.js → manifold-O2AAGXyj.js} +1 -1
  19. package/dist/assets/{reportWorker-sFEFonXf.js → reportWorker-Dxr-5A7w.js} +8760 -3559
  20. package/dist/assets/{vendor-react-Dt7-aaJH.js → vendor-react-CG3i_wp0.js} +65 -8
  21. package/dist/docs/index.html +2 -2
  22. package/dist/docs-raw/CLI.md +341 -718
  23. package/dist/docs-raw/generated/assembly.md +699 -112
  24. package/dist/docs-raw/generated/concepts.md +1834 -1346
  25. package/dist/docs-raw/generated/core.md +1012 -1059
  26. package/dist/docs-raw/generated/curves.md +759 -116
  27. package/dist/docs-raw/generated/lib.md +43 -748
  28. package/dist/docs-raw/generated/output.md +139 -245
  29. package/dist/docs-raw/generated/sdf.md +208 -0
  30. package/dist/docs-raw/generated/sheet-metal.md +473 -21
  31. package/dist/docs-raw/generated/sketch.md +1518 -362
  32. package/dist/docs-raw/generated/viewport.md +368 -299
  33. package/dist/docs-raw/generated/wood.md +104 -0
  34. package/dist/index.html +2 -2
  35. package/dist/landing/proof-ams-adapter.png +0 -0
  36. package/dist/landing/proof-bolt-and-nut.png +0 -0
  37. package/dist/landing/proof-fillet-enclosure.png +0 -0
  38. package/dist/landing/proof-glasses.png +0 -0
  39. package/dist/landing/proof-gyroid.png +0 -0
  40. package/dist/sitemap.xml +6 -6
  41. package/dist-cli/forgecad.js +12321 -5700
  42. package/dist-cli/forgecad.js.map +1 -0
  43. package/dist-cli/solver-46FFSK2U.js +363 -0
  44. package/dist-cli/solver-46FFSK2U.js.map +1 -0
  45. package/dist-skill/CONTEXT.md +4890 -6302
  46. package/dist-skill/SKILL-dev.md +22 -66
  47. package/dist-skill/SKILL.md +20 -59
  48. package/dist-skill/docs/API/core/concepts.md +37 -92
  49. package/dist-skill/docs/CLI.md +341 -718
  50. package/dist-skill/docs/generated/assembly.md +699 -112
  51. package/dist-skill/docs/generated/core.md +1012 -1059
  52. package/dist-skill/docs/generated/curves.md +759 -116
  53. package/dist-skill/docs/generated/lib.md +43 -748
  54. package/dist-skill/docs/generated/output.md +139 -245
  55. package/dist-skill/docs/generated/sdf.md +208 -0
  56. package/dist-skill/docs/generated/sheet-metal.md +473 -21
  57. package/dist-skill/docs/generated/sketch.md +1518 -362
  58. package/dist-skill/docs/generated/viewport.md +368 -299
  59. package/dist-skill/docs/generated/wood.md +104 -0
  60. package/dist-skill/docs/guides/coordinate-system.md +11 -17
  61. package/dist-skill/docs/guides/geometry-conventions.md +13 -70
  62. package/dist-skill/docs/guides/joint-design.md +78 -0
  63. package/dist-skill/docs/guides/modeling-recipes.md +22 -195
  64. package/dist-skill/docs/guides/positioning.md +88 -147
  65. package/dist-skill/docs-dev/API/core/concepts.md +78 -0
  66. package/dist-skill/docs-dev/CLI.md +488 -0
  67. package/dist-skill/{docs → docs-dev}/blueprint-first.md +5 -0
  68. package/dist-skill/{docs → docs-dev}/coding-best-practices.md +6 -8
  69. package/dist-skill/{docs → docs-dev}/coding.md +2 -4
  70. package/dist-skill/docs-dev/component-model.md +164 -0
  71. package/dist-skill/docs-dev/generated/assembly.md +779 -0
  72. package/dist-skill/docs-dev/generated/core.md +1676 -0
  73. package/dist-skill/docs-dev/generated/curves.md +855 -0
  74. package/dist-skill/docs-dev/generated/lib.md +55 -0
  75. package/dist-skill/docs-dev/generated/output.md +234 -0
  76. package/dist-skill/docs-dev/generated/sdf.md +208 -0
  77. package/dist-skill/docs-dev/generated/sheet-metal.md +506 -0
  78. package/dist-skill/docs-dev/generated/sketch.md +1753 -0
  79. package/dist-skill/docs-dev/generated/viewport.md +513 -0
  80. package/dist-skill/docs-dev/generated/wood.md +104 -0
  81. package/dist-skill/docs-dev/guides/coordinate-system.md +46 -0
  82. package/dist-skill/docs-dev/guides/geometry-conventions.md +52 -0
  83. package/dist-skill/docs-dev/guides/joint-design.md +78 -0
  84. package/dist-skill/docs-dev/guides/modeling-recipes.md +77 -0
  85. package/dist-skill/docs-dev/guides/positioning.md +151 -0
  86. package/dist-skill/{docs → docs-dev}/guides/skill-maintenance.md +21 -10
  87. package/dist-skill/{docs → docs-dev}/internals/compiler.md +5 -6
  88. package/dist-skill/{docs → docs-dev}/internals/constraint-solver-quality.md +0 -1
  89. package/dist-skill/{docs → docs-dev}/internals/constraint-solver.md +0 -1
  90. package/dist-skill/{docs → docs-dev}/internals/sketch-2d-pipeline.md +2 -3
  91. package/examples/api/attachTo-basics.forge.js +8 -8
  92. package/examples/api/bill-of-materials.forge.js +9 -9
  93. package/examples/api/bolt-pattern.forge.js +5 -5
  94. package/examples/api/boolean-operations.forge.js +5 -5
  95. package/examples/api/bounding-box-visualizer.forge.js +3 -3
  96. package/examples/api/clone-duplicate.forge.js +2 -2
  97. package/examples/api/colors-union-vs-array.forge.js +6 -6
  98. package/examples/api/connector-assembly.forge.js +8 -6
  99. package/examples/api/connector-basics.forge.js +7 -7
  100. package/examples/api/constrained-sketch-mechanical.forge.js +4 -4
  101. package/examples/api/elbow-test.forge.js +3 -3
  102. package/examples/api/extrude-options.forge.js +8 -14
  103. package/examples/api/feature-created-faces.forge.js +6 -10
  104. package/examples/api/fillet-showcase.forge.js +2 -2
  105. package/examples/api/folded-service-panel-cover.forge.js +2 -2
  106. package/examples/api/gears-tier1.forge.js +5 -5
  107. package/examples/api/group-test.forge.js +3 -3
  108. package/examples/api/group-vs-union.forge.js +1 -1
  109. package/examples/api/highlight-debug.forge.js +4 -0
  110. package/examples/api/js-module-pillars.js +1 -1
  111. package/examples/api/js-module-scene.js +2 -2
  112. package/examples/api/mesh-import-slats.forge.js +4 -4
  113. package/examples/api/patterns.forge.js +3 -3
  114. package/examples/api/pointAlong-orientation.forge.js +3 -3
  115. package/examples/api/profile-2020-b-slot6.forge.js +4 -5
  116. package/examples/api/route-perimeter-flange.forge.js +1 -1
  117. package/examples/api/sdf-rover-demo.forge.js +10 -10
  118. package/examples/api/sketch-on-face-demo.forge.js +2 -2
  119. package/examples/api/sketch-regions.forge.js +4 -4
  120. package/examples/api/sketch-rounding-strategies.forge.js +1 -1
  121. package/examples/api/smooth-curve-connections.forge.js +1 -1
  122. package/examples/api/transition-curves.forge.js +4 -4
  123. package/examples/api/variable-sweep-pure-sdf-test.forge.js +162 -0
  124. package/examples/api/variable-sweep-test.forge.js +2 -2
  125. package/examples/api/wood-joinery.forge.js +60 -0
  126. package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +3 -3
  127. package/examples/compiler-corpus/fastener-plate-variants.forge.js +2 -2
  128. package/examples/constraints/01-fully-constrained-rect.forge.js +2 -2
  129. package/examples/constraints/02-underconstrained-triangle.forge.js +1 -1
  130. package/examples/constraints/03-redundant-constraints.forge.js +2 -2
  131. package/examples/constraints/05-parallel-with-linedistance.forge.js +2 -2
  132. package/examples/constraints/06-complex-spectrogram.forge.js +1 -1
  133. package/examples/constraints/07-perpendicular-chain.forge.js +4 -4
  134. package/examples/constraints/08-symmetric-bracket.forge.js +4 -4
  135. package/examples/constraints/09-stress-spiral.forge.js +1 -1
  136. package/examples/constraints/10-stress-honeycomb.forge.js +1 -1
  137. package/examples/constraints/11-surface-grid.forge.js +2 -2
  138. package/examples/constraints/12-surface-nested.forge.js +4 -4
  139. package/examples/constraints/13-surface-complex.forge.js +1 -1
  140. package/examples/exact-arc-housing.forge.js +12 -0
  141. package/examples/experiments/drone-arm.forge.js +53 -0
  142. package/examples/furniture/adjustable-table.forge.js +15 -15
  143. package/examples/furniture/bathroom.forge.js +26 -26
  144. package/examples/furniture/chair.forge.js +13 -13
  145. package/examples/furniture/picture-frame.forge.js +6 -6
  146. package/examples/furniture/shoe-rack-doors.forge.js +8 -8
  147. package/examples/furniture/shoe-rack.forge.js +7 -7
  148. package/examples/furniture/table-lamp.forge.js +8 -8
  149. package/examples/gcode/lissajous-vase.forge.js +4 -4
  150. package/examples/gcode/math-surface.forge.js +3 -3
  151. package/examples/gcode/parametric-vase.forge.js +4 -4
  152. package/examples/gcode/spiral-tower.forge.js +4 -4
  153. package/examples/generative/crystal-growth.forge.js +9 -9
  154. package/examples/generative/frost-spires.forge.js +9 -9
  155. package/examples/generative/golden-spiral-tower.forge.js +11 -11
  156. package/examples/generative/molten-forge.forge.js +6 -6
  157. package/examples/generative/neon-coral.forge.js +7 -7
  158. package/examples/mechanical/3d-printer.forge.js +37 -37
  159. package/examples/mechanical/5-finger-robot-hand.forge.js +19 -19
  160. package/examples/mechanical/airplane-propeller.forge.js +9 -9
  161. package/examples/mechanical/bolt-and-nut.forge.js +10 -10
  162. package/examples/mechanical/door-with-hinges.forge.js +7 -7
  163. package/examples/mechanical/fillet-enclosure.forge.js +15 -11
  164. package/examples/mechanical/headphone-hanger-v2.forge.js +11 -11
  165. package/examples/mechanical/robot_hand.forge.js +24 -24
  166. package/examples/mechanical/robot_hand_2.forge.js +26 -26
  167. package/examples/nurbs-surface.forge.js +8 -0
  168. package/examples/nurbs-tube.forge.js +7 -0
  169. package/examples/products/bottle.forge.js +8 -8
  170. package/examples/products/chess-set.forge.js +25 -25
  171. package/examples/products/classical-piano.forge.js +20 -20
  172. package/examples/products/clock.forge.js +33 -33
  173. package/examples/products/cup.forge.js +5 -5
  174. package/examples/products/iphone.forge.js +20 -20
  175. package/examples/products/laptop.forge.js +24 -24
  176. package/examples/products/laser-cut-box.forge.js +6 -6
  177. package/examples/products/laser-cut-tray.forge.js +6 -6
  178. package/examples/products/liquid-soap-dispenser.forge.js +23 -23
  179. package/examples/products/origami-fish.forge.js +14 -12
  180. package/examples/products/spiderman-cake.forge.js +6 -6
  181. package/examples/shelf/container.forge.js +5 -5
  182. package/examples/shelf/shelf-unit.forge.js +6 -6
  183. package/examples/toolbox/bolted-joint.forge.js +7 -7
  184. package/package.json +9 -4
  185. package/dist/assets/EditorApp-B-vQvgam.js +0 -9888
  186. package/dist/assets/LandingPage-C5n9hDXI.js +0 -322
  187. package/dist/assets/PublishedModelPage-Dt7PCVBj.js +0 -146
  188. package/dist/assets/__vite-browser-external-CURh0WXD.js +0 -8
  189. package/dist/assets/deserializeRunResult-BLAFoiE0.js +0 -19365
  190. package/dist/assets/index-1CYp3zUp.js +0 -1455
  191. package/dist-skill/docs/API/API.md +0 -1666
  192. package/dist-skill/docs/API/README.md +0 -37
  193. package/dist-skill/docs/API/assembly/assembly.md +0 -617
  194. package/dist-skill/docs/API/core/edge-queries.md +0 -130
  195. package/dist-skill/docs/API/core/parameters.md +0 -122
  196. package/dist-skill/docs/API/core/reserved-terms.md +0 -137
  197. package/dist-skill/docs/API/core/sdf.md +0 -326
  198. package/dist-skill/docs/API/core/skill-cli.md +0 -194
  199. package/dist-skill/docs/API/core/skill-guide.md +0 -205
  200. package/dist-skill/docs/API/core/specs.md +0 -186
  201. package/dist-skill/docs/API/core/topology.md +0 -372
  202. package/dist-skill/docs/API/entities.md +0 -268
  203. package/dist-skill/docs/API/output/bom.md +0 -58
  204. package/dist-skill/docs/API/output/brep-export.md +0 -87
  205. package/dist-skill/docs/API/output/dimensions.md +0 -67
  206. package/dist-skill/docs/API/output/export.md +0 -110
  207. package/dist-skill/docs/API/output/gcode.md +0 -195
  208. package/dist-skill/docs/API/runtime/viewport.md +0 -420
  209. package/dist-skill/docs/API/sheet-metal/sheet-metal.md +0 -185
  210. package/dist-skill/docs/API/sketch/anchor.md +0 -37
  211. package/dist-skill/docs/API/sketch/booleans.md +0 -91
  212. package/dist-skill/docs/API/sketch/core.md +0 -73
  213. package/dist-skill/docs/API/sketch/extrude.md +0 -62
  214. package/dist-skill/docs/API/sketch/on-face.md +0 -104
  215. package/dist-skill/docs/API/sketch/operations.md +0 -78
  216. package/dist-skill/docs/API/sketch/path.md +0 -75
  217. package/dist-skill/docs/API/sketch/primitives.md +0 -146
  218. package/dist-skill/docs/API/sketch/regions.md +0 -80
  219. package/dist-skill/docs/API/sketch/text.md +0 -108
  220. package/dist-skill/docs/API/sketch/transforms.md +0 -65
  221. package/dist-skill/docs/API/toolbox/fasteners.md +0 -129
  222. package/dist-skill/docs/INDEX.md +0 -94
  223. package/dist-skill/docs/RELEASING.md +0 -55
  224. package/dist-skill/docs/cli-monetization.md +0 -111
  225. package/dist-skill/docs/deployment.md +0 -281
  226. package/dist-skill/docs/generated/concepts.md +0 -2112
  227. package/dist-skill/docs/internals/shape-from-slices.md +0 -152
  228. package/dist-skill/docs/platform/admin.md +0 -45
  229. package/dist-skill/docs/platform/architecture.md +0 -79
  230. package/dist-skill/docs/platform/auth.md +0 -110
  231. package/dist-skill/docs/platform/email.md +0 -67
  232. package/dist-skill/docs/platform/projects.md +0 -111
  233. package/dist-skill/docs/platform/sharing.md +0 -90
  234. package/dist-skill/docs/runbook.md +0 -345
@@ -1,91 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 5
4
- ---
5
-
6
- # Sketch Booleans
7
-
8
- 2D boolean operations for combining, subtracting, and intersecting sketches.
9
-
10
- ## Methods
11
-
12
- ### `.add(...others)`
13
- Combines sketches (union). Accepts `sketch.add(a, b)` and `sketch.add([a, b])`.
14
-
15
- ```javascript
16
- const combined = rect(50, 30).add(
17
- circle2d(20).translate(25, 15),
18
- ngon(6, 15).translate(40, 15)
19
- );
20
- ```
21
-
22
- ### `.subtract(...others)`
23
- Subtracts one or more sketches from this one. Accepts `sketch.subtract(a, b)` and `sketch.subtract([a, b])`.
24
-
25
- ```javascript
26
- const plate = rect(100, 80);
27
- const hole = circle2d(10);
28
- const slotCut = rect(18, 8).translate(41, 36);
29
- const result = plate.subtract(hole.translate(25, 40), slotCut);
30
- ```
31
-
32
- ### `.intersect(...others)`
33
- Keeps only the area shared by every operand. Accepts `sketch.intersect(a, b)` and `sketch.intersect([a, b])`.
34
-
35
- ```javascript
36
- const overlap = rect(50, 50).intersect(
37
- circle2d(30).translate(25, 25),
38
- rect(40, 20).translate(5, 15)
39
- );
40
- ```
41
-
42
- ## Functions
43
-
44
- ### `union2d(...sketches)`
45
- Combines multiple sketches into one.
46
-
47
- ```javascript
48
- const combined = union2d(
49
- rect(50, 30),
50
- circle2d(20).translate(25, 15),
51
- ngon(6, 15).translate(75, 15)
52
- );
53
- ```
54
-
55
- `union2d([a, b, c])` is also supported when your sketches are already in an array.
56
-
57
- ### `difference2d(...sketches)`
58
- Subtracts sketches[1..n] from sketches[0].
59
-
60
- ```javascript
61
- const plate = rect(100, 80);
62
- const hole1 = circle2d(10).translate(25, 40);
63
- const hole2 = circle2d(10).translate(75, 40);
64
- const result = difference2d(plate, hole1, hole2);
65
- ```
66
-
67
- `difference2d([base, cutter1, cutter2])` works too.
68
-
69
- ### `intersection2d(...sketches)`
70
- Keeps only the area where all sketches overlap.
71
-
72
- ```javascript
73
- const overlap = intersection2d(
74
- rect(50, 50),
75
- circle2d(30).translate(25, 25)
76
- );
77
- ```
78
-
79
- `intersection2d([a, b, c])` is also supported.
80
-
81
- ## Performance Note
82
-
83
- The multi-argument functions (`union2d`, `difference2d`, `intersection2d`) use Manifold's batch operations internally, which are faster than chaining `.add()` / `.subtract()` calls one by one. Prefer them when combining many sketches.
84
-
85
- ```javascript
86
- // Fast — single batch operation
87
- const combined = union2d(s1, s2, s3, s4, s5);
88
-
89
- // Slower — sequential pairwise operations
90
- const combined = s1.add(s2).add(s3).add(s4).add(s5);
91
- ```
@@ -1,73 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 1
4
- ---
5
-
6
- # Sketch Core
7
-
8
- The `Sketch` class is an immutable wrapper around Manifold's `CrossSection` that provides a chainable 2D API.
9
-
10
- ## Class: Sketch
11
-
12
- Represents a 2D profile that can be transformed, combined with other sketches, or converted to 3D.
13
-
14
- ### Color
15
-
16
- #### `.color(hex: string): Sketch`
17
- Set the display color of this sketch. Returns a new Sketch.
18
-
19
- ```javascript
20
- const red = rect(50, 30).color('#ff0000');
21
- const blue = circle2d(25).color('#0066ff');
22
- ```
23
-
24
- Colors are preserved through transforms and boolean operations.
25
-
26
- #### `.clone()` / `.duplicate()`
27
- Create an explicit duplicate of a sketch wrapper.
28
-
29
- ```javascript
30
- const base = rect(50, 30);
31
- const a = base.clone();
32
- const b = base.duplicate().translate(60, 0);
33
- ```
34
-
35
- ### Query Methods
36
-
37
- #### `.area(): number`
38
- Returns the area of the sketch.
39
-
40
- ```javascript
41
- const sq = rect(50, 50);
42
- console.log(sq.area()); // 2500
43
- ```
44
-
45
- #### `.bounds()`
46
- Returns the bounding box: `{ min: [x, y], max: [x, y] }`.
47
-
48
- ```javascript
49
- const c = circle2d(25);
50
- const b = c.bounds();
51
- // b.min ≈ [-25, -25], b.max ≈ [25, 25]
52
- ```
53
-
54
- #### `.isEmpty(): boolean`
55
- Returns true if the sketch has no area.
56
-
57
- #### `.numVert(): number`
58
- Returns the number of vertices in the contour.
59
-
60
- #### `.toPolygons()`
61
- Returns raw polygon contours for rendering (internal use).
62
-
63
- ## Type: Anchor
64
-
65
- Anchor points for positioning sketches:
66
- - `'center'` — geometric center
67
- - `'top-left'`, `'top-right'`, `'bottom-left'`, `'bottom-right'` — corners
68
- - `'top'`, `'bottom'`, `'left'`, `'right'` — edge midpoints
69
-
70
- ## Dimensions
71
-
72
- Use `dim()` / `dimLine()` for visual measurement callouts and report annotations.
73
- See [../output/dimensions.md](../output/dimensions.md) for options and ownership behavior.
@@ -1,62 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 8
4
- ---
5
-
6
- # Sketch Extrude & Revolve
7
-
8
- Convert 2D sketches into 3D shapes through extrusion or revolution. The sketch's color (if set) is carried over to the resulting Shape.
9
-
10
- If a sketch has been placed with [`onFace()`](sketch-on-face.md), extrusion follows that face normal instead of the global Z axis.
11
-
12
- ## Methods
13
-
14
- ### `.extrude(height, options?)`
15
- Extrudes sketch along Z axis.
16
-
17
- **Parameters:**
18
- - `height` (number) - Extrusion height
19
- - `options` (object, optional):
20
- - `twist` (number) - Twist angle in degrees
21
- - `divisions` (number) - Number of twist steps (needed for twist)
22
- - `scaleTop` (number | [number, number]) - Scale factor at top
23
- - `center` (boolean) - Center along Z axis
24
-
25
- **Returns:** `TrackedShape` (with faces: top, bottom, side)
26
-
27
- ```javascript
28
- const simple = rect(50, 30).extrude(10);
29
-
30
- const twisted = ngon(6, 20).extrude(60, {
31
- twist: 90,
32
- divisions: 32
33
- });
34
-
35
- const tapered = circle2d(20).extrude(50, {
36
- scaleTop: 0.5
37
- });
38
-
39
- const badge = roundedRect(28, 10, 2, true)
40
- .onFace(box(120, 60, 40, true), 'front', { v: 8 })
41
- .extrude(2);
42
- ```
43
-
44
- ### `.revolve(degrees?, segments?)`
45
- Revolves sketch around Y axis (becomes Z in result).
46
-
47
- Performance tip: prefer `revolve()` over `loft()` whenever the part is rotationally symmetric. Loft is for profile interpolation and is substantially heavier.
48
-
49
- **Parameters:**
50
- - `degrees` (number, optional) - Rotation angle. Default: 360 (full revolution)
51
- - `segments` (number, optional) - Number of segments. Default: auto
52
-
53
- **Returns:** `Shape`
54
-
55
- ```javascript
56
- // Vase profile
57
- const profile = polygon([[20, 0], [25, 30], [20, 60]]);
58
- const vase = profile.revolve();
59
-
60
- // Partial revolution (C-shape)
61
- const partial = rect(5, 40).translate(20, 0).revolve(270);
62
- ```
@@ -1,104 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 7
4
- ---
5
-
6
- # Sketch On Face
7
-
8
- Attach a 2D sketch to a 3D face so it renders in-place and extrudes along that face normal.
9
-
10
- This supports:
11
- - canonical body faces: `front`, `back`, `left`, `right`, `top`, `bottom`
12
- - tracked planar faces on `TrackedShape`, like `side-left`
13
- - direct `FaceRef` targets from `tracked.face('top')`
14
- - supported compiler-owned created faces on `shell()` / `hole()` / `cutout()` results, such as `inner-side-right`, `floor`, `counterbore-floor`, and `wall-right`
15
- - supported compiler-owned created faces on `shell()` / `hole()` / `cutout()` results, such as `inner-side-right`, `floor`, `counterbore-floor`, and `wall-right`
16
- - defended preserved faces on compile-covered boolean results when one propagated descendant keeps a unique name
17
- - direct `FaceRef` targets from preserved/repeated descendants that still validate against a later compile-covered boolean target
18
-
19
- ## `.onFace(parent, face, opts?)`
20
-
21
- Places a sketch onto a parent face using face-local coordinates.
22
-
23
- **Parameters:**
24
- - `parent` (`Shape | TrackedShape`) - target body
25
- - `face` (`'front' | 'back' | 'left' | 'right' | 'top' | 'bottom' | string | FaceRef`)
26
- - `opts` (object, optional):
27
- - `u` (number) - face-local horizontal offset from the face center
28
- - `v` (number) - face-local vertical offset from the face center
29
- - `protrude` (number) - offset along the face normal. Positive = outward
30
- - `selfAnchor` (`Anchor`) - which 2D sketch anchor aligns to the face center. Default: `'center'`
31
-
32
- **Returns:** `Sketch`
33
-
34
- ## `.onFace(faceRef, opts?)`
35
-
36
- Places a sketch directly from a tracked or compiler-owned planar `FaceRef`.
37
-
38
- This is useful when the script has already selected a face semantically:
39
-
40
- ```javascript
41
- const panel = Rectangle2D.from3Points(
42
- point(-30, -18),
43
- point(28, -6),
44
- point(18, 24),
45
- ).extrude(16);
46
-
47
- const cap = circle2d(5)
48
- .onFace(panel.face('top'), { u: 12, protrude: 0.05 })
49
- .extrude(1.2);
50
- ```
51
-
52
- ```javascript
53
- const cup = roundedRect(70, 42, 5, true)
54
- .extrude(22)
55
- .shell(2, { openFaces: ['top'] });
56
-
57
- const rib = rect(6, 4)
58
- .onFace(cup, 'inner-side-right', { u: 0, v: 0, protrude: 0.05 })
59
- .extrude(1.2);
60
- ```
61
-
62
- ```javascript
63
- const body = box(120, 60, 40, true).color('#d8dce3');
64
-
65
- const badge = roundedRect(28, 10, 2, true)
66
- .onFace(body, 'front', { v: 8 })
67
- .extrude(2)
68
- .color('#1d2733');
69
-
70
- return [
71
- { name: 'Body', shape: body },
72
- { name: 'Badge', shape: badge },
73
- ];
74
- ```
75
-
76
- ## Face-local coordinates
77
-
78
- - Canonical faces:
79
- - `front` / `back`: `u = X`, `v = Z`
80
- - `left` / `right`: `u` runs across the face, `v = Z`
81
- - `top` / `bottom`: `u = X`, `v` runs across the face
82
- - Tracked planar faces use their own stored local frame:
83
- - side faces of extruded rectangles: `u` follows the source edge, `v = Z`
84
- - tracked `top` / `bottom` faces follow the source sketch axes
85
- - direct `FaceRef` placement uses that face's `uAxis` / `vAxis`
86
- - supported shell inner walls, blind-hole floors, counterbore shoulder floors, and defended cut walls reuse compiler-owned local frames for downstream workplanes
87
- - supported shell inner walls, blind-hole floors, counterbore shoulder floors, and defended cut walls reuse compiler-owned local frames for downstream workplanes
88
- - compile-covered `Shape` targets now resolve defended named faces through the shared face-query table before falling back to bare canonical body heuristics
89
-
90
- The sketch's local `+Z` becomes the face normal, so `extrude(positive)` goes outward from that face.
91
-
92
- ## Notes
93
-
94
- - This is a planar face-placement feature, not arbitrary curved-surface projection.
95
- - Tracked curved faces like `cylinder(...).face('side')` are rejected because they do not have a planar sketch frame.
96
- - Supported created-face names on compiler-owned feature results are intentionally narrow, but defended split descendants now stay visible as semantic regions where Forge can keep one stable source surface.
97
- - Hole/cut host faces, supported `upToFace` termination faces, and defended boolean-difference / boolean-intersection descendants can now stay queryable as face regions instead of collapsing straight to "missing face".
98
- - Coplanar boolean face sets now stay placeable through `onFace(shape, name, ...)` when Forge can defend one shared planar frame; non-coplanar sets stay explicit and reject planar placement honestly.
99
- - The placed sketch still supports normal 2D operations like `translate`, `rotate`, `scale`, and sketch booleans before extrusion.
100
- - If multiple sketches share the same face placement, their 2D booleans preserve that shared placement.
101
- - If booleans mix sketches with different 3D placements, the result drops back to an unplaced sketch.
102
- - Extruding a placed sketch keeps the tracked `top` / `bottom` / `side` metadata from that extrusion, transformed into world space.
103
- - Projection-driven follow-on sketches now keep compiler-visible provenance when you `projectToPlane()` a compatible projected source back onto a matching parallel plane. The defended exact subset now covers straight extrusions plus compatible shell/hole/cut/union descendants that reduce to one planar projection basis, but arbitrary projection targets still stay runtime-only.
104
- - `projectToPlane()` accepts a `FaceRef` as the target plane via `{ face: shape.face(name) }`. When the target is a defended descendant region (such as `inner-bottom` after a shell), the compiler stores a `targetFaceQuery` in the projection compile plan so later cuts, offsets, and stiffeners can explain which surface they originated from. The same parallel-plane replay constraints apply: the projected source basis must stay parallel to the target face normal.
@@ -1,78 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 6
4
- ---
5
-
6
- # Sketch Operations
7
-
8
- 2D operations for modifying sketch contours.
9
-
10
- ## Methods
11
-
12
- All operations preserve the sketch's color.
13
-
14
- ### `.offset(delta, join?)`
15
- Inflate (positive) or deflate (negative) the contour.
16
-
17
- **Parameters:**
18
- - `delta` (number) - Offset distance. Positive = outward, negative = inward
19
- - `join` ('Square' | 'Round' | 'Miter', optional) - Corner style. Default: 'Round'
20
-
21
- ```javascript
22
- const outer = rect(50, 30).offset(5); // Expand by 5mm
23
- const inner = circle2d(20).offset(-2); // Shrink by 2mm
24
- const sharp = ngon(6, 20).offset(3, 'Miter');
25
- ```
26
-
27
- Use the common `offset(-r).offset(+r)` pattern when you want to round **every convex corner** of a closed sketch.
28
-
29
- ### `filletCorners(points, corners)`
30
- Round specific corners of a polygon point list (both convex and concave).
31
-
32
- **Parameters:**
33
- - `points` (([number, number] | Point2D)[]) - Closed polygon vertices in order
34
- - `corners` (`{ index: number, radius: number, segments?: number }[]`) - Which vertices to fillet
35
-
36
- **Returns:** `Sketch`
37
-
38
- ```javascript
39
- const roofPoints = [
40
- [0, 0],
41
- [90, 0],
42
- [90, 44],
43
- [66, 74],
44
- [45, 86],
45
- [24, 74],
46
- [0, 44],
47
- ];
48
-
49
- const roof = filletCorners(roofPoints, [
50
- { index: 3, radius: 19 },
51
- { index: 4, radius: 19 },
52
- { index: 5, radius: 19 },
53
- ]);
54
- ```
55
-
56
- Notes:
57
- - both convex and concave corners are supported; convex fillets cut the corner, concave fillets fill the concavity
58
- - collinear corners (straight edges) cannot be filleted
59
- - if two neighboring fillets would overlap on the same edge, the function throws
60
- - compare `polygon(points)` and `filletCorners(points, ...)` before extruding when debugging mixed sharp-and-rounded outlines
61
-
62
- ## Choosing A Rounding Strategy
63
-
64
- - `offset(-r).offset(+r)` rounds all convex corners of an existing closed profile
65
- - `stroke(points, width, 'Round')` thickens a centerline path; use it for ribs, traces, and wire-like geometry
66
- - `filletCorners(points, ...)` is the right tool when some corners stay sharp and others need true tangent fillets
67
- - See `examples/api/sketch-rounding-strategies.forge.js` for a side-by-side comparison
68
-
69
- ### `.simplify(epsilon?)`
70
- Removes vertices that don't significantly affect the shape.
71
-
72
- **Parameters:**
73
- - `epsilon` (number, optional) - Tolerance for vertex removal. Default: 1e-6
74
-
75
- ```javascript
76
- const simplified = complexSketch.simplify(0.1);
77
- ```
78
-
@@ -1,75 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 3
4
- ---
5
-
6
- # Sketch Path Builder
7
-
8
- Fluent API for tracing 2D outlines point by point.
9
-
10
- ## Class: PathBuilder
11
-
12
- ### `path()`
13
- Creates a new path builder.
14
-
15
- ```javascript
16
- const triangle = path()
17
- .moveTo(0, 0)
18
- .lineH(50)
19
- .lineV(30)
20
- .close();
21
- ```
22
-
23
- ### Methods
24
-
25
- #### `.moveTo(x, y)`
26
- Set starting point.
27
-
28
- #### `.lineTo(x, y)`
29
- Line to absolute position.
30
-
31
- #### `.lineH(dx)`
32
- Horizontal line (relative).
33
-
34
- #### `.lineV(dy)`
35
- Vertical line (relative).
36
-
37
- #### `.lineAngled(length, degrees)`
38
- Line at angle (0°=right, 90°=up).
39
-
40
- #### `.close()`
41
- Close path into a `Sketch` (auto-fixes winding).
42
-
43
- #### `.stroke(width, join?)`
44
- Thicken path into solid profile (see below).
45
-
46
- ## Stroke
47
-
48
- Thicken a polyline (centerline) into a solid profile with uniform width. Proper miter joins at vertices.
49
-
50
- ### `path().stroke(width, join?)`
51
- ### `stroke(points, width, join?)`
52
-
53
- **Parameters:**
54
- - `width` (number) — Profile thickness
55
- - `join` ('Square' | 'Round', optional) — Corner style. Default: 'Square' (miter)
56
-
57
- **Returns:** `Sketch`
58
-
59
- ```javascript
60
- // Fluent path builder
61
- const bracket = path()
62
- .moveTo(0, 0)
63
- .lineH(50)
64
- .lineV(-70)
65
- .lineAngled(20, 235)
66
- .stroke(4);
67
-
68
- // Or with point array
69
- const bracket = stroke([[0, 0], [50, 0], [50, -70]], 4);
70
-
71
- // Rounded corners
72
- const rounded = stroke([[0, 0], [50, 0], [50, -50]], 4, 'Round');
73
- ```
74
-
75
- Use `stroke(..., 'Round')` for centerline-based geometry such as ribs, traces, and wire-like profiles. It is not the same as rounding selected corners of an existing closed polygon. For mixed sharp-and-rounded outlines, build the polygon first and use `filletCorners(...)`.
@@ -1,146 +0,0 @@
1
- ---
2
- skill-group: sketch
3
- skill-order: 2
4
- ---
5
-
6
- # Sketch Primitives
7
-
8
- 2D primitive shapes for creating sketches.
9
-
10
- ## Functions
11
-
12
- ### `rect(width, height, center?)`
13
- Creates a rectangle.
14
-
15
- **Parameters:**
16
- - `width` (number) - Width
17
- - `height` (number) - Height
18
- - `center` (boolean, optional) - If true, centers at origin. Default: false (corner at origin)
19
-
20
- ```javascript
21
- const r = rect(50, 30);
22
- const centered = rect(50, 30, true);
23
- ```
24
-
25
- ### `circle2d(radius, segments?)`
26
- Creates a circle.
27
-
28
- **Parameters:**
29
- - `radius` (number) - Circle radius
30
- - `segments` (number, optional) - Number of segments. Default: auto (smooth)
31
-
32
- ```javascript
33
- const c = circle2d(25);
34
- const octagon = circle2d(25, 8);
35
- ```
36
-
37
- ### `roundedRect(width, height, radius, center?)`
38
- Creates a rectangle with rounded corners.
39
-
40
- **Parameters:**
41
- - `width` (number) - Width
42
- - `height` (number) - Height
43
- - `radius` (number) - Corner radius
44
- - `center` (boolean, optional) - If true, centers at origin. Default: false
45
-
46
- ```javascript
47
- const rounded = roundedRect(60, 40, 5);
48
- ```
49
-
50
- ### `polygon(points)`
51
- Creates a polygon from an array of [x, y] points or Point2D objects.
52
-
53
- **Parameters:**
54
- - `points` (([number, number] | Point2D)[]) - Array of vertex coordinates or Point2D objects
55
-
56
- ```javascript
57
- const triangle = polygon([[0, 0], [50, 0], [25, 40]]);
58
-
59
- // Also accepts Point2D objects
60
- const p1 = point(0, 0), p2 = point(50, 0), p3 = point(25, 40);
61
- const triangle2 = polygon([p1, p2, p3]);
62
- ```
63
-
64
- ### `ngon(sides, radius)`
65
- Creates a regular polygon (equilateral).
66
-
67
- **Parameters:**
68
- - `sides` (number) - Number of sides
69
- - `radius` (number) - Radius from center to vertex
70
-
71
- ```javascript
72
- const hex = ngon(6, 25);
73
- const triangle = ngon(3, 30);
74
- ```
75
-
76
- ### `ellipse(rx, ry, segments?)`
77
- Creates an ellipse.
78
-
79
- **Parameters:**
80
- - `rx` (number) - X radius
81
- - `ry` (number) - Y radius
82
- - `segments` (number, optional) - Number of segments. Default: 64
83
-
84
- ```javascript
85
- const oval = ellipse(40, 20);
86
- ```
87
-
88
- ### `slot(length, width)`
89
- Creates an oblong shape (rectangle with semicircle ends).
90
-
91
- **Parameters:**
92
- - `length` (number) - Total length
93
- - `width` (number) - Width
94
-
95
- ```javascript
96
- const oblong = slot(60, 20);
97
- ```
98
-
99
- ### `star(points, outerRadius, innerRadius)`
100
- Creates a star shape.
101
-
102
- **Parameters:**
103
- - `points` (number) - Number of star points
104
- - `outerRadius` (number) - Outer radius (tip of points)
105
- - `innerRadius` (number) - Inner radius (between points)
106
-
107
- ```javascript
108
- const star5 = star(5, 30, 15);
109
- ```
110
-
111
- ### `text2d(content, options?)`
112
- Renders a string as a filled 2D sketch using the built-in "Forge Mono" geometric font — a clean, angular, monoline typeface designed to extrude and engrave crisply. Supports A–Z (case-insensitive), 0–9, and common punctuation.
113
-
114
- **Parameters:**
115
- - `content` (string) - Text to render
116
- - `options.size` (number) - Cap height in model units. Default: `10`
117
- - `options.letterSpacing` (number) - Extra spacing between characters in model units. Default: `0`
118
- - `options.align` (`'left' | 'center' | 'right'`) - Horizontal alignment relative to x = 0. Default: `'left'`
119
- - `options.baseline` (`'baseline' | 'center' | 'top'`) - Vertical alignment relative to y = 0. Default: `'baseline'`
120
-
121
- **Returns:** `Sketch`
122
-
123
- ```javascript
124
- // Extruded nameplate
125
- text2d('FORGE CAD', { size: 8 }).extrude(1.5)
126
-
127
- // Centered label
128
- text2d('V 2.0', { size: 6, align: 'center', baseline: 'center' }).extrude(0.8)
129
-
130
- // Engraved into a face
131
- myPart.cut(text2d('A-001', { size: 4 }).onFace(myPart, 'top'), { depth: 0.5 })
132
- ```
133
-
134
- ### `textWidth(content, options?)`
135
- Returns the rendered advance width of a string in model units, using the same metrics as `text2d`.
136
-
137
- **Parameters:**
138
- - `content` (string) - Text to measure
139
- - `options.size` (number) - Cap height in model units. Default: `10`
140
- - `options.letterSpacing` (number) - Extra spacing between characters. Default: `0`
141
-
142
- **Returns:** `number`
143
-
144
- ```javascript
145
- const w = textWidth('HELLO', { size: 10 }); // total advance width
146
- ```