forgecad 0.6.3 → 0.7.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 (193) hide show
  1. package/README.md +2 -11
  2. package/dist/assets/{AdminPage-CeqCUUgu.js → AdminPage-DAu1C1ST.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-Gc_BCdqC.js} +269 -143
  5. package/dist/assets/EditorApp-D9bJvtf7.js +11338 -0
  6. package/dist/assets/{EditorApp-CnC2k4cW.css → EditorApp-DG1-oUSV.css} +459 -87
  7. package/dist/assets/{EmbedViewer-DBlzmQ5i.js → EmbedViewer-CEO8XbV8.js} +2 -4
  8. package/dist/assets/LandingPage-CdCuEOdC.js +451 -0
  9. package/dist/assets/PricingPage-BSrxu6d7.js +232 -0
  10. package/dist/assets/{SettingsPage-BqCh9JcC.js → SettingsPage-FUCSIRq6.js} +129 -5
  11. package/dist/assets/{evalWorker-Ql-aKwLA.js → evalWorker-KoR0SNKq.js} +6770 -2914
  12. package/dist/assets/{index-2hfs_ub0.css → index-CyVd1D4D.css} +227 -53
  13. package/dist/assets/{Viewport-CoB46f5R.js → index-wTEK39at.js} +31385 -6439
  14. package/dist/assets/{javascript-DCxGoE5Y.js → javascript-DAl8Gmyo.js} +1 -1
  15. package/dist/assets/{manifold-CqNMHHKO.js → manifold-B1sGWdYk.js} +4 -3
  16. package/dist/assets/{manifold-Cce9wRFz.js → manifold-D7o0N50J.js} +1 -1
  17. package/dist/assets/{manifold-D6BeHIOo.js → manifold-G5sBaXzi.js} +1 -1
  18. package/dist/assets/{reportWorker-sFEFonXf.js → reportWorker-DYcRHhv9.js} +6798 -3341
  19. package/dist/assets/{vendor-react-Dt7-aaJH.js → vendor-react-CG3i_wp0.js} +65 -8
  20. package/dist/docs-raw/generated/assembly.md +691 -112
  21. package/dist/docs-raw/generated/concepts.md +1225 -1400
  22. package/dist/docs-raw/generated/core.md +464 -1412
  23. package/dist/docs-raw/generated/curves.md +593 -117
  24. package/dist/docs-raw/generated/lib.md +38 -748
  25. package/dist/docs-raw/generated/output.md +139 -245
  26. package/dist/docs-raw/generated/sheet-metal.md +473 -21
  27. package/dist/docs-raw/generated/sketch.md +553 -349
  28. package/dist/docs-raw/generated/viewport.md +345 -303
  29. package/dist/docs-raw/generated/wood.md +104 -0
  30. package/dist/index.html +2 -2
  31. package/dist/sitemap.xml +6 -6
  32. package/dist-cli/chunk-PZ5AY32C.js +10 -0
  33. package/dist-cli/chunk-PZ5AY32C.js.map +1 -0
  34. package/dist-cli/forgecad.js +9435 -5407
  35. package/dist-cli/forgecad.js.map +1 -0
  36. package/dist-cli/solver-FV7TJZGI.js +365 -0
  37. package/dist-cli/solver-FV7TJZGI.js.map +1 -0
  38. package/dist-skill/CONTEXT.md +3186 -7145
  39. package/dist-skill/SKILL-dev.md +21 -63
  40. package/dist-skill/SKILL.md +12 -56
  41. package/dist-skill/docs/API/core/concepts.md +16 -98
  42. package/dist-skill/docs/CLI/export.md +91 -0
  43. package/dist-skill/docs/CLI/projects.md +107 -0
  44. package/dist-skill/docs/CLI/studio_publishing.md +52 -0
  45. package/dist-skill/docs/CLI/validation.md +66 -0
  46. package/dist-skill/docs/generated/assembly.md +691 -112
  47. package/dist-skill/docs/generated/core.md +464 -1412
  48. package/dist-skill/docs/generated/curves.md +593 -117
  49. package/dist-skill/docs/generated/lib.md +38 -748
  50. package/dist-skill/docs/generated/output.md +139 -245
  51. package/dist-skill/docs/generated/sheet-metal.md +473 -21
  52. package/dist-skill/docs/generated/sketch.md +553 -349
  53. package/dist-skill/docs/generated/viewport.md +345 -303
  54. package/dist-skill/docs/generated/wood.md +104 -0
  55. package/dist-skill/docs/guides/coordinate-system.md +11 -17
  56. package/dist-skill/docs/guides/geometry-conventions.md +13 -70
  57. package/dist-skill/docs/guides/modeling-recipes.md +22 -195
  58. package/dist-skill/docs/guides/positioning.md +88 -147
  59. package/dist-skill/docs-dev/API/core/concepts.md +51 -0
  60. package/dist-skill/docs-dev/API/core/sdf-advanced.md +92 -0
  61. package/dist-skill/docs-dev/API/core/sdf-primitives.md +58 -0
  62. package/dist-skill/docs-dev/API/core/sdf-workflow.md +42 -0
  63. package/dist-skill/docs-dev/CLI/export.md +91 -0
  64. package/dist-skill/docs-dev/CLI/projects.md +107 -0
  65. package/dist-skill/docs-dev/CLI/studio_publishing.md +52 -0
  66. package/dist-skill/docs-dev/CLI/validation.md +66 -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 +1 -3
  70. package/dist-skill/docs-dev/generated/assembly.md +771 -0
  71. package/dist-skill/docs-dev/generated/core.md +775 -0
  72. package/dist-skill/docs-dev/generated/curves.md +688 -0
  73. package/dist-skill/docs-dev/generated/lib.md +50 -0
  74. package/dist-skill/docs-dev/generated/output.md +234 -0
  75. package/dist-skill/docs-dev/generated/sheet-metal.md +506 -0
  76. package/dist-skill/docs-dev/generated/sketch.md +801 -0
  77. package/dist-skill/docs-dev/generated/viewport.md +486 -0
  78. package/dist-skill/docs-dev/generated/wood.md +104 -0
  79. package/dist-skill/docs-dev/guides/coordinate-system.md +46 -0
  80. package/dist-skill/docs-dev/guides/geometry-conventions.md +52 -0
  81. package/dist-skill/docs-dev/guides/modeling-recipes.md +77 -0
  82. package/dist-skill/docs-dev/guides/positioning.md +151 -0
  83. package/dist-skill/{docs → docs-dev}/guides/skill-maintenance.md +21 -10
  84. package/dist-skill/{docs → docs-dev}/internals/compiler.md +5 -6
  85. package/dist-skill/{docs → docs-dev}/internals/constraint-solver-quality.md +0 -1
  86. package/dist-skill/{docs → docs-dev}/internals/constraint-solver.md +0 -1
  87. package/dist-skill/{docs → docs-dev}/internals/sketch-2d-pipeline.md +2 -3
  88. package/examples/api/attachTo-basics.forge.js +5 -5
  89. package/examples/api/boolean-operations.forge.js +3 -3
  90. package/examples/api/bounding-box-visualizer.forge.js +2 -2
  91. package/examples/api/clone-duplicate.forge.js +1 -1
  92. package/examples/api/colors-union-vs-array.forge.js +6 -6
  93. package/examples/api/connector-assembly.forge.js +4 -4
  94. package/examples/api/connector-basics.forge.js +2 -2
  95. package/examples/api/extrude-options.forge.js +4 -10
  96. package/examples/api/feature-created-faces.forge.js +6 -10
  97. package/examples/api/fillet-showcase.forge.js +1 -1
  98. package/examples/api/folded-service-panel-cover.forge.js +2 -2
  99. package/examples/api/group-test.forge.js +1 -1
  100. package/examples/api/group-vs-union.forge.js +1 -1
  101. package/examples/api/highlight-debug.forge.js +4 -0
  102. package/examples/api/js-module-pillars.js +1 -1
  103. package/examples/api/js-module-scene.js +2 -2
  104. package/examples/api/mesh-import-slats.forge.js +1 -1
  105. package/examples/api/pointAlong-orientation.forge.js +1 -1
  106. package/examples/api/profile-2020-b-slot6.forge.js +0 -1
  107. package/examples/api/route-perimeter-flange.forge.js +1 -1
  108. package/examples/api/sdf-rover-demo.forge.js +10 -10
  109. package/examples/api/sketch-on-face-demo.forge.js +2 -2
  110. package/examples/api/sketch-regions.forge.js +4 -4
  111. package/examples/api/transition-curves.forge.js +1 -1
  112. package/examples/api/variable-sweep-pure-sdf-test.forge.js +162 -0
  113. package/examples/api/variable-sweep-test.forge.js +2 -2
  114. package/examples/api/wood-joinery.forge.js +60 -0
  115. package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +3 -3
  116. package/examples/compiler-corpus/fastener-plate-variants.forge.js +2 -2
  117. package/examples/experiments/drone-arm.forge.js +53 -0
  118. package/examples/furniture/adjustable-table.forge.js +2 -2
  119. package/examples/furniture/bathroom.forge.js +11 -11
  120. package/examples/furniture/chair.forge.js +1 -1
  121. package/examples/generative/crystal-growth.forge.js +2 -2
  122. package/examples/generative/frost-spires.forge.js +3 -3
  123. package/examples/generative/golden-spiral-tower.forge.js +3 -3
  124. package/examples/mechanical/3d-printer.forge.js +28 -28
  125. package/examples/mechanical/5-finger-robot-hand.forge.js +15 -15
  126. package/examples/mechanical/airplane-propeller.forge.js +2 -2
  127. package/examples/mechanical/fillet-enclosure.forge.js +1 -1
  128. package/examples/mechanical/headphone-hanger-v2.forge.js +2 -2
  129. package/examples/mechanical/robot_hand.forge.js +15 -15
  130. package/examples/mechanical/robot_hand_2.forge.js +9 -9
  131. package/examples/products/bottle.forge.js +1 -1
  132. package/examples/products/chess-set.forge.js +19 -19
  133. package/examples/products/classical-piano.forge.js +11 -11
  134. package/examples/products/clock.forge.js +12 -12
  135. package/examples/products/iphone.forge.js +8 -8
  136. package/examples/products/laptop.forge.js +15 -15
  137. package/examples/products/liquid-soap-dispenser.forge.js +18 -18
  138. package/examples/products/origami-fish.forge.js +8 -6
  139. package/examples/products/spiderman-cake.forge.js +4 -4
  140. package/examples/toolbox/bolted-joint.forge.js +2 -2
  141. package/package.json +7 -4
  142. package/dist/assets/EditorApp-B-vQvgam.js +0 -9888
  143. package/dist/assets/LandingPage-C5n9hDXI.js +0 -322
  144. package/dist/assets/PublishedModelPage-Dt7PCVBj.js +0 -146
  145. package/dist/assets/__vite-browser-external-CURh0WXD.js +0 -8
  146. package/dist/assets/deserializeRunResult-BLAFoiE0.js +0 -19365
  147. package/dist/assets/index-1CYp3zUp.js +0 -1455
  148. package/dist/docs-raw/CLI.md +0 -865
  149. package/dist-skill/docs/API/API.md +0 -1666
  150. package/dist-skill/docs/API/README.md +0 -37
  151. package/dist-skill/docs/API/assembly/assembly.md +0 -617
  152. package/dist-skill/docs/API/core/edge-queries.md +0 -130
  153. package/dist-skill/docs/API/core/parameters.md +0 -122
  154. package/dist-skill/docs/API/core/reserved-terms.md +0 -137
  155. package/dist-skill/docs/API/core/sdf.md +0 -326
  156. package/dist-skill/docs/API/core/skill-cli.md +0 -194
  157. package/dist-skill/docs/API/core/skill-guide.md +0 -205
  158. package/dist-skill/docs/API/core/specs.md +0 -186
  159. package/dist-skill/docs/API/core/topology.md +0 -372
  160. package/dist-skill/docs/API/entities.md +0 -268
  161. package/dist-skill/docs/API/output/bom.md +0 -58
  162. package/dist-skill/docs/API/output/brep-export.md +0 -87
  163. package/dist-skill/docs/API/output/dimensions.md +0 -67
  164. package/dist-skill/docs/API/output/export.md +0 -110
  165. package/dist-skill/docs/API/output/gcode.md +0 -195
  166. package/dist-skill/docs/API/runtime/viewport.md +0 -420
  167. package/dist-skill/docs/API/sheet-metal/sheet-metal.md +0 -185
  168. package/dist-skill/docs/API/sketch/anchor.md +0 -37
  169. package/dist-skill/docs/API/sketch/booleans.md +0 -91
  170. package/dist-skill/docs/API/sketch/core.md +0 -73
  171. package/dist-skill/docs/API/sketch/extrude.md +0 -62
  172. package/dist-skill/docs/API/sketch/on-face.md +0 -104
  173. package/dist-skill/docs/API/sketch/operations.md +0 -78
  174. package/dist-skill/docs/API/sketch/path.md +0 -75
  175. package/dist-skill/docs/API/sketch/primitives.md +0 -146
  176. package/dist-skill/docs/API/sketch/regions.md +0 -80
  177. package/dist-skill/docs/API/sketch/text.md +0 -108
  178. package/dist-skill/docs/API/sketch/transforms.md +0 -65
  179. package/dist-skill/docs/API/toolbox/fasteners.md +0 -129
  180. package/dist-skill/docs/CLI.md +0 -865
  181. package/dist-skill/docs/INDEX.md +0 -94
  182. package/dist-skill/docs/RELEASING.md +0 -55
  183. package/dist-skill/docs/cli-monetization.md +0 -111
  184. package/dist-skill/docs/deployment.md +0 -281
  185. package/dist-skill/docs/generated/concepts.md +0 -2112
  186. package/dist-skill/docs/internals/shape-from-slices.md +0 -152
  187. package/dist-skill/docs/platform/admin.md +0 -45
  188. package/dist-skill/docs/platform/architecture.md +0 -79
  189. package/dist-skill/docs/platform/auth.md +0 -110
  190. package/dist-skill/docs/platform/email.md +0 -67
  191. package/dist-skill/docs/platform/projects.md +0 -111
  192. package/dist-skill/docs/platform/sharing.md +0 -90
  193. package/dist-skill/docs/runbook.md +0 -345
@@ -0,0 +1,486 @@
1
+ ---
2
+ skill-group: viewport
3
+ skill-order: 100
4
+ ---
5
+
6
+ # Viewport & Runtime
7
+
8
+ Cut planes, exploded views, joint animations, and scene configuration.
9
+
10
+ ## Contents
11
+
12
+ - [Viewport & Runtime](#viewport-runtime) — `jointsView`, `explodeView`, `cutPlane`, `cutPlane`, `scene`, `viewConfig`, `showLabels`, `highlight`, `highlight`, `highlight`, `highlight`, `highlight`, `highlight`, `highlight`, `highlight`
13
+ - [RouteBuilder](#routebuilder)
14
+ - [route](#route)
15
+
16
+ ## Functions
17
+
18
+ ### Viewport & Runtime
19
+
20
+ #### `jointsView()` — Register viewport-only mechanism controls that animate returned objects without re-running the script.
21
+
22
+ Defines joints (revolute or prismatic), optional gear/rack couplings, and named animations. The viewport resolves transforms through the joint chain at display time — the script geometry is computed only once at rest pose.
23
+
24
+ **Critical:** Solve the assembly at **rest pose** (all animated joints = 0). The viewport applies `jointsView` transforms on top of the returned scene. If geometry is already solved at non-zero angles, animation will double-rotate everything.
25
+
26
+ ```js
27
+ // BAD — double rotation
28
+ const solved = mech.solve({ shoulder: 45, elbow: 30 });
29
+ jointsView({ joints: [{ name: 'shoulder', ... }] });
30
+ return solved;
31
+
32
+ // GOOD — rest pose, jointsView controls all posing
33
+ const solved = mech.solve({ shoulder: 0, elbow: 0 });
34
+ jointsView({
35
+ joints: [
36
+ { name: 'shoulder', child: 'Upper Arm', default: 45, ... },
37
+ { name: 'elbow', child: 'Forearm', parent: 'Upper Arm', default: 30, ... },
38
+ ],
39
+ });
40
+ return solved;
41
+ ```
42
+
43
+ **Pivot coordinates** are world-space positions of each joint origin at rest pose. For `addRevolute('shoulder', 'Base', 'Link', { frame: Transform.identity().translate(0, 0, 20) })` where "Base" is at world origin, the pivot is `[0, 0, 20]`.
44
+
45
+ **Fixed attachments** that must follow a parent during animation need a zero-angle revolute joint in the chain:
46
+
47
+ ```js
48
+ { name: 'EE_Follow', child: 'End Effector', parent: 'Last Link',
49
+ type: 'revolute', axis: [0, 0, 1], pivot: [linkLength, 0, 0],
50
+ min: 0, max: 0, default: 0 }
51
+ ```
52
+
53
+ Animation values are interpolated linearly between keyframes. ForgeCAD does **not** auto-wrap revolute values across `-180/180`. Keep keyframe values continuous — a `-180 -> 171` jump spins the part the long way around. Use `-180 -> -189` instead. Author high-speed multi-turn joints as accumulating angles (`0, 360, 720, ...`) with `continuous: true`.
54
+
55
+ **Tick-based keyframes:** Omit `at` from all keyframes to auto-distribute by tick weight:
56
+
57
+ ```js
58
+ keyframes: [
59
+ { ticks: 3, values: { Shoulder: 20 } }, // slow segment (3x weight)
60
+ { ticks: 1, values: { Shoulder: -10 } }, // fast segment (1x weight)
61
+ { values: { Shoulder: 20 } }, // last keyframe; ticks ignored
62
+ ]
63
+ // positions: 0, 0.75, 1.0
64
+ ```
65
+
66
+ Mixing explicit `at` and omitted `at` in the same animation is not allowed.
67
+
68
+ ```js
69
+ jointsView({
70
+ joints: [{
71
+ name: 'Shoulder', child: 'Upper Arm', parent: 'Base',
72
+ type: 'revolute', axis: [0, -1, 0], pivot: [0, 0, 46],
73
+ min: -30, max: 110, default: 15,
74
+ }],
75
+ animations: [{
76
+ name: 'Walk Cycle', duration: 1.6, loop: true,
77
+ keyframes: [
78
+ { values: { Shoulder: 20 } },
79
+ { values: { Shoulder: -10 } },
80
+ { values: { Shoulder: 20 } },
81
+ ],
82
+ }],
83
+ });
84
+ ```
85
+
86
+ ```ts
87
+ jointsView(options?: JointsViewOptions): void
88
+ ```
89
+
90
+ **`JointsViewOptions`**: `enabled?: boolean`, `joints?: JointViewInput[]`, `couplings?: JointViewCouplingInput[]`, `animations?: JointViewAnimationInput[]`, `defaultAnimation?: string`
91
+
92
+ **`JointViewInput`**: `name: string`, `child: string`, `parent?: string`, `type?: JointViewType`, `axis?: JointViewAxis`, `min?: number`, `max?: number`, `default?: number`, `unit?: string`, `hidden?: boolean`
93
+
94
+ `JointViewCouplingInput`: `{ joint: string, terms: JointViewCouplingTermInput[], offset?: number }`
95
+
96
+ `JointViewCouplingTermInput`: `{ joint: string, ratio?: number }`
97
+
98
+ `JointViewAnimationInput`: `{ name: string, duration?: number, loop?: boolean, continuous?: boolean, keyframes: JointViewAnimationKeyframeInput[] }`
99
+
100
+ **`JointViewAnimationKeyframeInput`**
101
+ - `at?: number` — Timeline position [0, 1]. If omitted from ALL keyframes, positions are auto-computed from tick weights.
102
+ - `ticks?: number` — Relative weight of the segment from this keyframe to the next (default 1). Only used in tick-based mode (when `at` is omitted). Last keyframe's ticks value is ignored.
103
+ - Also: `values: Record<string, number>`
104
+
105
+ #### `explodeView()` — Configure how the viewport explode slider offsets returned objects.
106
+
107
+ Offsets are resolved from the returned object tree, not a flat list. In `radial` mode each node follows its parent branch direction, then fans locally from the immediate parent center — nested assemblies peel apart level by level. In fixed-axis or fixed-vector modes, the branch follows that axis/vector but nested descendants fan out perpendicular by default.
108
+
109
+ Multiple calls merge — later values override earlier ones on a per-key basis. `byName` and `byPath` maps are merged entry-by-entry.
110
+
111
+ For programmatic explode applied before returning (without the slider), use `lib.explode()` instead.
112
+
113
+ ```js
114
+ explodeView({
115
+ amountScale: 1.2,
116
+ stages: [0.35, 0.8],
117
+ mode: 'radial',
118
+ byPath: { 'Drive/Shaft': { direction: [1, 0, 0], stage: 1.6 } },
119
+ });
120
+ ```
121
+
122
+ ```ts
123
+ explodeView(options?: ExplodeViewOptions): void
124
+ ```
125
+
126
+ **`ExplodeViewOptions`**
127
+
128
+ | Option | Type | Description |
129
+ |--------|------|-------------|
130
+ | `enabled?` | `boolean` | Set false to disable viewport explode offsets for this script output. |
131
+ | `amountScale?` | `number` | Scales the UI explode amount. Default: 1 |
132
+ | `stages?` | `number[]` | Per-depth stage multipliers (depth 1 = first level). If depth exceeds this array, the last value is reused. Default when omitted: reciprocal depth (1, 1/2, 1/3, ...) |
133
+ | `mode?` | `ExplodeViewDirection` | Global direction mode fallback. Default: 'radial' |
134
+ | `axisLock?` | `ExplodeAxis` | Global axis lock fallback. |
135
+ | `byName?` | `Record<string, ExplodeViewDirective>` | Per-object overrides by final object name. |
136
+ | `byPath?` | `Record<string, ExplodeViewDirective>` | Per-tree-path overrides using slash-separated object tree segments. |
137
+
138
+ **`ExplodeDirective`**
139
+ - `stage?: number` — Multiplier applied to `amount` for this node
140
+ - `direction?: ExplodeDirection` — Direction mode for this node
141
+ - `axisLock?: ExplodeAxis` — Optional axis lock after direction is resolved
142
+
143
+ #### `cutPlane()` — Define a named section plane for inspecting internal geometry.
144
+
145
+ Registers a cut plane that appears as a toggle in the viewport View Panel. When enabled, geometry on the positive side of the plane (the side the normal points toward) is clipped away, revealing the internal cross-section. The newly exposed section faces render with a hatched overlay; pre-existing coplanar boundary faces are left unhatched.
146
+
147
+ Planes are registered once per script run. The viewport toggle state (on/off) persists across parameter changes without re-running the script. The `exclude` option only works correctly when the excluded object names are stable across parameter changes.
148
+
149
+ Accepts two overloads: `cutPlane(name, normal, offset?, options?)` or `cutPlane(name, normal, options?)` where options may include `offset`.
150
+
151
+ ```js
152
+ const cutZ = param('Cut Height', 10, { min: -50, max: 50, unit: 'mm' });
153
+ cutPlane('Inspection', [0, 0, 1], cutZ, { exclude: ['Probe', 'Fasteners'] });
154
+ ```
155
+
156
+ ```ts
157
+ cutPlane(name: string, normal: [ number, number, number ], offset?: number, options?: CutPlaneOptions): void
158
+ ```
159
+
160
+ **`CutPlaneOptions`**
161
+ - `offset?: number` — Optional offset along the plane normal (primarily for object-form overload).
162
+ - `exclude?: CutPlaneExcludeInput` — Object names to keep uncut for this plane.
163
+
164
+ #### `cutPlane()`
165
+
166
+ ```ts
167
+ cutPlane(name: string, normal: [ number, number, number ], options?: CutPlaneOptions): void
168
+ ```
169
+
170
+ #### `scene()` — Configure the scene environment for the current script execution.
171
+
172
+ Controls camera position, lighting rig, background color or gradient, atmospheric fog, environment maps, post-processing effects, and capture parameters for the `forgecad capture` command. Multiple calls merge — later values override earlier ones on a per-key basis, so you can split configuration across multiple `scene()` calls.
173
+
174
+ When `lights` is specified, **all** default lights are removed. You must include your own ambient light or the scene will be fully dark.
175
+
176
+ Setting `camera.position` overrides auto-framing — the viewport will no longer auto-fit the geometry on script reload.
177
+
178
+ Post-processing effects (`bloom`, `vignette`, `grain`) work in the browser viewport only. The CLI applies camera, lights, background, fog, and `toneMappingExposure` but skips shader effects.
179
+
180
+ All numeric values accept [`param()`](/docs/core#param) expressions.
181
+
182
+ ```js
183
+ scene({
184
+ background: { top: '#000814', bottom: '#001d3d' },
185
+ camera: { position: [160, -120, 100], target: [0, 0, 50], fov: 52 },
186
+ lights: [
187
+ { type: 'ambient', color: '#001233', intensity: 0.08 },
188
+ { type: 'point', position: [120, -80, 130], color: '#00f5d4', intensity: 4, distance: 400, decay: 1 },
189
+ { type: 'point', position: [-100, 60, 20], color: '#f72585', intensity: 3, distance: 350 },
190
+ { type: 'directional', position: [50, -30, 200], color: '#ffd60a', intensity: 1.2 },
191
+ { type: 'hemisphere', skyColor: '#003566', groundColor: '#000814', intensity: 0.2 },
192
+ ],
193
+ fog: { color: '#000814', near: 100, far: 450 },
194
+ postProcessing: {
195
+ bloom: { intensity: param('bloom', 1.5, 0, 4), threshold: 0.5, radius: 0.7 },
196
+ vignette: { darkness: 0.8, offset: 0.25 },
197
+ grain: { intensity: 0.08 },
198
+ toneMappingExposure: param('exposure', 1.5, 0.5, 4),
199
+ },
200
+ });
201
+ ```
202
+
203
+ ```ts
204
+ scene(options: SceneOptions): void
205
+ ```
206
+
207
+ **`SceneOptions`**
208
+
209
+ | Option | Type | Description |
210
+ |--------|------|-------------|
211
+ | `capture?` | `SceneCaptureConfig` | Default capture parameters for `forgecad capture` — CLI flags override these. |
212
+ | `background?`, `camera?`, `lights?`, `environment?`, `fog?`, `postProcessing?`, `ground?` | | — |
213
+
214
+ `SceneBackgroundGradient`: `{ top: string, bottom: string }`
215
+
216
+ `SceneCameraConfig`: `{ fov?: number, type?: "perspective" | "orthographic" }`
217
+
218
+ **`SceneLightConfig`**
219
+
220
+ | Option | Type | Description |
221
+ |--------|------|-------------|
222
+ | `groundColor?` | `string` | Ground color for hemisphere lights |
223
+ | `skyColor?` | `string` | Sky color alias for hemisphere lights (same as color) |
224
+ | `angle?` | `number` | Spot light cone angle in radians |
225
+ | `penumbra?` | `number` | Spot light penumbra (0–1) |
226
+ | `decay?` | `number` | Point/spot light decay |
227
+ | `distance?` | `number` | Point/spot light distance (0 = infinite) |
228
+ | `castShadow?` | `boolean` | Whether this light casts shadows |
229
+ | `type`, `color?`, `intensity?` | | — |
230
+
231
+ **`SceneEnvironmentConfig`**
232
+ - `preset?: "studio" | "sunset" | "dawn" | "warehouse" | "forest" | "apartment" | "lobby" | "city" | "park" | "night" | "none"` — Built-in preset name or 'none' to disable
233
+ - `intensity?: number` — Environment map intensity
234
+ - `background?: boolean` — Use environment map as scene background
235
+
236
+ **`SceneFogConfig`**
237
+ - `near?: number` — Linear fog near distance
238
+ - `far?: number` — Linear fog far distance
239
+ - `density?: number` — Exponential fog density (if set, uses FogExp2 instead of linear Fog)
240
+ - Also: `color?: string`
241
+
242
+ `ScenePostProcessingConfig`: `{ bloom?: SceneBloomConfig, vignette?: SceneVignetteConfig, grain?: SceneGrainConfig, toneMappingExposure?: number }`
243
+
244
+ `SceneBloomConfig`: `{ intensity?: number, threshold?: number, radius?: number }`
245
+
246
+ `SceneVignetteConfig`: `{ darkness?: number, offset?: number }`
247
+
248
+ `SceneGrainConfig`: `{ intensity?: number }`
249
+
250
+ **`SceneGroundConfig`**
251
+
252
+ | Option | Type | Description |
253
+ |--------|------|-------------|
254
+ | `visible?` | `boolean` | Show a ground plane |
255
+ | `color?` | `string` | Ground color |
256
+ | `offset?` | `number` | Offset below the model's bounding box minimum Z. Default 0 (flush with model bottom). |
257
+ | `receiveShadow?` | `boolean` | Receive shadows on the ground |
258
+
259
+ **`SceneCaptureConfig`**
260
+
261
+ | Option | Type | Description |
262
+ |--------|------|-------------|
263
+ | `framesPerTurn?` | `number` | Frames for one full orbit rotation (default: 72) |
264
+ | `holdFrames?` | `number` | Frozen frames before motion starts (default: 6) |
265
+ | `pitchDeg?` | `number` | Orbit pitch angle in degrees (default: auto from camera) |
266
+ | `fps?` | `number` | Output frame rate (default: 24) |
267
+ | `size?` | `number` | Output frame size in pixels (default: 960) |
268
+ | `background?` | `string` | Canvas background color for capture (default: '#252526') |
269
+
270
+ #### `viewConfig()` — Configure viewport helper visuals for the current script execution.
271
+
272
+ Controls renderer-only overlays that appear in the viewport but are not part of the geometry. Currently supports the joint overlay that renders axis arrows and arc indicators when `jointsView` is active. Multiple calls merge — later values override earlier ones per key.
273
+
274
+ This does **not** trigger a geometry recompute; it only affects the visual helpers drawn on top of the 3D scene.
275
+
276
+ ```js
277
+ viewConfig({
278
+ jointOverlay: {
279
+ axisColor: '#13dfff',
280
+ arcColor: '#ff7a1a',
281
+ axisLineRadiusScale: 0.03,
282
+ arcLineRadiusScale: 0.022,
283
+ },
284
+ });
285
+ ```
286
+
287
+ ```ts
288
+ viewConfig(options?: ViewConfigOptions): void
289
+ ```
290
+
291
+ `ViewConfigOptions`: `{ jointOverlay?: JointOverlayViewConfigOptions }`
292
+
293
+ **`JointOverlayViewConfigOptions`**: `enabled?: boolean`, `axisColor?: string`, `axisCoreColor?: string`, `arcColor?: string`, `zeroColor?: string`, `arcVisualLimitDeg?: number`, `axisLengthScale?: number`, `axisLengthMin?: number`, `axisLineRadiusScale?: number`, `axisLineRadiusMin?: number`, `axisLineRadiusMax?: number`, `spokeLineRadiusScale?: number`, `spokeLineRadiusMin?: number`, `spokeLineRadiusMax?: number`, `arcLineRadiusScale?: number`, `arcLineRadiusMin?: number`, `arcLineRadiusMax?: number`, `axisDotRadiusScale?: number`, `axisDotRadiusMin?: number`, `axisArrowRadiusScale?: number`, `axisArrowRadiusMin?: number`, `axisArrowLengthScale?: number`, `axisArrowLengthMin?: number`, `axisArrowOffsetFactor?: number`, `arcRadiusScale?: number`, `arcRadiusMin?: number`, `arcDotRadiusScale?: number`, `arcDotRadiusMin?: number`, `arcArrowRadiusScale?: number`, `arcArrowRadiusMin?: number`, `arcArrowLengthScale?: number`, `arcArrowLengthMin?: number`, `arcArrowOffsetFactor?: number`, `arcStepDeg?: number`, `arcMinSteps?: number`, `arcTubeSegmentsMin?: number`, `arcTubeSegmentsFactor?: number`, `arcTubeRadialSegments?: number`
294
+
295
+ #### `showLabels()` — Highlight all user-labeled faces on a shape for visual debugging.
296
+
297
+ Shows each user-authored label name in the viewport for visual debugging. Returns the shape unchanged for chaining: `return showLabels(myShape)`.
298
+
299
+ ```ts
300
+ showLabels(shape: Shape): Shape
301
+ ```
302
+
303
+ #### `highlight()` — Highlight any geometry for visual debugging in the viewport.
304
+
305
+ Supported inputs:
306
+
307
+ - `string` — sketch entity ID (e.g. `'L0'`, `'P0'`, `'C0'`)
308
+ - `[x, y, z]` — 3D point
309
+ - `[[x1,y1,z1], [x2,y2,z2]]` — edge (line segment)
310
+ - `{ normal: [x,y,z], offset: number }` — plane by normal + distance from origin
311
+ - `{ normal: [x,y,z], point: [x,y,z] }` — plane by normal + point on plane
312
+ - [`Shape`](/docs/core#shape) — highlight entire 3D shape
313
+ - `FaceRef` (from `shape.face('top')`) — highlight as plane at face center
314
+ - `EdgeRef` (from `shape.edge('left')`) — highlight as edge segment
315
+
316
+ ```ts
317
+ highlight(entityId: string, opts?: HighlightOptions): void
318
+ ```
319
+
320
+ **`HighlightOptions`**
321
+ - `size?: number` — Size hint for points (radius in mm) or planes (disc radius in mm).
322
+ - Also: `color?: string, label?: string, pulse?: boolean`
323
+
324
+ #### `highlight()`
325
+
326
+ ```ts
327
+ highlight(point: [ number, number, number ], opts?: HighlightOptions): void
328
+ ```
329
+
330
+ #### `highlight()`
331
+
332
+ ```ts
333
+ highlight(edge: [ [ number, number, number ], [ number, number, number ] ], opts?: HighlightOptions): void
334
+ ```
335
+
336
+ #### `highlight()`
337
+
338
+ ```ts
339
+ highlight(plane: { normal: [ number, number, number ]; offset: number; }, opts?: HighlightOptions): void
340
+ ```
341
+
342
+ #### `highlight()`
343
+
344
+ ```ts
345
+ highlight(plane: { normal: [ number, number, number ]; point: [ number, number, number ]; }, opts?: HighlightOptions): void
346
+ ```
347
+
348
+ #### `highlight()`
349
+
350
+ ```ts
351
+ highlight(shape: Shape, opts?: HighlightOptions): void
352
+ ```
353
+
354
+ #### `highlight()`
355
+
356
+ ```ts
357
+ highlight(face: FaceRef, opts?: HighlightOptions): void
358
+ ```
359
+
360
+ **`FaceRef`**
361
+ - `query?: FaceQueryRef` — Compiler-owned face query when available.
362
+ - `planar?: boolean` — True when the face can host a 2D sketch placement frame
363
+ - `descendant?: FaceDescendantMetadata` — Shared descendant-resolution metadata when this face is a semantic region/set.
364
+ - Also: `name: FaceName`
365
+
366
+ **`FaceDescendantMetadata`**: `kind: "single" | "face-set"`, `semantic: FaceDescendantSemantic`, `memberCount: number`, `memberNames: string[]`, `coplanar: boolean`
367
+
368
+ #### `highlight()`
369
+
370
+ ```ts
371
+ highlight(edge: EdgeRef, opts?: HighlightOptions): void
372
+ ```
373
+
374
+ **`EdgeRef`**
375
+ - `query?: EdgeQueryRef` — Compiler-owned edge query when available.
376
+ - Also: `name: EdgeName`
377
+
378
+ ---
379
+
380
+ ## Classes
381
+
382
+ ### `RouteBuilder`
383
+
384
+ #### `up()` — Vertical line going +Y. Length is optional (solver determines it from constraints).
385
+
386
+ ```ts
387
+ up(length?: number): LineId
388
+ ```
389
+
390
+ #### `down()` — Vertical line going -Y. Length is optional.
391
+
392
+ ```ts
393
+ down(length?: number): LineId
394
+ ```
395
+
396
+ #### `right()` — Horizontal line going +X. Length is optional.
397
+
398
+ ```ts
399
+ right(length?: number): LineId
400
+ ```
401
+
402
+ #### `left()` — Horizontal line going -X. Length is optional.
403
+
404
+ ```ts
405
+ left(length?: number): LineId
406
+ ```
407
+
408
+ #### `lineAt()` — Line at an arbitrary angle (degrees from +X). Length is optional.
409
+
410
+ ```ts
411
+ lineAt(angleDeg: number, length?: number): LineId
412
+ ```
413
+
414
+ #### [`line()`](/docs/sketch#line) — Line with solver-determined direction. Length is optional. Direction comes from tangency to previous arc or from constraints.
415
+
416
+ ```ts
417
+ line(length?: number): LineId
418
+ ```
419
+
420
+ #### `toward()` — Line toward a specific point. Length defaults to the distance to that point.
421
+
422
+ ```ts
423
+ toward(x: number, y: number): LineId
424
+ ```
425
+
426
+ #### `arcLeft()` — Tangent arc turning left relative to travel direction.
427
+
428
+ or `{ minSweep: degrees }` to seed the geometry without constraining. `minSweep` guides the solver to the correct branch for arcs that sweep more than the default 90° seed.
429
+
430
+ ```ts
431
+ arcLeft(radius?: number, sweepDegOrOpts?: number | { minSweep: number; }): ArcId
432
+ ```
433
+
434
+ #### `arcRight()` — Tangent arc turning right relative to travel direction.
435
+
436
+ or `{ minSweep: degrees }` to seed without constraining.
437
+
438
+ ```ts
439
+ arcRight(radius?: number, sweepDegOrOpts?: number | { minSweep: number; }): ArcId
440
+ ```
441
+
442
+ #### `close()` — Close the route with a straight line back to the start point.
443
+
444
+ ```ts
445
+ close(): void
446
+ ```
447
+
448
+ #### `done()` — Close the route back to its start point and register as a profile loop.
449
+
450
+ No extra line segment is added. A coincident constraint connects the last point to the start, and tangency is added for G1 smoothness when arcs are at the junction. The session's incremental solver processes these constraints, keeping seed positions accurate for the final solve.
451
+
452
+ ```ts
453
+ done(): void
454
+ ```
455
+
456
+ #### `start()` — PointId of the route's start point.
457
+
458
+ ```ts
459
+ get start(): PointId
460
+ ```
461
+
462
+ #### `end()` — PointId of the current cursor (route's end).
463
+
464
+ ```ts
465
+ get end(): PointId
466
+ ```
467
+
468
+ #### `startOf()` — Get the start point of a segment.
469
+
470
+ ```ts
471
+ startOf(segId: LineId | ArcId): PointId
472
+ ```
473
+
474
+ #### `endOf()` — Get the end point of a segment.
475
+
476
+ ```ts
477
+ endOf(segId: LineId | ArcId): PointId
478
+ ```
479
+
480
+ ---
481
+
482
+ ## Constants
483
+
484
+ ### `route`
485
+
486
+ Route step factories. Access via `route.line()`, `route.fillet()`, etc.
@@ -0,0 +1,104 @@
1
+ ---
2
+ skill-group: toolbox
3
+ skill-order: 100
4
+ ---
5
+
6
+ # Woodworking
7
+
8
+ Wood boards with grain/species metadata, and joinery operations: dado, rabbet, mortise & tenon. Access via `Wood.*`.
9
+
10
+ ## Contents
11
+
12
+ - [WoodBoard](#woodboard)
13
+ - [Wood](#wood)
14
+
15
+ ---
16
+
17
+ ## Classes
18
+
19
+ ### `WoodBoard`
20
+
21
+ A board of wood with metadata for manufacturing: grain direction, species, and dimensions. The underlying geometry is a simple box.
22
+
23
+ Shape is mutable — joint operations (Wood.dado, Wood.rabbet, Wood.mortiseAndTenon) subtract material in-place. Transform methods return new WoodBoard instances preserving all metadata.
24
+
25
+ **Properties:**
26
+
27
+ | Property | Type | Description |
28
+ |----------|------|-------------|
29
+ | `shape` | `Shape` | The underlying 3D shape — mutable, joints modify it in-place. |
30
+ | `width` | `number` | Board width (mm) — the longer flat dimension |
31
+ | `height` | `number` | Board height (mm) — the shorter flat dimension |
32
+ | `thickness` | `number` | Board thickness (mm) |
33
+ | `grain` | `string` | Grain direction: "long" or "cross" |
34
+ | `species` | `string` | Wood species, e.g. "birch", "oak" |
35
+ | `material` | `string` | Material label for BOM |
36
+
37
+ **Methods:**
38
+
39
+ #### `cut()` — Subtract a cutter from this board, modifying it in-place. Used by joint functions (dado, rabbet, mortiseAndTenon).
40
+
41
+ ```ts
42
+ cut(cutter: Shape): this
43
+ ```
44
+
45
+ #### `translate()` — Translate the board in 3D space.
46
+
47
+ ```ts
48
+ translate(x: number, y: number, z: number): WoodBoard
49
+ ```
50
+
51
+ #### `rotate()` — Rotate the board around an axis by a given angle in degrees.
52
+
53
+ ```ts
54
+ rotate(axis: [ number, number, number ], angleDeg: number, options?: { pivot?: [ number, number, number ]; }): WoodBoard
55
+ ```
56
+
57
+ #### `rotateX()` — Rotate the board around the X axis by a given angle in degrees.
58
+
59
+ ```ts
60
+ rotateX(angleDeg: number): WoodBoard
61
+ ```
62
+
63
+ #### `rotateY()` — Rotate the board around the Y axis by a given angle in degrees.
64
+
65
+ ```ts
66
+ rotateY(angleDeg: number): WoodBoard
67
+ ```
68
+
69
+ #### `rotateZ()` — Rotate the board around the Z axis by a given angle in degrees.
70
+
71
+ ```ts
72
+ rotateZ(angleDeg: number): WoodBoard
73
+ ```
74
+
75
+ #### `mirror()` — Mirror the board across a plane defined by its normal.
76
+
77
+ ```ts
78
+ mirror(normal: [ number, number, number ]): WoodBoard
79
+ ```
80
+
81
+ #### `color()` — Set the board's display color.
82
+
83
+ ```ts
84
+ color(value: string): WoodBoard
85
+ ```
86
+
87
+ #### `clone()` — Clone the board (creates an independent copy of the underlying shape).
88
+
89
+ ```ts
90
+ clone(): WoodBoard
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Constants
96
+
97
+ ### `Wood`
98
+
99
+ Woodworking namespace — create boards and cut joints. **Boards:** `Wood.board()` creates a WoodBoard with grain, species, and BOM metadata. **Joints:** `Wood.dado()`, `Wood.rabbet()`, `Wood.mortiseAndTenon()` mutate boards in-place by subtracting material, following the same pattern as LaserKit's [`fingerJoint()`](/docs/sheet-metal#fingerjoint).
100
+
101
+ - `readonly board: (width: number, height: number, thickness: number, opts?: WoodBoardOptions) => WoodBoard` — Create a wood board with metadata for manufacturing. The board is a box(width, height, thickness) centered on XY, base at Z=0. Width along X, height along Y, thickness along Z (0 to thickness).
102
+ - `dado(host: WoodBoard, guest: WoodBoard, opts: DadoOptions): void` — Cut a dado (channel) across the face of a host board for a guest board to sit in. Mutates `host.shape` by subtracting a rectangular channel.
103
+ - `rabbet(board: WoodBoard, opts: RabbetOptions): void` — Cut a rabbet (L-shaped step) along an edge of a board. Mutates `board.shape` by subtracting a step from the specified edge.
104
+ - `mortiseAndTenon(mortiseBoard: WoodBoard, tenonBoard: WoodBoard, opts?: MortiseAndTenonOptions): void` — Cut a mortise in one board and shape a tenon on another. Mutates both boards — subtracts the mortise pocket and removes shoulder material to form the tenon.
@@ -0,0 +1,46 @@
1
+ ---
2
+ skill-group: geometry
3
+ skill-order: 1
4
+ ---
5
+
6
+ # Coordinate System Convention
7
+
8
+ ForgeCAD uses a **Z-up** right-handed coordinate system.
9
+
10
+ ## Axes
11
+
12
+ | Axis | Direction | Positive |
13
+ |------|-----------------|----------|
14
+ | X | Left / Right | Right |
15
+ | Y | Forward / Back | Forward |
16
+ | Z | Up / Down | Up |
17
+
18
+ ## Standard Views
19
+
20
+ | View | Camera position direction | Sees plane |
21
+ |--------|--------------------------|------------|
22
+ | Front | −Y | XZ |
23
+ | Back | +Y | XZ |
24
+ | Right | +X | YZ |
25
+ | Left | −X | YZ |
26
+ | Top | +Z | XY |
27
+ | Bottom | −Z | XY |
28
+
29
+ ## GizmoViewcube Face Mapping
30
+
31
+ Three.js BoxGeometry material indices vs ForgeCAD labels (Z-up remapping):
32
+
33
+ | Index | Three.js direction | ForgeCAD label |
34
+ |-------|--------------------|----------------|
35
+ | 0 | +X | Right |
36
+ | 1 | −X | Left |
37
+ | 2 | +Y | Front |
38
+ | 3 | −Y | Back |
39
+ | 4 | +Z | Top |
40
+ | 5 | −Z | Bottom |
41
+
42
+ Default drei labels are Y-up; ForgeCAD passes `faces={['Right','Left','Front','Back','Top','Bottom']}`.
43
+
44
+ ## Grid
45
+
46
+ The ground plane is XY (Z = 0). Extrusion goes along +Z. Manifold is Y-up internally — if a kernel-facing operation behaves as if axes are swapped, check for Manifold Y-up semantics leaking through.
@@ -0,0 +1,52 @@
1
+ ---
2
+ skill-group: geometry
3
+ skill-order: 2
4
+ ---
5
+
6
+ # Geometry Conventions
7
+
8
+ ForgeCAD wraps Manifold (mesh kernel) and Three.js (Y-up renderer). This doc captures convention mismatches and how ForgeCAD resolves them.
9
+
10
+ ## Winding Order
11
+
12
+ CCW = positive area, CW = empty in Manifold's `CrossSection`. ForgeCAD auto-fixes at all entry points:
13
+ - `polygon(points)` — computes signed area (shoelace), reverses if CW
14
+ - `path().close()` — same fix
15
+
16
+ **Rule for new code:** Any function accepting user point arrays that creates a `CrossSection` MUST auto-fix winding.
17
+
18
+ ## Coordinate System (Z-up vs Y-up)
19
+
20
+ Three.js is Y-up; ForgeCAD is Z-up. Fix applied at camera level (`camera.up = (0,0,1)`) — geometry coordinates are native Z-up. Never swap Y/Z in geometry.
21
+
22
+ ## Revolution Axis
23
+
24
+ `CrossSection.revolve()` revolves around Y. Profile X = radial distance, Profile Y = height (becomes Z after revolution). Profile must be at X > 0.
25
+
26
+ ## Boolean Winding (3D)
27
+
28
+ Manifold requires consistent outward face normals. ForgeCAD only creates meshes through Manifold's own constructors, which guarantee correct normals.
29
+
30
+ ## Transform Order
31
+
32
+ Transforms apply left-to-right. `rotate()`, `scale()`, `mirror()` operate around bounding-box center. Use `rotateAround([0,0,0], ...)` to orbit around world origin.
33
+
34
+ For explicit transform objects: `A.mul(B)` = apply A then B; `composeChain(A, B, C)` = A→B→C.
35
+
36
+ ## Assembly Frame Composition
37
+
38
+ ```ts
39
+ childWorld = composeChain(childBase, jointMotion, jointFrame, parentWorld)
40
+ ```
41
+
42
+ Prefer `composeChain(...)` over manual `.mul(...).mul(...)` in kinematics code to avoid order mistakes.
43
+
44
+ ## Summary
45
+
46
+ | Convention | User sees | Kernel needs | Where we fix it |
47
+ |---|---|---|---|
48
+ | Winding | Any point order | CCW | `polygon()`, `path().close()` |
49
+ | Up axis | Z-up | Y-up (Three.js) | `camera.up`, gizmo labels |
50
+ | Revolution | "revolve this profile" | Profile in X-Y, X>0 | Documented only |
51
+ | Face normals | Doesn't think about it | Outward-pointing | Manifold constructors |
52
+ | Transform order | Left-to-right chain | Post-multiply | Native match |