forgecad 0.9.14 → 0.9.15

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 (219) hide show
  1. package/LICENSE +6 -4
  2. package/README.md +8 -4
  3. package/dist/assets/{AdminPage-eWGs2K6H.js → AdminPage-CDyGUinA.js} +2 -2
  4. package/dist/assets/{BenchmarkPage-CTrLKfpo.js → BenchmarkPage-DfPMY_-d.js} +4 -15
  5. package/dist/assets/{BlogPage-5nPesyds.js → BlogPage-kF0fkdJT.js} +2 -2
  6. package/dist/assets/{DocsPage-C4Y3nbYc.js → DocsPage-B954L3YN.js} +9 -3
  7. package/dist/assets/EditorApp-Beb-IZ0y.js +14014 -0
  8. package/dist/assets/{EditorApp-BAnckbsk.css → EditorApp-CuDLxKqL.css} +698 -0
  9. package/dist/assets/{EmbedViewer-C8fB4n5U.js → EmbedViewer-C77B-TrF.js} +3 -3
  10. package/dist/assets/{LandingPageProofDriven-jSz0LaMM.js → LandingPageProofDriven-Cr6fXMDj.js} +35 -37
  11. package/dist/assets/LegalPage-BRlScr9A.css +91 -0
  12. package/dist/assets/LegalPage-Dzklqmmg.js +39 -0
  13. package/dist/assets/{PricingPage-BMedqFef.css → PricingPage-BPF6HKyO.css} +25 -0
  14. package/dist/assets/{PricingPage-B83B90zh.js → PricingPage-zWXkvlwl.js} +19 -19
  15. package/dist/assets/{SettingsPage-DY889pcu.js → SettingsPage-Bz0of4KQ.js} +2 -2
  16. package/dist/assets/app-CE3sYcV7.css +3890 -0
  17. package/dist/assets/{app-bEww1ic4.js → app-D3kDkggg.js} +2293 -946
  18. package/dist/assets/cli/{render-Cho2uKG_.js → render-DSY3mMQa.js} +337 -7
  19. package/dist/assets/{constructionHistoryWorker-HYwzJY4m.js → constructionHistoryWorker-gpDo-uH2.js} +927 -243
  20. package/dist/assets/{evalWorker-CjQwJSE-.js → evalWorker-CU0Ke6DP.js} +7800 -4164
  21. package/dist/assets/{forgecad_geometry-CH2nvuLA.js → forgecad_geometry-Dgceylq9.js} +43 -1
  22. package/dist/assets/forgecad_geometry_bg-dD4RNQF1.wasm +0 -0
  23. package/dist/assets/{inspectWorker-DeRnMVv1.js → inspectWorker-COyp8XXA.js} +927 -243
  24. package/dist/assets/{javascript-70-4uGcz.js → javascript-1kQXfVaz.js} +1 -1
  25. package/dist/assets/landing-proof-driven-DiGqdtWa.js +18 -0
  26. package/dist/assets/{landing-proof-driven-oFYW6mjz.css → landing-proof-driven-ORyigZ6p.css} +13 -7
  27. package/dist/assets/legalContent-ZfFGMmi4.js +251 -0
  28. package/dist/assets/{manifold-CG9Fokx-.js → manifold-BRI5prcH.js} +1 -1
  29. package/dist/assets/{manifold-uRzgk5O8.js → manifold-C-3h2M7p.js} +2 -2
  30. package/dist/assets/{manifold-rmfAcdwF.js → manifold-DNkrUWpA.js} +1 -1
  31. package/dist/assets/{reportWorker-4cW_ZpoS.js → reportWorker-CdBz5bNg.js} +7538 -10857
  32. package/dist/assets/{scalar-sampling-budget-CfDiFvh7.js → scalar-sampling-budget-wJF98aY9.js} +6935 -4331
  33. package/dist/assets/{scanProxyWorker-Bs2TDgLw.js → scanProxyWorker-B-9VbLIs.js} +32 -1
  34. package/dist/assets/{solver-DuJAO8S6.js → solver-BZ9LPTHs.js} +1 -1
  35. package/dist/assets/solver_bg-DAHZJ_rw.wasm +0 -0
  36. package/dist/assets/{targets-D6PWsv6X.js → targets-B9sGB5nB.js} +1 -1
  37. package/dist/assets/{vendor-react-Da3A2QmU.js → vendor-react-6j1Kke-Y.js} +6 -5
  38. package/dist/cli/render.html +1 -1
  39. package/dist/docs/index.html +2 -2
  40. package/dist/docs-raw/AI/ai-native-cad.md +50 -0
  41. package/dist/docs-raw/AI/usage.md +3 -12
  42. package/dist/docs-raw/CLI.md +30 -10
  43. package/dist/docs-raw/component-model.md +27 -11
  44. package/dist/docs-raw/generated/assembly.md +301 -212
  45. package/dist/docs-raw/generated/concepts.md +235 -237
  46. package/dist/docs-raw/generated/core.md +283 -6
  47. package/dist/docs-raw/generated/curves.md +274 -361
  48. package/dist/docs-raw/generated/lib.md +7 -1
  49. package/dist/docs-raw/generated/output.md +19 -4
  50. package/dist/docs-raw/generated/runtime-names.md +41 -0
  51. package/dist/docs-raw/generated/sdf.md +31 -0
  52. package/dist/docs-raw/generated/sheet-metal.md +9 -0
  53. package/dist/docs-raw/generated/sketch.md +44 -1
  54. package/dist/docs-raw/generated/viewport.md +11 -3
  55. package/dist/docs-raw/guides/coordinate-system.md +20 -16
  56. package/dist/docs-raw/guides/geometry-conventions.md +2 -2
  57. package/dist/docs-raw/guides/inspection-bundles.md +2 -1
  58. package/dist/docs-raw/guides/joint-design.md +24 -0
  59. package/dist/docs-raw/guides/positioning.md +13 -3
  60. package/dist/docs-raw/legal/privacy.md +63 -0
  61. package/dist/docs-raw/legal/software-license.md +55 -0
  62. package/dist/docs-raw/legal/terms.md +87 -0
  63. package/dist/docs-raw/skills/forgecad-3d-reconstruction.md +1 -1
  64. package/dist/docs-raw/skills/forgecad-blockout-model.md +1 -1
  65. package/dist/docs-raw/skills/forgecad-component-model.md +11 -2
  66. package/dist/docs-raw/skills/forgecad-high-level-spec.md +1 -1
  67. package/dist/docs-raw/skills/forgecad-image-replicator.md +8 -8
  68. package/dist/docs-raw/skills/forgecad-lld.md +1 -1
  69. package/dist/docs-raw/skills/forgecad-make-a-model.md +1 -1
  70. package/dist/docs-raw/skills/forgecad-model-grader.md +2 -2
  71. package/dist/docs-raw/skills/forgecad-prepare-prompt.md +2 -2
  72. package/dist/docs-raw/skills/forgecad-project.md +1 -1
  73. package/dist/docs-raw/skills/forgecad-reconstruction-benchmark.md +1 -1
  74. package/dist/docs-raw/skills/forgecad-render-inspect.md +4 -2
  75. package/dist/docs-raw/skills/forgecad-visual-spec.md +1 -1
  76. package/dist/docs-raw/skills/forgecad.md +4 -3
  77. package/dist/index.html +40 -12
  78. package/dist/llms.txt +8 -0
  79. package/dist/site.webmanifest +1 -1
  80. package/dist/sitemap.xml +49 -13
  81. package/dist-cli/{check-compiler-U5SOPN7X.js → check-compiler-SDX5QIXI.js} +1 -2
  82. package/dist-cli/{check-query-propagation-XOKNSSYU.js → check-query-propagation-EAYEFT77.js} +1 -2
  83. package/dist-cli/{chunk-EXWGNL6K.js → chunk-N4O47JLF.js} +12540 -9046
  84. package/dist-cli/forgecad.js +1786 -679
  85. package/dist-cli/{forgecad_geometry-GYVNKPIE.js → forgecad_geometry-QOQIIP53.js} +42 -1
  86. package/dist-cli/forgecad_geometry_bg.wasm +0 -0
  87. package/dist-cli/{solver-46FFSK2U.js → solver-OK4HECRH.js} +0 -1
  88. package/dist-cli/solver_bg.wasm +0 -0
  89. package/dist-skill/CONTEXT.md +1117 -721
  90. package/dist-skill/SKILL.md +3 -2
  91. package/dist-skill/docs/API/core/concepts.md +64 -1
  92. package/dist-skill/docs/CLI.md +30 -10
  93. package/dist-skill/docs/generated/assembly.md +277 -229
  94. package/dist-skill/docs/generated/core.md +283 -6
  95. package/dist-skill/docs/generated/curves.md +272 -362
  96. package/dist-skill/docs/generated/lib.md +7 -1
  97. package/dist-skill/docs/generated/output.md +19 -4
  98. package/dist-skill/docs/generated/runtime-names.md +41 -0
  99. package/dist-skill/docs/generated/sdf.md +31 -0
  100. package/dist-skill/docs/generated/sheet-metal.md +9 -0
  101. package/dist-skill/docs/generated/sketch.md +44 -2
  102. package/dist-skill/docs/generated/viewport.md +2 -87
  103. package/dist-skill/docs/guides/coordinate-system.md +20 -16
  104. package/dist-skill/docs/guides/geometry-conventions.md +2 -2
  105. package/dist-skill/docs/guides/inspection-bundles.md +2 -1
  106. package/dist-skill/docs/guides/joint-design.md +24 -0
  107. package/dist-skill/docs/guides/positioning.md +13 -3
  108. package/dist-skill/library/forgecad-component-model/SKILL.md +10 -1
  109. package/dist-skill/library/forgecad-image-replicator/SKILL.md +6 -6
  110. package/dist-skill/library/forgecad-image-replicator/scripts/compare_images.py +166 -0
  111. package/dist-skill/library/forgecad-model-grader/SKILL.md +1 -1
  112. package/dist-skill/library/forgecad-prepare-prompt/SKILL.md +1 -1
  113. package/dist-skill/library/forgecad-render-inspect/SKILL.md +3 -1
  114. package/examples/api/assembly-kinematics-foundation.forge.js +65 -0
  115. package/examples/api/assembly-kinematics-four-bar.forge.js +115 -0
  116. package/examples/api/assembly-kinematics-limb.forge.js +116 -0
  117. package/examples/api/connector-frame-rig-chain.forge.js +102 -0
  118. package/examples/api/exact-sheet-shell-assembly.forge.js +0 -2
  119. package/examples/api/exact-surface-studio.forge.js +6 -8
  120. package/examples/api/helix-basics.forge.js +6 -6
  121. package/examples/api/lean-foundations/README.md +12 -0
  122. package/examples/api/lean-foundations/curve-blend-exact.forge.js +22 -0
  123. package/examples/api/lean-foundations/curve-fit-interpolation.forge.js +18 -0
  124. package/examples/api/lean-foundations/curve-helix-canonicalization.forge.js +27 -0
  125. package/examples/api/lean-foundations/curve-route-canonicalization.forge.js +16 -0
  126. package/examples/api/lean-foundations/curve-trim-reverse.forge.js +24 -0
  127. package/examples/api/lean-foundations/exact-curve-arc.forge.js +36 -0
  128. package/examples/api/mixed-edge-finishes-proof.forge.js +8 -11
  129. package/examples/api/route3d-elbow.forge.js +68 -0
  130. package/examples/api/transition-curves.forge.js +44 -15
  131. package/examples/api/y-blend-corner-showcase.forge.js +0 -2
  132. package/examples/generative/coral-vase.forge.js +1 -1
  133. package/examples/nurbs-tube.forge.js +1 -1
  134. package/package.json +14 -13
  135. package/dist/assets/EditorApp-lXv53A1m.js +0 -13610
  136. package/dist/assets/app-CsHnaBWt.css +0 -1789
  137. package/dist/assets/forgecad_geometry_bg-C5_E9Oa9.wasm +0 -0
  138. package/dist/assets/solver_bg-CWvv4lnN.wasm +0 -0
  139. package/dist/docs-raw/API/README.md +0 -16
  140. package/dist/docs-raw/API/core/concepts.md +0 -118
  141. package/dist/docs-raw/INDEX.md +0 -138
  142. package/dist/docs-raw/RELEASING.md +0 -87
  143. package/dist/docs-raw/agent-native-api.md +0 -27
  144. package/dist/docs-raw/beta-deployment.md +0 -304
  145. package/dist/docs-raw/beta-operations.md +0 -325
  146. package/dist/docs-raw/blueprint-first.md +0 -145
  147. package/dist/docs-raw/cli-monetization.md +0 -112
  148. package/dist/docs-raw/coding-best-practices.md +0 -120
  149. package/dist/docs-raw/coding.md +0 -340
  150. package/dist/docs-raw/deployment.md +0 -374
  151. package/dist/docs-raw/guides/skill-maintenance.md +0 -161
  152. package/dist/docs-raw/guides/surface-members.md +0 -82
  153. package/dist/docs-raw/harbor-cli.md +0 -854
  154. package/dist/docs-raw/internals/backend-vocabulary.md +0 -35
  155. package/dist/docs-raw/internals/compiler.md +0 -307
  156. package/dist/docs-raw/internals/constraint-solver-quality.md +0 -161
  157. package/dist/docs-raw/internals/constraint-solver.md +0 -176
  158. package/dist/docs-raw/internals/shape-from-slices.md +0 -152
  159. package/dist/docs-raw/internals/sketch-2d-pipeline.md +0 -108
  160. package/dist/docs-raw/platform/admin.md +0 -45
  161. package/dist/docs-raw/platform/architecture.md +0 -82
  162. package/dist/docs-raw/platform/auth.md +0 -139
  163. package/dist/docs-raw/platform/email.md +0 -67
  164. package/dist/docs-raw/platform/google-oauth-setup.md +0 -88
  165. package/dist/docs-raw/platform/observability.md +0 -197
  166. package/dist/docs-raw/platform/projects.md +0 -111
  167. package/dist/docs-raw/platform/sharing.md +0 -90
  168. package/dist/docs-raw/product/README.md +0 -39
  169. package/dist/docs-raw/product/api-as-product-language.md +0 -13
  170. package/dist/docs-raw/product/business-model.md +0 -15
  171. package/dist/docs-raw/product/competitive-positioning.md +0 -17
  172. package/dist/docs-raw/product/creative-manufacturing.md +0 -15
  173. package/dist/docs-raw/product/founder-story.md +0 -11
  174. package/dist/docs-raw/product/manufacturing-workflows.md +0 -15
  175. package/dist/docs-raw/product/onboarding-first-experience.md +0 -256
  176. package/dist/docs-raw/product/product-loop.md +0 -17
  177. package/dist/docs-raw/product/strategic-decisions.md +0 -22
  178. package/dist/docs-raw/product/user-outreach-email-templates.md +0 -161
  179. package/dist/docs-raw/product/user-segments.md +0 -15
  180. package/dist/docs-raw/product/vision.md +0 -26
  181. package/dist/docs-raw/rl-environments.md +0 -350
  182. package/dist/docs-raw/runbook.md +0 -611
  183. package/dist-cli/check-compiler-U5SOPN7X.js.map +0 -1
  184. package/dist-cli/check-query-propagation-XOKNSSYU.js.map +0 -1
  185. package/dist-cli/chunk-EXWGNL6K.js.map +0 -1
  186. package/dist-cli/forgecad.js.map +0 -1
  187. package/dist-cli/forgecad_geometry-GYVNKPIE.js.map +0 -1
  188. package/dist-cli/solver-46FFSK2U.js.map +0 -1
  189. package/dist-skill/SKILL-dev.md +0 -145
  190. package/dist-skill/docs-dev/API/core/concepts.md +0 -118
  191. package/dist-skill/docs-dev/CLI.md +0 -677
  192. package/dist-skill/docs-dev/agent-native-api.md +0 -27
  193. package/dist-skill/docs-dev/blueprint-first.md +0 -145
  194. package/dist-skill/docs-dev/coding-best-practices.md +0 -120
  195. package/dist-skill/docs-dev/coding.md +0 -340
  196. package/dist-skill/docs-dev/component-model.md +0 -164
  197. package/dist-skill/docs-dev/generated/assembly.md +0 -794
  198. package/dist-skill/docs-dev/generated/core.md +0 -2117
  199. package/dist-skill/docs-dev/generated/curves.md +0 -2583
  200. package/dist-skill/docs-dev/generated/lib.md +0 -169
  201. package/dist-skill/docs-dev/generated/output.md +0 -247
  202. package/dist-skill/docs-dev/generated/sdf.md +0 -446
  203. package/dist-skill/docs-dev/generated/sheet-metal.md +0 -504
  204. package/dist-skill/docs-dev/generated/sketch.md +0 -1811
  205. package/dist-skill/docs-dev/generated/viewport.md +0 -585
  206. package/dist-skill/docs-dev/generated/wood.md +0 -108
  207. package/dist-skill/docs-dev/guides/coordinate-system.md +0 -46
  208. package/dist-skill/docs-dev/guides/geometry-conventions.md +0 -52
  209. package/dist-skill/docs-dev/guides/inspection-bundles.md +0 -485
  210. package/dist-skill/docs-dev/guides/joint-design.md +0 -78
  211. package/dist-skill/docs-dev/guides/modeling-recipes.md +0 -78
  212. package/dist-skill/docs-dev/guides/positioning.md +0 -161
  213. package/dist-skill/docs-dev/guides/skill-maintenance.md +0 -161
  214. package/dist-skill/docs-dev/internals/backend-vocabulary.md +0 -35
  215. package/dist-skill/docs-dev/internals/compiler.md +0 -307
  216. package/dist-skill/docs-dev/internals/constraint-solver-quality.md +0 -161
  217. package/dist-skill/docs-dev/internals/constraint-solver.md +0 -176
  218. package/dist-skill/docs-dev/internals/sketch-2d-pipeline.md +0 -108
  219. package/dist-skill/library/forgecad-image-replicator/scripts/compare_images.mjs +0 -289
@@ -5,12 +5,12 @@ skill-order: 100
5
5
 
6
6
  # Assembly API
7
7
 
8
- Kinematic assemblies, joints, couplings, and robot export.
8
+ Assembly-owned links, constraints, connectors, solved poses, and robot export.
9
9
 
10
10
  ## Contents
11
11
 
12
- - [Assembly & Joints](#assembly-joints) — `bomToCsv`, `assembly`, `joint`
13
- - [Assembly](#assembly) — Structure, Connectors, References, Joints, Solving
12
+ - [Assembly & Joints](#assembly-joints) — `bomToCsv`, `assembly`
13
+ - [Assembly](#assembly) — Kinematics, Structure, Connectors, References, Solving
14
14
  - [ImportedAssembly](#importedassembly)
15
15
  - [SolvedAssembly](#solvedassembly)
16
16
  - [MateBuilder](#matebuilder)
@@ -36,96 +36,121 @@ bomToCsv(rows: BomRow[]): string
36
36
  | `tags?` | `string \| readonly string[]` | Viewport organization tags applied to scene objects produced from this part. |
37
37
  | `material?`, `process?`, `tolerance?`, `qty?`, `notes?`, `densityKgM3?`, `massKg?` | | — |
38
38
 
39
- #### `assembly()` — Create an assembly container with named parts and joints for kinematic mechanisms.
39
+ #### `assembly()` — Create an assembly container with named parts, connectors, and kinematic links.
40
40
 
41
- **Use this from iteration 1 for any model with moving parts.** Hinges, sliders, gears, articulated fingers, doors — all start with `assembly()`, not with manual rotation math. Don't build a static "extended pose" first and refactor to an assembly later: joint sliders, animations, sweeps, collision detection, and robot export all flow from the kinematic graph.
41
+ **Use this from iteration 1 for any model with moving parts.** Do not build one static pose and retrofit motion later.
42
42
 
43
- An assembly models a mechanism as a directed graph of parts connected by joints. Parts are the nodes; joints are directed edges from parent to child. The graph must be a forest (no cycles). Root parts (those with no incoming joint) are anchored to world space.
43
+ Links are named kinematic markers in the assembly. `edgeBetweenLinks()` records structural distances or visual relationships. `addAngleBetweenLinks()` records measured, limited, or controlled angles. These APIs solve point positions, not rigid-body frames.
44
44
 
45
- Three joint types are supported: `'revolute'` (hinge), `'prismatic'` (slider), and `'fixed'` (rigid attachment). Use `addPart()` to add geometry, `addJoint()` (or the shorthands `addRevolute()`, `addPrismatic()`, `addFixed()`) to connect parts, and `solve()` to compute world-space positions at a given joint state.
45
+ `addPart(..., { mate })` attaches a part connector origin to a solved link point by translation only. It is right for markers and point-following geometry. Use `connect()` / `match()` for physical articulated parts that need full connector frame alignment and deterministic rest orientation.
46
46
 
47
- The higher-level `connect()` API uses declared **connectors** to compute joint frames automatically. The `match()` API uses typed connectors (with gender and type metadata) for automatic compatibility validation and joint creation.
47
+ Return an `Assembly` directly to expose its connector joints and driven link controls in the editor. Moving those controls re-runs the assembly solve with the new state, so closed-loop link/edge mechanisms move through the real kinematic solver instead of a viewport-only forward-kinematics approximation.
48
48
 
49
- For multi-file assemblies, a file that returns an `Assembly` is importable via [`require()`](/docs/core#require) and yields an `ImportedAssembly`. Use `mergeInto()` to flatten a sub-assembly into a parent assembly.
50
-
51
- ```ts
52
- const mech = assembly("Arm")
53
- .addPart("base", box(80, 80, 20).translate(0, 0, -10), {
54
- metadata: { material: "PETG", process: "FDM", qty: 1 },
55
- })
56
- .addPart("link", box(140, 24, 24).translate(0, -12, -12))
57
- .addRevolute("shoulder", "base", "link", {
58
- axis: [0, 1, 0],
59
- min: -30, max: 120, default: 25,
60
- frame: Transform.identity().translate(0, 0, 20),
61
- });
49
+ If no link in a connected kinematic component is fixed, ForgeCAD chooses a deterministic gauge link for solving and reports a floating-component warning.
62
50
 
63
- return mech; // auto-solved at defaults, renders all parts
64
- ```
51
+ The legacy joint-chain APIs still exist for compatibility and exporter plumbing. New work should choose between point-link kinematics and connector-frame joints based on whether the part needs orientation.
65
52
 
66
- ```ts
67
- assembly(name?: string): Assembly
68
- ```
53
+ For multi-file assemblies, a file that returns an `Assembly` is importable via [`require()`](/docs/core#require) and yields an `ImportedAssembly`. Use `mergeInto()` to flatten a sub-assembly into a parent assembly.
69
54
 
70
- #### `joint()` — Create a revolute joint that auto-generates a parameter slider and rotates the shape.
55
+ **Point-link example**
71
56
 
72
- This is a convenience wrapper for single-shape, single-joint use cases. It calls `param()` to create a named angle slider, then applies `rotateAroundAxis()` to the shape. Use the full `Assembly` API for mechanisms with multiple parts and joints.
57
+ This snippet mates a marker to the solved `tip` point. It does not orient a bar along `ground -> tip`.
73
58
 
74
59
  ```ts
75
- const arm = joint("Shoulder", armShape, [0, 0, 20], {
76
- axis: [0, 1, 0],
77
- min: -30, max: 120, default: 25,
60
+ const marker = box(8, 8, 4).withConnectors({
61
+ center: connector({ origin: [0, 0, 0], axis: [0, 0, 1] }),
78
62
  });
79
- return arm;
63
+
64
+ const mech = assembly("Linkage")
65
+ .link("ground", { at: [0, 0, 0], fixed: true })
66
+ .link("worldX", { at: [10, 0, 0], fixed: true })
67
+ .link("tip", { at: [40, 0, 0] })
68
+ .edgeBetweenLinks("ground", "tip", { name: "bar" })
69
+ .addAngleBetweenLinks("worldX", "ground", "tip", {
70
+ name: "theta",
71
+ control: { min: 0, max: 120, default: 30 },
72
+ })
73
+ .addPart("Tip marker", marker, { mate: { connector: "center", toLink: "tip" } });
74
+
75
+ return mech;
80
76
  ```
81
77
 
82
78
  ```ts
83
- joint(name: string, shape: Shape, pivot: [ number, number, number ], opts?: RevoluteJointOpts): Shape
79
+ assembly(name?: string): Assembly
84
80
  ```
85
81
 
86
- `RevoluteJointOpts`: `{ axis?: [ number, number, number ], min?: number, max?: number, default?: number, unit?: string, reverse?: boolean }`
87
-
88
82
  ---
89
83
 
90
84
  ## Classes
91
85
 
92
86
  ### `Assembly`
93
87
 
94
- Container for a kinematic mechanism made up of named parts and joints.
88
+ Container for a kinematic mechanism made up of links, relationships, and parts.
95
89
 
96
- An assembly is a directed graph where **parts** are nodes and **joints** are directed edges from parent to child. The graph must be a forest (one or more trees with no cycles). Root parts (no incoming joint) are fixed to world space.
90
+ Assembly has two related but different motion tools:
97
91
 
98
- Each joint carries a `frame` transform (from the parent part frame to the joint's zero-state frame) and a motion formula:
92
+ - **Link graph kinematics** (`link()`, `edgeBetweenLinks()`, `addAngleBetweenLinks()`) solve named point positions. A link is a point, not a rigid-body frame or bone. Connector-to-link mates then place geometry on the solved graph: one mate translates a connector origin onto a link, two mates orient a part so it spans between two solved links, and a third mate pins roll about that span.
93
+ - **Connector-frame joints** (`connect()` / `match()`) align full connector frames and derive joint frame + axis from `origin`, `axis`, and `up`. Use this for serial articulated geometry such as hips, knees, hinges, drums, sliders, and wheels where the physical part orientation matters.
99
94
 
100
- ```
101
- childWorld = parentWorld × frame × motion(value) × childBase
102
- ```
95
+ Use link graphs when the hard part is solving positions, especially closed loops. Use connector-frame joints when the hard part is a serial tree of explicit rigid-body joint frames such as hinges, sliders, drums, and wheels.
103
96
 
104
- Three joint types are supported:
97
+ **Point-link quick start**
105
98
 
106
- - **revolute** rotates the child around an axis by `value` degrees
107
- - **prismatic** — translates the child along an axis by `value` mm
108
- - **fixed** — no motion; rigidly attaches the child at `frame`
109
-
110
- **Quick start**
99
+ This attaches a marker to a solved point. It is intentionally not a bone or oriented part example.
111
100
 
112
101
  ```ts
113
- const mech = assembly("Arm")
114
- .addPart("base", box(80, 80, 20).translate(0, 0, -10))
115
- .addPart("link", box(140, 24, 24).translate(0, -12, -12))
116
- .addJoint("shoulder", "revolute", "base", "link", {
117
- axis: [0, 1, 0],
118
- min: -30, max: 120, default: 25,
119
- frame: Transform.identity().translate(0, 0, 20),
102
+ const marker = box(8, 8, 4).withConnectors({
103
+ center: connector({ origin: [0, 0, 0], axis: [0, 0, 1] }),
104
+ });
105
+
106
+ const mech = assembly("Linkage")
107
+ .link("ground", { at: [0, 0, 0], fixed: true })
108
+ .link("worldX", { at: [10, 0, 0], fixed: true })
109
+ .link("tip", { at: [40, 0, 0] })
110
+ .edgeBetweenLinks("ground", "tip", { name: "bar" })
111
+ .addAngleBetweenLinks("worldX", "ground", "tip", {
112
+ name: "theta",
113
+ control: { min: 0, max: 120, default: 30 },
114
+ })
115
+ .addPart("Tip marker", marker, {
116
+ mate: { connector: "center", toLink: "tip" },
120
117
  });
121
118
 
122
- return mech; // auto-solved at defaults
119
+ return mech;
120
+ ```
121
+
122
+ Returning an unsolved `Assembly` keeps the graph available to the runtime. Return a `SolvedAssembly` directly for a specific control state:
123
+
124
+ ```ts
125
+ return mech.solve({ theta: 60 });
123
126
  ```
124
127
 
125
- Returning an unsolved `Assembly` auto-solves at default joint values. Return a `SolvedAssembly` directly for a specific pose:
128
+ **Frame-aware serial joint**
126
129
 
127
130
  ```ts
128
- return mech.solve({ shoulder: 60 });
131
+ const hip = cylinder(12, 10).withConnectors({
132
+ socket: connector("hinge", {
133
+ origin: [0, 0, 6],
134
+ axis: [0, 0, 1],
135
+ up: [1, 0, 0],
136
+ kind: "revolute",
137
+ }),
138
+ });
139
+
140
+ const upperLeg = box(60, 10, 8).translate(30, 0, -4).withConnectors({
141
+ hip: connector("hinge", {
142
+ origin: [0, 0, 0],
143
+ axis: [0, 0, -1],
144
+ up: [1, 0, 0],
145
+ kind: "revolute",
146
+ }),
147
+ });
148
+
149
+ return assembly("Leg")
150
+ .addPart("Hip", hip)
151
+ .addPart("Upper Leg", upperLeg)
152
+ .connect("Hip.socket", "Upper Leg.hip", { as: "hip", min: -35, max: 55 })
153
+ .solve({ hip: 20 });
129
154
  ```
130
155
 
131
156
  **Return types**
@@ -141,6 +166,90 @@ return mech.solve({ shoulder: 60 });
141
166
  |----------|------|-------------|
142
167
  | `name` | `string` | — |
143
168
 
169
+ **Kinematics**
170
+
171
+ #### `link()` — Add a named kinematic link to the assembly graph.
172
+
173
+ Links are assembly-native solved points. They can exist before any geometry is attached, can be displayed by the viewport, and are solved by link/edge/angle constraints.
174
+
175
+ A link is not a rigid-body frame. It has a world position but no orientation basis. Use `connect()` when a physical part must inherit a connector frame and rotate about a real hinge/slider axis.
176
+
177
+ ```ts
178
+ link(name: string, options?: AssemblyLinkOptions): Assembly
179
+ ```
180
+
181
+ **`AssemblyLinkOptions`**
182
+ - `at?: [ number, number, number ]` — Initial world-space position of this link before kinematic constraints solve it.
183
+ - `fixed?: boolean` — Keep the link locked at its authored `at` position during solves.
184
+ - `metadata?: Record<string, unknown>` — User metadata carried through the kinematic graph for inspection and tooling.
185
+
186
+ #### `edgeBetweenLinks()` — Add a relationship edge between two kinematic links.
187
+
188
+ By default the edge captures the authored distance between links as a structural length. Pass `{ length: 'free' }` or `{ visualOnly: true }` for a non-structural overlay edge.
189
+
190
+ ```ts
191
+ edgeBetweenLinks(a: string, b: string, options?: AssemblyEdgeBetweenLinksOptions): Assembly
192
+ ```
193
+
194
+ **`AssemblyEdgeBetweenLinksOptions`**: `name?: string`, `length?: number | "lockCurrent" | "free"`, `min?: number`, `max?: number`, `visualOnly?: boolean`, `control?: AssemblyKinematicControlOptions`, `metadata?: Record<string, unknown>`
195
+
196
+ `AssemblyKinematicControlOptions`: `{ min?: number, max?: number, default?: number, unit?: string }`
197
+
198
+ #### `addAngleBetweenLinks()` — Add an angle relationship among three kinematic links.
199
+
200
+ The middle link is the vertex. When `control` is set, `solve(state)` reads the control value from `state[name]` and solves dependent links from that driven angle.
201
+
202
+ ```ts
203
+ addAngleBetweenLinks(a: string, b: string, c: string, options?: AssemblyAngleBetweenLinksOptions): Assembly
204
+ ```
205
+
206
+ **`AssemblyAngleBetweenLinksOptions`**: `name?: string`, `value?: number`, `min?: number`, `max?: number`, `control?: boolean | AssemblyKinematicControlOptions`, `limit?: AssemblyKinematicLimitOptions`, `metadata?: Record<string, unknown>`
207
+
208
+ `AssemblyKinematicLimitOptions`: `{ min?: number, max?: number }`
209
+
210
+ #### `describeKinematics()` — Return the assembly-native kinematic graph definition.
211
+
212
+ ```ts
213
+ describeKinematics(): AssemblyKinematicGraphDef
214
+ ```
215
+
216
+ **Structure**
217
+
218
+ #### `addPart()` — Add a named part to the assembly.
219
+
220
+ Connectors declared on the part (via `withConnectors()`) are captured automatically. Parts are positioned at world origin by default unless a `transform` is provided in `options`. For root parts (no incoming joint), `transform` is their final world position.
221
+
222
+ `options.mate` is for point-link attachments. During `solve()`, ForgeCAD translates the part so the named connector origin lands on the solved link position. The part keeps its existing orientation; connector `axis` and `up` are not used for link mating. Use this for markers, sensors, labels, and other geometry that should ride on a solved point. Use `connect()` for oriented physical parts such as limbs, levers, hinges, and wheels.
223
+
224
+ When a part is a [`ShapeGroup`](/docs/core#shapegroup), name the group children explicitly to get readable viewport labels (e.g. `"Base Assembly.Body"` instead of `"Base Assembly.1"`):
225
+
226
+ ```ts
227
+ const housing = group(
228
+ { name: "Body", shape: body },
229
+ { name: "Lid", shape: lid },
230
+ );
231
+ assembly.addPart("Base Assembly", housing);
232
+ ```
233
+
234
+ ```ts
235
+ addPart(name: string, part: AssemblyPart, options?: PartOptions): Assembly
236
+ ```
237
+
238
+ `PartOptions`: `{ transform?: TransformInput, metadata?: PartMetadata, mate?: AssemblyPartMateInput | AssemblyPartMateInput[] }`
239
+
240
+ **`AssemblyPartMateInput`**
241
+ - `connector: string` — Name of a connector declared on the part (via `withConnectors()`).
242
+ - `toLink: string` — Name of the link this connector's origin is pinned to.
243
+ - `aimLink?: string` — Optional second link to orient toward. When set, the part is rotated so the connector's **axis** aims from `toLink` toward `aimLink`, posing an oriented bone instead of only translating it. For full pose without relying on a connector axis, declare a second mate (two connectors → two links).
244
+
245
+ #### `addFrame()` — Add a virtual reference frame (no geometry) to the assembly graph.
246
+
247
+ Useful when you need a named pivot point or coordinate frame that has no visual geometry. Acts like a zero-volume part and can be connected to other parts via joints.
248
+
249
+ ```ts
250
+ addFrame(name: string, options?: PartOptions): Assembly
251
+ ```
252
+
144
253
  **Connectors**
145
254
 
146
255
  #### `usedConnectorRefs()` — Connector refs (e.g. "PartName.connectorName") consumed by connect/match calls.
@@ -159,6 +268,10 @@ Use the single-argument overload to attach assembly-level connectors — these a
159
268
  withConnectors(partName: string, connectors: Record<string, ConnectorInput>): Assembly
160
269
  ```
161
270
 
271
+ **`PortInput`**: `origin?: [ number, number, number ]`, `axis?: [ number, number, number ]`, `start?: [ number, number, number ]`, `end?: [ number, number, number ]`, `up?: [ number, number, number ]`, `kind?: JointType`, `min?: number`, `max?: number`
272
+
273
+ `ConnectorInput`: `{ connectorType?: string, gender?: ConnectorGender, measurements?: Record<string, number | string> }`
274
+
162
275
  #### `getConnectors()` — Get connectors declared on a part in part-local space.
163
276
 
164
277
  ```ts
@@ -175,23 +288,35 @@ getConnector(ref: string): { partName: string; connectorName: string; connector:
175
288
 
176
289
  Connector references use `"PartName.connectorName"` format. The system aligns connector origins (child connector lands exactly on parent connector) and derives the joint frame and axis from the connector geometry — no manual `frame` or `axis` math needed.
177
290
 
291
+ Use `connect()` for frame-aware articulated geometry. A connector's `origin` is the pivot/contact point, `axis` is the hinge line or slide direction, and `up` is the secondary orientation vector that locks the part's zero-angle twist. If `up` is omitted, ForgeCAD chooses a deterministic perpendicular vector, but authored mechanisms should provide `up` whenever rest orientation matters.
292
+
178
293
  **Face-to-face convention:** Connectors always meet face-to-face, like a USB plug meeting a socket. Each connector's axis points "outward" from its part. When two connectors mate, the system brings them together so their axes oppose (anti-parallel). This is the same convention used by `matchTo()`.
179
294
 
180
295
  For a revolute joint (hinge), both connectors' axes should point outward from their respective parts along the hinge line. For a prismatic joint (slider), both axes should point along the slide direction from their part's perspective.
181
296
 
297
+ **Mirrored revolute axes:** Revolute values follow the right-hand rule around the joint axis. If a bilateral mechanism mirrors a hinge axis, for example `[1, 0, 0]` on the right side and `[-1, 0, 0]` on the left side, the same physical `+theta` value rotates the two sides in opposite fore/aft senses. The mirrored pose uses the negated revolute value; physical limits mirror as `[min, max] -> [-max, -min]`. Prismatic joints do not have this handedness flip. For bilateral mechanisms, prefer side-neutral link controls or an explicit state mapping when you want equal semantic pose values on both sides.
298
+
182
299
  The joint type is inferred from the connector's `kind` field if not specified in `options`.
183
300
 
184
301
  When connectors are defined with `start`/`end`, you can control which point on each connector meets via `align` / `parentAlign` / `childAlign` (`'start'`, `'middle'`, `'end'`).
185
302
 
186
- Use `connect()` when connector origins must physically coincide (flange-to-flange, bolt-into-bore). For mechanisms where parts share an axis but are deliberately spaced apart, use `addRevolute()` with pre-positioned parts instead.
303
+ Use `connect()` when connector origins must physically coincide (flange-to-flange, bolt-into-bore).
187
304
 
188
305
  ```ts
189
306
  // Hinge: both axes point outward along the hinge line
190
307
  const frame = box(100, 10, 80).withConnectors({
191
- hinge: connector("hinge", { origin: [0, 0, 40], axis: [0, 0, 1] }),
308
+ hinge: connector("hinge", {
309
+ origin: [0, 0, 40],
310
+ axis: [0, 0, 1],
311
+ up: [1, 0, 0],
312
+ }),
192
313
  });
193
314
  const door = box(60, 4, 80).withConnectors({
194
- hinge: connector("hinge", { origin: [0, 0, 40], axis: [0, 0, -1] }),
315
+ hinge: connector("hinge", {
316
+ origin: [0, 0, 40],
317
+ axis: [0, 0, -1],
318
+ up: [1, 0, 0],
319
+ }),
195
320
  });
196
321
  assembly("Door")
197
322
  .addPart("Frame", frame)
@@ -203,6 +328,16 @@ assembly("Door")
203
328
  connect(parentConnectorRef: string, childConnectorRef: string, options?: ConnectOptions): Assembly
204
329
  ```
205
330
 
331
+ **`ConnectOptions`**
332
+
333
+ | Option | Type | Description |
334
+ |--------|------|-------------|
335
+ | `flip?` | `boolean` | This parameter is ignored. If your connectors produce wrong orientation, fix the connector axis directions instead of using flip. |
336
+ | `parentAlign?` | `PortAlign` | Which point on the parent connector to align: 'start', 'middle' (default), or 'end'. |
337
+ | `childAlign?` | `PortAlign` | Which point on the child connector to align: 'start', 'middle' (default), or 'end'. |
338
+ | `align?` | `PortAlign` | Shorthand: set both parentAlign and childAlign at once. |
339
+ | `as?`, `type?`, `min?`, `max?`, `default?`, `unit?`, `effort?`, `velocity?`, `damping?`, `friction?` | | — |
340
+
206
341
  #### `match()` — Auto-create a joint by matching typed connectors between two parts.
207
342
 
208
343
  Connectors can carry a `connectorType` string and a `gender` (`'male'`, `'female'`, or `'neutral'`). `match()` validates type and gender compatibility (use `{ force: true }` to skip validation) and creates the joint automatically from the connector's `kind` metadata.
@@ -225,13 +360,15 @@ const mech = assembly("Door")
225
360
  .addPart("Frame", frame)
226
361
  .addPart("Door", door)
227
362
  .match("Door", "Frame", { hinge_top: "hinge_top", hinge_bottom: "hinge_bottom" });
228
- // Revolute connectors auto-creates revolute joint. No manual addRevolute needed.
363
+ // Matching connectors computes the placement relationship automatically.
229
364
  ```
230
365
 
231
366
  ```ts
232
367
  match(childPartName: string, parentPartName: string, pairs: Record<string, string>, options?: MatchToOptions & { as?: string; }): Assembly
233
368
  ```
234
369
 
370
+ `MatchToOptions`: `{ force?: boolean, angle?: number, distance?: number }`
371
+
235
372
  **References**
236
373
 
237
374
  #### `withReferences()` — Attach named placement reference points to this assembly. These are surfaced automatically on the ImportedAssembly when this file is imported via require(), so consumers can use placeReference() without re-declaring them. Returns a new Assembly — does not mutate.
@@ -240,22 +377,28 @@ match(childPartName: string, parentPartName: string, pairs: Record<string, strin
240
377
  withReferences(refs: Pick<PlacementReferenceInput, "points">): Assembly
241
378
  ```
242
379
 
243
- **Solving**
380
+ **`PlacementReferenceInput`**: `points?: Record<string, [ number, number, number ]>`, `edges?: Record<string, PlacementEdgeRef>`, `surfaces?: Record<string, PlacementSurfaceRef>`, `objects?: Record<string, PlacementObjectInput>`
244
381
 
245
- #### `solve()` Solve the assembly at the given joint state and return positioned parts.
382
+ `PlacementEdgeRef`: `{ start: Vec3, end: Vec3 }`
246
383
 
247
- Performs a depth-first traversal of the joint graph. Each joint's value is taken from `state`, falling back to `defaultValue`. Coupled joints compute their value from source joints. Values outside `[min, max]` are clamped (a warning is added to `SolvedAssembly.warnings()`).
384
+ `PlacementSurfaceRef`: `{ center: Vec3, normal: Vec3 }`
385
+
386
+ **Solving**
248
387
 
249
- If mate constraints were registered via `mate()`, the solver runs a pre-pass to derive base transforms, then the kinematic DFS applies joints on top of those positions.
388
+ #### `solve()` Solve the assembly at the given control state and return positioned parts.
250
389
 
251
- **Pitfall [`jointsView`](/docs/viewport#jointsview) double-rotation:** When calling `toJointsView()`, always solve at the rest pose (all joint values = 0 or default). Solving at a non-zero angle and then animating will double-rotate parts. Use the `defaults` option on `toJointsView()` to set the initial display angle instead.
390
+ Solves assembly-native kinematic links first. Controlled `addAngleBetweenLinks()` relationships read values from `state` by name, clamp to their declared limits, and expose the solved graph on `SolvedAssembly.kinematics`. Angles solve in the plane of their three authored link positions, so a limb that swings out of the `z = 0` plane poses correctly; structural edges hold their bone lengths so a fully angle-driven serial chain follows forward kinematics.
252
391
 
253
- This pitfall only applies when `toJointsView()` is active. If you only want a static posed result, return the solved assembly directly and skip `toJointsView()`.
392
+ Connector mates declared on `addPart(..., { mate })` attach geometry to solved links while preserving part and connector identity:
254
393
 
255
- **Example static posed output (no `toJointsView()`)**
394
+ - one mate **positions** the connector origin on its link;
395
+ - a mate with `aimLink` (or a second mate to another link) also **orients** the part, rotating an oriented bone to span its links rather than only translating it;
396
+ - a third mate **pins the roll** about the bone axis (full frame), e.g. a bore or clevis that must face a specific way.
397
+
398
+ Connector-frame joints created by `connect()` / `match()` are also evaluated; their values are read from `state` by joint name and clamped to joint limits.
256
399
 
257
400
  ```ts
258
- return mech.solve({ shoulder: 45, elbow: -20 });
401
+ return mech.solve({ theta: 45 });
259
402
  ```
260
403
 
261
404
  ```ts
@@ -270,158 +413,6 @@ solve(state?: JointState): SolvedAssembly
270
413
  mate(fn: (m: MateBuilder) => void): Assembly
271
414
  ```
272
415
 
273
- #### `addFrame()` — Add a virtual reference frame (no geometry) to the assembly graph.
274
-
275
- Useful when you need a named pivot point or coordinate frame that has no visual geometry. Acts like a zero-volume part and can be connected to other parts via joints.
276
-
277
- ```ts
278
- addFrame(name: string, options?: PartOptions): Assembly
279
- ```
280
-
281
- #### `addPart()` — Add a named part to the assembly.
282
-
283
- Connectors declared on the part (via `withConnectors()`) are captured automatically. Parts are positioned at world origin by default unless a `transform` is provided in `options`. For root parts (no incoming joint), `transform` is their final world position.
284
-
285
- When a part is a [`ShapeGroup`](/docs/core#shapegroup), name the group children explicitly to get readable viewport labels (e.g. `"Base Assembly.Body"` instead of `"Base Assembly.1"`):
286
-
287
- ```ts
288
- const housing = group(
289
- { name: "Body", shape: body },
290
- { name: "Lid", shape: lid },
291
- );
292
- assembly.addPart("Base Assembly", housing);
293
- ```
294
-
295
- ```ts
296
- addPart(name: string, part: AssemblyPart, options?: PartOptions): Assembly
297
- ```
298
-
299
- #### `addJoint()` — Add a kinematic joint between a parent and child part.
300
-
301
- `frame` is a transform from the **parent part frame** to the **joint frame at zero state**. The child's world position is computed as:
302
-
303
- ```
304
- childWorld = parentWorld × frame × motion(value) × childBase
305
- ```
306
-
307
- For revolute joints `value` is in degrees; for prismatic joints `value` is in mm. Coupled joints (see `addJointCoupling`) ignore the `state` value passed to `solve()` and compute their value from source joints.
308
-
309
- ```ts
310
- addJoint(name: string, type: JointType, parent: string, child: string, options?: JointOptions): Assembly
311
- ```
312
-
313
- #### `addRevolute()` — Shorthand for `addJoint(name, 'revolute', parent, child, options)`.
314
-
315
- ```ts
316
- addRevolute(name: string, parent: string, child: string, options?: JointOptions): Assembly
317
- ```
318
-
319
- #### `addPrismatic()` — Shorthand for `addJoint(name, 'prismatic', parent, child, options)`.
320
-
321
- ```ts
322
- addPrismatic(name: string, parent: string, child: string, options?: JointOptions): Assembly
323
- ```
324
-
325
- #### `addFixed()` — Shorthand for `addJoint(name, 'fixed', parent, child, options)`.
326
-
327
- Fixed joints rigidly attach a child part to its parent at `frame` with no motion. Before calling `mergeInto()`, use `addFixed()` to collapse multiple root parts into a single root.
328
-
329
- ```ts
330
- addFixed(name: string, parent: string, child: string, options?: JointOptions): Assembly
331
- ```
332
-
333
- #### `addJointCoupling()` — Link a joint's value to a linear combination of other joint values.
334
-
335
- The driven joint's value is computed as:
336
-
337
- ```
338
- driven = offset + Σ(ratio_i × source_i)
339
- ```
340
-
341
- Coupled joints ignore any value passed in `solve(state)` — a warning is emitted if you try to override one. Coupling cycles are rejected. You cannot sweep a coupled joint directly; sweep one of its source joints instead.
342
-
343
- ```ts
344
- assembly
345
- .addRevolute("Steering", "Base", "Turret", { axis: [0, 0, 1] })
346
- .addRevolute("WheelDrive", "Turret", "Wheel", { axis: [1, 0, 0] })
347
- .addRevolute("TopGear", "Base", "TopInput", { axis: [0, 0, 1] })
348
- .addJointCoupling("TopGear", {
349
- terms: [
350
- { joint: "Steering", ratio: 1 },
351
- { joint: "WheelDrive", ratio: 20 / 14 },
352
- ],
353
- });
354
- ```
355
-
356
- ```ts
357
- addJointCoupling(jointName: string, options: JointCouplingOptions): Assembly
358
- ```
359
-
360
- #### `addGearCoupling()` — Link two revolute joints via a gear ratio.
361
-
362
- Choose exactly one ratio source:
363
-
364
- - `ratio` — explicit numeric ratio (driven/driver, negative for external mesh)
365
- - `pair` — a `GearRatioLike` from `lib.gearPair`, `lib.bevelGearPair`, etc. (uses `pair.jointRatio`)
366
- - `driverTeeth` + `drivenTeeth` — auto-computes ratio; use `mesh` to control sign (`'external'` = negative/opposite rotation, `'internal'` = positive, `'bevel'`/`'face'` = negative)
367
-
368
- When `pair` carries a `phaseDeg`, it is auto-applied as the coupling `offset` to align teeth correctly. Override with `offset: 0` if gear shapes already have the phase baked in.
369
-
370
- ```ts
371
- const pair = lib.gearPair({ pinion: { module: 1.25, teeth: 14 }, gear: { module: 1.25, teeth: 42 } });
372
- assembly
373
- .addRevolute("Pinion", "Base", "PinionPart", { axis: [0, 0, 1] })
374
- .addRevolute("Driven", "Base", "GearPart", { axis: [0, 0, 1] })
375
- .addGearCoupling("Driven", "Pinion", { pair });
376
- ```
377
-
378
- ```ts
379
- addGearCoupling(drivenJointName: string, driverJointName: string, options?: GearCouplingOptions): Assembly
380
- ```
381
-
382
- #### `sweepJoint()` — Sample a joint through its motion range, collecting collision data at each step.
383
-
384
- Divides `[from, to]` into `steps` intervals (producing `steps + 1` frames). At each sample, the assembly is solved with the sweeping joint at that value and `baseState` for all others. Returns one `JointSweepFrame` per sample with the joint value, collision findings, and any solve warnings.
385
-
386
- You cannot sweep a coupled joint — sweep one of its source joints instead.
387
-
388
- ```ts
389
- const sweep = mech.sweepJoint("elbow", -10, 135, 12, { shoulder: 35 });
390
- const hits = sweep.filter(frame => frame.collisions.length > 0);
391
- console.log(`Collisions at ${hits.length} of ${sweep.length} poses`);
392
- ```
393
-
394
- ```ts
395
- sweepJoint(jointName: string, from: number, to: number, steps: number, baseState?: JointState, collisionOptions?: CollisionOptions): JointSweepFrame[]
396
- ```
397
-
398
- #### `toJointsView()` — Derive viewport joint controls from the assembly graph and register them.
399
-
400
- Solves the assembly at rest (all joints = default), then converts each joint into a `JointViewInput` with world-space pivot and axis. Fixed joints become hidden zero-range revolute entries so attached parts follow their parent during animation. Joint couplings are forwarded to the viewport automatically.
401
-
402
- This method is optional. Call it only when you want viewport joint sliders, coupled controls, or playback animations. If you only want geometry, return the `Assembly` or `SolvedAssembly` directly and skip `toJointsView()`.
403
-
404
- **Critical pitfall:** Always call `toJointsView()` before solving for display. Then solve at the **rest pose** (no state overrides) and return that solved assembly result directly. Do not flatten it with `.toGroup()` if you want the viewport joint animation to keep working.
405
-
406
- Do not solve at a non-zero angle when using `toJointsView()` — the viewport will apply the same rotation again, double-rotating the part.
407
-
408
- ```ts
409
- mech.toJointsView({
410
- defaults: { J1: 30 },
411
- animations: [{
412
- name: "Swing", duration: 2, loop: true,
413
- keyframes: [{ values: { J1: -45 } }, { values: { J1: 45 } }, { values: { J1: -45 } }],
414
- }],
415
- });
416
-
417
- // Solve at REST — viewport handles posing
418
- return mech.solve();
419
- ```
420
-
421
- ```ts
422
- toJointsView(options?: ToJointsViewOptions): void
423
- ```
424
-
425
416
  #### `describe()` — Return the serializable assembly definition used by solve/inspect pipelines.
426
417
 
427
418
  ```ts
@@ -439,7 +430,7 @@ describe(): AssemblyDefinition
439
430
 
440
431
  A wrapper around an imported `Assembly` that provides kinematic access and convenient transform helpers.
441
432
 
442
- When a `.forge.js` file returns an unsolved `Assembly`, [`require()`](/docs/core#require) wraps it in an `ImportedAssembly`. This preserves the kinematic structure — you can call `solve()`, `sweepJoint()`, and `mergeInto()` — while also allowing convenience transforms that auto-solve at default values.
433
+ When a `.forge.js` file returns an unsolved `Assembly`, [`require()`](/docs/core#require) wraps it in an `ImportedAssembly`. This preserves the kinematic structure — you can call `solve()` and `mergeInto()` — while also allowing convenience transforms that auto-solve at default values.
443
434
 
444
435
  **Kinematic access**
445
436
 
@@ -468,7 +459,7 @@ require("./arm.forge.js").mergeInto(robot, {
468
459
  });
469
460
  ```
470
461
 
471
- #### `assembly()` — The underlying Assembly — use for sweepJoint, addPart into parent, etc.
462
+ #### `assembly()` — The underlying Assembly, for advanced composition and inspection.
472
463
 
473
464
  ```ts
474
465
  get assembly(): Assembly
@@ -486,6 +477,14 @@ solve(state?: JointState): SolvedAssembly
486
477
  part(name: string, state?: JointState): AssemblyPart
487
478
  ```
488
479
 
480
+ #### `getPart()` — Return a specific named part positioned at the default solved pose.
481
+
482
+ This mirrors `SolvedAssembly.getPart()` for imported assemblies. Use `solve(state).getPart(name)` when inspecting a non-default joint state.
483
+
484
+ ```ts
485
+ getPart(partName: string): AssemblyPart
486
+ ```
487
+
489
488
  #### `toGroup()` — Convert all assembly parts to a ShapeGroup with named children. Use this for composition, transforms, or child lookup — not as a required render step for assemblies. Child names match the part names used in the assembly. Any stored placement offset and placement references are forwarded to the group.
490
489
 
491
490
  ```ts
@@ -564,17 +563,35 @@ color(hex: string): ShapeGroup
564
563
  child(name: string): Shape | Sketch | ShapeGroup
565
564
  ```
566
565
 
567
- #### `mergeInto()` — Flatten this sub-assembly's parts and joints into `parent` and wire a mount joint.
566
+ #### `collisionReport()` — Detect overlapping part pairs at the default solved pose.
567
+
568
+ This mirrors `SolvedAssembly.collisionReport()` for imported assemblies. Use `solve(state).collisionReport(options)` when inspecting a non-default joint state.
569
+
570
+ ```ts
571
+ collisionReport(options?: CollisionOptions): CollisionFinding[]
572
+ ```
573
+
574
+ `CollisionOptions`: `{ parts?: string[], ignorePairs?: Array<[ string, string ]>, minOverlapVolume?: number }`
575
+
576
+ #### `minClearance()` — Compute the minimum gap between two parts at the default solved pose.
577
+
578
+ This mirrors `SolvedAssembly.minClearance()` for imported assemblies. Use `solve(state).minClearance(partA, partB, searchLength)` when inspecting a non-default joint state.
579
+
580
+ ```ts
581
+ minClearance(partA: string, partB: string, searchLength?: number): number
582
+ ```
583
+
584
+ #### `mergeInto()` — Flatten this sub-assembly's parts and relationships into `parent` and wire a mount relationship.
568
585
 
569
- All part and joint names from the sub-assembly are prefixed with `"${options.prefix}."` to avoid collisions. After the merge, sub-assembly joints are driven from the parent using the prefixed names:
586
+ All part, link, and legacy joint names from the sub-assembly are prefixed with `"${options.prefix}."` to avoid collisions. After the merge, controls are driven from the parent using the prefixed names:
570
587
 
571
588
  ```ts
572
- parent.solve({ "Left Arm.shoulder": 45, "Right Arm.shoulder": -20 })
589
+ parent.solve({ "Left Arm.theta": 45, "Right Arm.theta": -20 })
573
590
  ```
574
591
 
575
- Joint couplings inside the sub-assembly are preserved and rewritten with the prefix. Ports from sub-assembly parts are forwarded with the prefix.
592
+ Connectors from sub-assembly parts are forwarded with the prefix.
576
593
 
577
- The sub-assembly must have exactly one root part. If it has multiple roots, use `addFixed()` first to consolidate them before merging.
594
+ The sub-assembly must have exactly one root part before it can be merged.
578
595
 
579
596
  ```ts
580
597
  const robot = assembly("Robot").addPart("Chassis", chassis);
@@ -591,6 +608,25 @@ require("./arm.forge.js").mergeInto(robot, {
591
608
  mergeInto(parent: Assembly, options: MergeIntoOptions): Assembly
592
609
  ```
593
610
 
611
+ **`MergeIntoOptions`**
612
+
613
+ | Option | Type | Description |
614
+ |--------|------|-------------|
615
+ | `prefix?` | `string` | Prefix applied to every part name and joint name from the sub-assembly. E.g. prefix "Left Arm" turns part "Base" into "Left Arm.Base". Strongly recommended to avoid name collisions when merging multiple instances. |
616
+ | `mountParent` | `string` | Part name in the parent assembly to attach the sub-assembly root to. |
617
+ | `mountJoint` | `string` | Name for the new mount joint in the parent graph. |
618
+ | `mountType?` | `JointType` | Joint type for the mount connection (default: 'fixed'). |
619
+ | `mountOptions?` | `JointOptions` | Frame, axis, limits, and other options for the mount joint. |
620
+
621
+ **`JointOptions`**
622
+
623
+ | Option | Type | Description |
624
+ |--------|------|-------------|
625
+ | `connectorRefs?` | `JointConnectorRefs` | Connector refs that define this joint contract. Usually set by `connect()` / `match()`. |
626
+ | `frame?`, `origin?`, `axis?`, `min?`, `max?`, `default?`, `unit?`, `effort?`, `velocity?`, `damping?`, `friction?` | | — |
627
+
628
+ `JointConnectorRefs`: `{ parent: string, child: string, parentAlign?: PortAlign, childAlign?: PortAlign }`
629
+
594
630
  ### `SolvedAssembly`
595
631
 
596
632
  The result of solving an assembly at a specific joint state.
@@ -599,7 +635,7 @@ The result of solving an assembly at a specific joint state.
599
635
 
600
636
  **Validation**
601
637
 
602
- Call `collisionReport()` to detect overlapping parts, or `sweepJoint()` on the parent `Assembly` to check for interference across the joint's motion range.
638
+ Call `collisionReport()` to detect overlapping parts at this solved pose.
603
639
 
604
640
  ```ts
605
641
  const solved = mech.solve({ shoulder: 45, elbow: -20 });
@@ -645,6 +681,18 @@ get mateDof(): number | null
645
681
  get mateConverged(): boolean | null
646
682
  ```
647
683
 
684
+ #### `kinematics()` — Solved assembly-native kinematic graph, or null when no links were declared.
685
+
686
+ ```ts
687
+ get kinematics(): SolvedAssemblyKinematics | null
688
+ ```
689
+
690
+ #### `getLinkPosition()` — Return the solved world position of a kinematic link.
691
+
692
+ ```ts
693
+ getLinkPosition(linkName: string): Vec3
694
+ ```
695
+
648
696
  #### `getTransform()` — Return the world-space [`Transform`](/docs/core#transform) for the named part at the solved pose.
649
697
 
650
698
  ```ts