forgecad 0.9.16 → 0.10.1

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 (162) hide show
  1. package/dist/assets/{AdminPage-CXvls4-J.js → AdminPage-DcCnj0qo.js} +1 -1
  2. package/dist/assets/{BenchmarkPage-B27zk8xL.js → BenchmarkPage-BVEpJSVk.js} +1 -1
  3. package/dist/assets/{BlogPage-CMAVvgQL.js → BlogPage-DHaGP50_.js} +1 -1
  4. package/dist/assets/{DocsPage-knf4I4h7.js → DocsPage-CDoxHkz8.js} +40 -859
  5. package/dist/assets/EditorApp-BJ0Dloyh.js +16446 -0
  6. package/dist/assets/{EmbedViewer-D7ZGlFjx.js → EmbedViewer-CRKZbY0y.js} +2 -2
  7. package/dist/assets/{LandingPageProofDriven-CnevhTE8.js → LandingPageProofDriven-BxHkYRE7.js} +1 -1
  8. package/dist/assets/{LegalPage-BPTUmqeg.js → LegalPage-B-u6FrVv.js} +1 -1
  9. package/dist/assets/{PricingPage-B0D4goG_.js → PricingPage-CzpZ6-Ce.js} +1 -1
  10. package/dist/assets/{SettingsPage-CFF-UgjI.js → SettingsPage-CIZSSAd0.js} +1 -1
  11. package/dist/assets/{app-CE3sYcV7.css → app-CjsbDlb7.css} +143 -0
  12. package/dist/assets/{app-T0pDcSX4.js → app-DaTMg3nH.js} +1310 -290
  13. package/dist/assets/cli/{render-C5pcIISc.js → render-DPf4AYJK.js} +55 -60
  14. package/dist/assets/{constructionHistoryWorker-Ba2Hm58b.js → constructionHistoryWorker-AwMMWSxg.js} +1103 -349
  15. package/dist/assets/{evalWorker-vkx310U2.js → evalWorker-CjZZWRWW.js} +5209 -2643
  16. package/dist/assets/{inspectWorker-BuTJDVX6.js → inspectWorker-CZsCFtQT.js} +1163 -409
  17. package/dist/assets/{jointPose-B_Cgedn9.js → jointPose-DzQOViQH.js} +1 -1
  18. package/dist/assets/{manifold-BWgsjmAM.js → manifold-BYlzU521.js} +1 -1
  19. package/dist/assets/{manifold-D6IFSkhH.js → manifold-DgXo0T5P.js} +2 -2
  20. package/dist/assets/{manifold-rZexZI0G.js → manifold-K1SkarlQ.js} +1 -1
  21. package/dist/assets/{reportWorker-0AGij1Ru.js → reportWorker-B9nWwSrB.js} +8501 -3393
  22. package/dist/assets/{scalar-sampling-budget-J5cuzxT1.js → scalar-sampling-budget-prBw_s8t.js} +6067 -3479
  23. package/dist/assets/{scanProxyWorker-Vl4Wxa1y.js → scanProxyWorker-2GtDLk-R.js} +1 -1
  24. package/dist/assets/{javascript-1kQXfVaz.js → typescript-DBQ6RN5l.js} +874 -22
  25. package/dist/cli/render.html +1 -1
  26. package/dist/docs/index.html +3 -3
  27. package/dist/docs-raw/AI/usage.md +1 -1
  28. package/dist/docs-raw/CLI.md +77 -240
  29. package/dist/docs-raw/README.md +6 -0
  30. package/dist/docs-raw/component-model.md +17 -150
  31. package/dist/docs-raw/generated/assembly.md +188 -582
  32. package/dist/docs-raw/generated/concepts.md +259 -3501
  33. package/dist/docs-raw/generated/core.md +283 -1250
  34. package/dist/docs-raw/generated/curves.md +387 -1608
  35. package/dist/docs-raw/generated/legacy.md +162 -0
  36. package/dist/docs-raw/generated/lib.md +227 -85
  37. package/dist/docs-raw/generated/output.md +35 -99
  38. package/dist/docs-raw/generated/runtime-names.md +23 -23
  39. package/dist/docs-raw/generated/sdf.md +68 -284
  40. package/dist/docs-raw/generated/sheet-metal.md +68 -335
  41. package/dist/docs-raw/generated/sketch.md +240 -1161
  42. package/dist/docs-raw/generated/viewport.md +75 -316
  43. package/dist/docs-raw/generated/wood.md +21 -49
  44. package/dist/docs-raw/guides/coordinate-system.md +4 -42
  45. package/dist/docs-raw/guides/inspection-bundles.md +44 -442
  46. package/dist/docs-raw/guides/joint-design.md +18 -79
  47. package/dist/docs-raw/guides/positioning.md +21 -143
  48. package/dist/docs-raw/guides/scene-presentation.md +89 -0
  49. package/dist/docs-raw/guides/simready-quickstart.md +171 -0
  50. package/dist/docs-raw/simulation-workflow.md +273 -0
  51. package/dist/docs-raw/skills/forgecad-3d-reconstruction.md +25 -111
  52. package/dist/docs-raw/skills/forgecad-blockout-model.md +20 -117
  53. package/dist/docs-raw/skills/forgecad-component-model.md +23 -107
  54. package/dist/docs-raw/skills/forgecad-high-level-spec.md +47 -155
  55. package/dist/docs-raw/skills/forgecad-image-replicator.md +26 -143
  56. package/dist/docs-raw/skills/forgecad-lld.md +19 -113
  57. package/dist/docs-raw/skills/forgecad-make-a-model.md +112 -532
  58. package/dist/docs-raw/skills/forgecad-model-grader.md +38 -108
  59. package/dist/docs-raw/skills/forgecad-prepare-prompt.md +24 -211
  60. package/dist/docs-raw/skills/forgecad-project.md +13 -131
  61. package/dist/docs-raw/skills/forgecad-reconstruction-benchmark.md +42 -134
  62. package/dist/docs-raw/skills/forgecad-render-inspect.md +27 -174
  63. package/dist/docs-raw/skills/forgecad-visual-spec.md +32 -112
  64. package/dist/docs-raw/skills/forgecad.md +19 -18
  65. package/dist/docs-raw/skills/index.md +2 -0
  66. package/dist/docs-raw/welcome.md +2 -2
  67. package/dist/index.html +2 -2
  68. package/dist/llms.txt +1 -2
  69. package/dist/sitemap.xml +25 -13
  70. package/dist-cli/{check-compiler-SYQ2PWOB.js → check-compiler-II7NLPAB.js} +1 -1
  71. package/dist-cli/{check-query-propagation-HIAGV62W.js → check-query-propagation-7462TR3R.js} +1 -1
  72. package/dist-cli/{chunk-SPZE3DUY.js → chunk-UWTJCGXF.js} +5848 -2915
  73. package/dist-cli/forgecad.js +3496 -703
  74. package/dist-skill/CONTEXT.md +1797 -7963
  75. package/dist-skill/SKILL.md +15 -15
  76. package/dist-skill/docs/API/core/concepts.md +27 -157
  77. package/dist-skill/docs/CLI.md +77 -240
  78. package/dist-skill/docs/generated/assembly.md +182 -532
  79. package/dist-skill/docs/generated/core.md +283 -1250
  80. package/dist-skill/docs/generated/curves.md +387 -1609
  81. package/dist-skill/docs/generated/lib.md +227 -85
  82. package/dist-skill/docs/generated/output.md +35 -99
  83. package/dist-skill/docs/generated/runtime-names.md +16 -21
  84. package/dist-skill/docs/generated/sdf.md +68 -284
  85. package/dist-skill/docs/generated/sheet-metal.md +68 -335
  86. package/dist-skill/docs/generated/sketch.md +240 -1160
  87. package/dist-skill/docs/generated/viewport.md +75 -223
  88. package/dist-skill/docs/generated/wood.md +21 -49
  89. package/dist-skill/docs/guides/coordinate-system.md +4 -42
  90. package/dist-skill/docs/guides/inspection-bundles.md +44 -442
  91. package/dist-skill/docs/guides/joint-design.md +18 -79
  92. package/dist-skill/docs/guides/positioning.md +21 -143
  93. package/dist-skill/docs/guides/scene-presentation.md +89 -0
  94. package/dist-skill/docs/guides/surface-members.md +26 -0
  95. package/dist-skill/library/forgecad-3d-reconstruction/SKILL.md +23 -111
  96. package/dist-skill/library/forgecad-blockout-model/SKILL.md +18 -117
  97. package/dist-skill/library/forgecad-component-model/SKILL.md +21 -107
  98. package/dist-skill/library/forgecad-high-level-spec/SKILL.md +45 -155
  99. package/dist-skill/library/forgecad-image-replicator/SKILL.md +24 -143
  100. package/dist-skill/library/forgecad-lld/SKILL.md +17 -113
  101. package/dist-skill/library/forgecad-make-a-model/SKILL.md +110 -532
  102. package/dist-skill/library/forgecad-model-grader/SKILL.md +36 -108
  103. package/dist-skill/library/forgecad-prepare-prompt/SKILL.md +35 -224
  104. package/dist-skill/library/forgecad-prepare-prompt/references/default-profiles.md +43 -271
  105. package/dist-skill/library/forgecad-prepare-prompt/references/master-prompt.md +30 -99
  106. package/dist-skill/library/forgecad-project/SKILL.md +13 -133
  107. package/dist-skill/library/forgecad-reconstruction-benchmark/SKILL.md +29 -123
  108. package/dist-skill/library/forgecad-render-inspect/SKILL.md +25 -174
  109. package/dist-skill/library/forgecad-visual-spec/SKILL.md +30 -111
  110. package/dist-skill/website/skills/forgecad-3d-reconstruction.md +58 -0
  111. package/dist-skill/website/skills/forgecad-blockout-model.md +49 -0
  112. package/dist-skill/website/skills/forgecad-component-model.md +53 -0
  113. package/dist-skill/website/skills/forgecad-high-level-spec.md +101 -0
  114. package/dist-skill/website/skills/forgecad-image-replicator.md +63 -0
  115. package/dist-skill/website/skills/forgecad-lld.md +41 -0
  116. package/dist-skill/website/skills/forgecad-make-a-model.md +186 -0
  117. package/dist-skill/website/skills/forgecad-model-grader.md +82 -0
  118. package/dist-skill/website/skills/forgecad-prepare-prompt.md +63 -0
  119. package/dist-skill/website/skills/forgecad-project.md +26 -0
  120. package/dist-skill/website/skills/forgecad-reconstruction-benchmark.md +60 -0
  121. package/dist-skill/website/skills/forgecad-render-inspect.md +80 -0
  122. package/dist-skill/website/skills/forgecad-visual-spec.md +71 -0
  123. package/dist-skill/website/skills/forgecad.md +122 -0
  124. package/dist-skill/website/skills/index.md +26 -0
  125. package/examples/api/comparison-imported-sphere-candidate.forge.js +1 -1
  126. package/examples/api/conformal-product-ribbon.forge.js +1 -1
  127. package/examples/api/exact-sheet-shell-assembly.forge.js +1 -1
  128. package/examples/api/extrude-options.forge.js +4 -2
  129. package/examples/api/field-loft-drive-tip.forge.js +40 -0
  130. package/examples/api/guided-loft-olive-oil-bottle.forge.js +1 -1
  131. package/examples/api/highlight-debug.forge.js +10 -10
  132. package/examples/api/mesh-import-slats.forge.js +1 -1
  133. package/examples/api/real-product-curves.forge.js +1 -1
  134. package/examples/api/sculpt-box-circle-booleans.forge.js +1 -1
  135. package/examples/api/sdf-shapes.forge.js +2 -5
  136. package/examples/api/sketch-rounding-strategies.forge.js +6 -6
  137. package/examples/api/surface-member-bottle-cage.forge.js +3 -3
  138. package/examples/api/surface-member-conformal-product-ribbon.forge.js +3 -3
  139. package/examples/api/surface-member-razor-inlay.forge.js +1 -1
  140. package/examples/api/variable-sweep-test.forge.js +3 -3
  141. package/examples/mechanical/airplane-propeller.forge.js +74 -39
  142. package/examples/nurbs-surface.forge.js +1 -1
  143. package/examples/products/iphone.forge.js +1 -1
  144. package/examples/robotics/README.md +46 -0
  145. package/examples/robotics/scout-cam-rover-simready/README.md +119 -0
  146. package/examples/robotics/scout-cam-rover-simready/lib/dims.js +140 -0
  147. package/examples/robotics/scout-cam-rover-simready/main.forge.js +343 -0
  148. package/examples/robotics/scout-cam-rover-simready/parts/body.forge.js +304 -0
  149. package/examples/robotics/scout-cam-rover-simready/parts/chassis.forge.js +320 -0
  150. package/examples/robotics/scout-cam-rover-simready/parts/hardware.forge.js +21 -0
  151. package/examples/robotics/scout-cam-rover-simready/parts/turret.forge.js +70 -0
  152. package/examples/robotics/scout-cam-rover-simready/parts/wheel.forge.js +116 -0
  153. package/examples/robotics/simready-asset-crate.forge.js +79 -0
  154. package/examples/robotics/simready-diff-drive-rover.forge.js +141 -0
  155. package/examples/robotics/simready-parallel-gripper.forge.js +102 -0
  156. package/package.json +1 -1
  157. package/dist/assets/EditorApp-BHMQlJ-D.js +0 -14686
  158. package/dist/docs-raw/guides/geometry-conventions.md +0 -52
  159. package/dist/docs-raw/guides/modeling-recipes.md +0 -78
  160. package/dist-skill/docs/guides/geometry-conventions.md +0 -52
  161. package/dist-skill/docs/guides/modeling-recipes.md +0 -78
  162. package/dist-skill/library/forgecad-visual-spec/references/prompt-template.md +0 -79
@@ -0,0 +1,273 @@
1
+ # Simulation Workflow
2
+
3
+ ForgeCAD should make a robot or simulated asset runnable without making the CAD API own the control algorithm.
4
+
5
+ The source `.forge.js` model owns geometry, assembly structure, physical metadata, joints, drive intent, contact hints, and the neutral simulation contract. Exported packages then generate an editable simulator lab with all names and wiring connected. Rewards, policies, perturbation tests, curriculum, and RL libraries stay in simulator-side code.
6
+
7
+ ## Current Path: ForgeCAD To MuJoCo
8
+
9
+ 1. Source-author the model as an assembly with `withSimulation(...)`.
10
+ 2. Put physical metadata on every part with `Sim.body(...)`.
11
+ 3. Put motor intent on joints with `Sim.drive.velocity(...)` or passive dynamics with `Sim.drive.passive(...)`.
12
+ 4. Add high-level controller metadata such as `Sim.controller.diffDrive(...)` when the assembly has a standard command interface.
13
+ 5. Run the offline gate:
14
+
15
+ ```bash
16
+ node dist-cli/forgecad.js check simready examples/robotics/scout-cam-rover-simready/main.forge.js
17
+ ```
18
+
19
+ 6. Export the MuJoCo package:
20
+
21
+ ```bash
22
+ node dist-cli/forgecad.js export mjcf examples/robotics/scout-cam-rover-simready/main.forge.js --output /tmp/scout-cam-rover-mjcf
23
+ ```
24
+
25
+ The generated package contains:
26
+
27
+ - `scene.xml`: a runnable MuJoCo scene with floor, light, and render settings.
28
+ - `manifest.json`: ForgeCAD-to-MJCF names for links, joints, actuators, generated scripts, and suggested commands.
29
+ - `simready-manifest.json`: neutral simulation contract and validation results.
30
+ - `scripts/gym_env.py`: Gymnasium-compatible MuJoCo env helpers.
31
+ - `scripts/policy_runtime.py`: shared policy loader for ForgeCAD JSON and Stable-Baselines3 zip policies.
32
+ - `scripts/smoke_control.py`: basic actuator smoke test and GIF renderer.
33
+ - `scripts/train_balance.py`: small editable balance trainer.
34
+ - `scripts/play_balance.py`: policy playback with optional external force and torque pulses.
35
+ - `scripts/train_sb3.py`: Stable-Baselines3 PPO/SAC training starter.
36
+ - `scripts/live_policy_viewer.py`: live MuJoCo passive-viewer policy runner.
37
+
38
+ ## What The Generated Gym Env Does
39
+
40
+ `scripts/gym_env.py` is the bridge between the exported CAD package and control code.
41
+
42
+ It loads the package manifests, compiles `scene.xml`, discovers actuator IDs, identifies the simulation root body, and calibrates diff-drive signs from MuJoCo joint axes. This matters because mirrored wheel axes can make a naive same-sign left/right command spin or drift instead of moving forward.
43
+
44
+ The balance environment exposes a compact observation:
45
+
46
+ - tilt around the wheel axle
47
+ - side tilt
48
+ - angular velocity
49
+ - uprightness
50
+ - root height
51
+ - longitudinal velocity
52
+ - wheel velocities
53
+ - previous forward command
54
+
55
+ The semantic action is:
56
+
57
+ - `semanticForward`
58
+ - `semanticTurn`
59
+
60
+ The env converts those semantic actions into calibrated actuator commands.
61
+
62
+ ## Training The Starter Balance Policy
63
+
64
+ The generated trainer intentionally avoids heavy RL machinery.
65
+
66
+ ```bash
67
+ cd /tmp/scout-cam-rover-mjcf
68
+ uv run --python 3.11 --with mujoco --with numpy --with gymnasium --with pillow python scripts/train_balance.py --render-gif balance.gif --fps 10
69
+ ```
70
+
71
+ It trains a linear policy:
72
+
73
+ ```text
74
+ observation -> weighted sum -> tanh -> motor command
75
+ ```
76
+
77
+ The optimizer is cross-entropy method:
78
+
79
+ 1. Try many random weight sets.
80
+ 2. Simulate each candidate.
81
+ 3. Score survival, uprightness, angular rate, and command cost.
82
+ 4. Keep the best candidates.
83
+ 5. Sample the next generation around those.
84
+
85
+ This is not deep RL. It is a fast, inspectable starter controller. The right next steps for serious RL are PPO/SAC/PufferLib/MJX/Isaac Lab integrations that reuse the generated env or manifests.
86
+
87
+ ## Serious RL Workflow
88
+
89
+ For a real reinforcement-learning run, treat the generated MJCF package as the simulator adapter and replace `train_balance.py` with the training stack you actually want. ForgeCAD's job is to produce a valid robot model, named actuators, controller metadata, and a Gymnasium-style environment scaffold; the RL project owns the policy class, reward, curriculum, vectorization, checkpointing, and evaluation harness.
90
+
91
+ The usual loop is:
92
+
93
+ 1. Load `scene.xml` with MuJoCo.
94
+ 2. Load `manifest.json` and `simready-manifest.json` to map ForgeCAD names to MuJoCo bodies, joints, and actuators.
95
+ 3. Build observations from `mjData`, such as pose, tilt, angular velocity, wheel velocity, sensors, previous command, and task-specific state.
96
+ 4. Let the policy choose an action.
97
+ 5. Convert semantic actions, such as `[forward, turn]`, into actuator controls.
98
+ 6. Write controls into `mjData.ctrl`, then call `mj_step`.
99
+ 7. Compute reward, termination, truncation, and diagnostics.
100
+ 8. Let PPO, SAC, PufferLib, MJX, Isaac Lab, or another trainer update the policy.
101
+ 9. Save checkpoints and evaluate them with deterministic playback, randomized starts, friction/mass perturbations, and force-push tests.
102
+
103
+ For the Scout Cam Rover balance example, the first serious action space should usually stay semantic:
104
+
105
+ ```text
106
+ action = [semanticForward, semanticTurn]
107
+ ```
108
+
109
+ That keeps the RL task independent from left/right motor sign conventions. The generated environment already calibrates mirrored wheel axes and maps semantic commands to actuator controls. If a later task needs raw motor commands, add that deliberately after the semantic baseline works.
110
+
111
+ The reward should encode the actual job, not just survival. For a self-balancing rover, a practical first reward includes uprightness, low tilt rate, target velocity or position tracking, bounded control effort, and clear fall termination. Randomize initial tilt, mass, friction, and push disturbances once the baseline can solve the nominal case.
112
+
113
+ ## Training A Stable-Baselines3 Policy
114
+
115
+ The MJCF package includes an editable SB3 starter that reuses `BalanceEnv` and the generated semantic diff-drive action mapping:
116
+
117
+ ```bash
118
+ cd /tmp/scout-cam-rover-mjcf
119
+ uv run --python 3.11 --with mujoco --with numpy --with gymnasium --with stable-baselines3 --with pillow python scripts/train_sb3.py \
120
+ --timesteps 50000 \
121
+ --output policies/sb3_balance_ppo.zip \
122
+ --render-gif sb3_balance.gif \
123
+ --fps 10
124
+ ```
125
+
126
+ That command writes `policies/sb3_balance_ppo.zip` plus `policies/sb3_balance_ppo.json`. The JSON sidecar records the algorithm, observation/action shape, drive calibration, and short deterministic evaluation summary. Use `--algo sac` when you want the SAC template instead of PPO.
127
+
128
+ ## Pushing The Trained Policy
129
+
130
+ After training, run the policy with a force pulse:
131
+
132
+ ```bash
133
+ cd /tmp/scout-cam-rover-mjcf
134
+ uv run --python 3.11 --with mujoco --with numpy --with gymnasium --with pillow python scripts/play_balance.py \
135
+ --policy policies/balance_linear.json \
136
+ --push-y 1 \
137
+ --push-at 2 \
138
+ --push-duration 0.15 \
139
+ --render-gif balance_push.gif \
140
+ --fps 10
141
+ ```
142
+
143
+ `play_balance.py` applies force or torque through MuJoCo's `xfrc_applied` array on the root body. It reports the frame count, approximate GIF duration, push vector, final tilt, and survival time.
144
+
145
+ Use these options to push from other directions:
146
+
147
+ ```bash
148
+ --push-x 2
149
+ --push-y -4
150
+ --push-z 1
151
+ --torque-x 0.1
152
+ --torque-y -0.1
153
+ --torque-z 0.1
154
+ ```
155
+
156
+ Increase `--push-y` or `--push-x` when you want a failure/stress test instead of a recovery demo.
157
+
158
+ Stable-Baselines3 zip policies use the same playback path:
159
+
160
+ ```bash
161
+ cd /tmp/scout-cam-rover-mjcf
162
+ uv run --python 3.11 --with mujoco --with numpy --with gymnasium --with stable-baselines3 --with pillow python scripts/play_balance.py \
163
+ --policy policies/sb3_balance_ppo.zip \
164
+ --push-y 1 \
165
+ --push-at 2 \
166
+ --push-duration 0.15 \
167
+ --render-gif sb3_balance_push.gif \
168
+ --fps 10
169
+ ```
170
+
171
+ ## MuJoCo App Vs Policy Control
172
+
173
+ MuJoCo's standalone viewer and MuJoCo.app load models, not trained policies. Open `scene.xml` when you want to inspect the exported robot, geometry, joints, contacts, actuators, and passive dynamics:
174
+
175
+ ```bash
176
+ uv run --python 3.11 --with mujoco python -m mujoco.viewer --mjcf=scene.xml
177
+ ```
178
+
179
+ A trained policy is control code. The official MuJoCo control path is to set controls before stepping the simulator, or to install a control callback. In Python, the common interactive pattern is the passive viewer: the user script owns the loop, computes policy actions, writes `mjData.ctrl`, calls `mj_step`, and then calls `viewer.sync()`. On macOS, passive-viewer scripts should run with `mjpython`, which is installed with the `mujoco` Python package.
180
+
181
+ Conceptually:
182
+
183
+ ```python
184
+ model = mujoco.MjModel.from_xml_path("scene.xml")
185
+ data = mujoco.MjData(model)
186
+
187
+ with mujoco.viewer.launch_passive(model, data) as viewer:
188
+ while viewer.is_running():
189
+ action = policy(observation_from(data))
190
+ data.ctrl[:] = action_to_actuator_controls(action)
191
+ mujoco.mj_step(model, data)
192
+ viewer.sync()
193
+ ```
194
+
195
+ `scripts/play_balance.py` is the generated scripted playback path. It loads the policy JSON, applies calibrated actuator commands, optionally applies force or torque pulses through `xfrc_applied`, and can render a diagnostic GIF. It is not the same thing as loading the policy into MuJoCo.app.
196
+
197
+ To run a policy in an interactive window, use the generated passive-viewer script. On macOS, run it through `mjpython`:
198
+
199
+ ```bash
200
+ cd /tmp/scout-cam-rover-mjcf
201
+ uv run --python 3.11 --with mujoco --with numpy --with gymnasium --with stable-baselines3 mjpython scripts/live_policy_viewer.py \
202
+ --policy policies/sb3_balance_ppo.zip
203
+ ```
204
+
205
+ ## GIF Timing
206
+
207
+ The generated scripts treat GIF duration as:
208
+
209
+ ```text
210
+ duration ~= frame_count / fps
211
+ ```
212
+
213
+ For a 6-second run at 10 FPS, expect about 60 frames. If the GIF is much shorter, the renderer is undersampling frames or the policy terminated early. The summary JSON prints both `frames` and `gifDurationSecondsApprox` for playback scripts.
214
+
215
+ Keep FPS modest. A 10 FPS diagnostic GIF is usually easier to review, smaller than a 30 FPS one, and maps to a clean 100 ms GIF frame delay in common viewers.
216
+
217
+ ## What Belongs In ForgeCAD
218
+
219
+ ForgeCAD should own:
220
+
221
+ - physical metadata on parts
222
+ - colliders and contact intent
223
+ - joints and drive limits
224
+ - named controller metadata
225
+ - simulator package manifests
226
+ - export to URDF, SDF, and MJCF; native USD/USDZ export is future work
227
+ - generated starter envs, smoke tests, trainers, playback, and perturbation scripts
228
+ - offline source-level readiness checks
229
+
230
+ ForgeCAD should not own:
231
+
232
+ - a `selfBalancingDiffDrive(...)` API
233
+ - a single blessed RL algorithm
234
+ - task-specific rewards
235
+ - PufferLib-specific or IsaacLab-specific core CAD primitives
236
+ - deployment-specific training infrastructure
237
+
238
+ The durable product promise is: model once, export a working simulation lab, then swap the control stack freely.
239
+
240
+ ## Isaac Lab Fit
241
+
242
+ Isaac Lab integration is plausible, but not turnkey in this slice.
243
+
244
+ The current NVIDIA Isaac Lab docs describe custom robot training as a multi-step flow: import and tune the robot in Isaac Sim, then define the Isaac Lab interface needed to clone the robot, drive joints, and reset state. Their "Adding a New Robot" tutorial names `AssetBaseCfg` as the interface between the USD articulation and learning algorithms. Their asset configuration guide shows `ArticulationCfg` with `UsdFileCfg`, and notes that `UrdfFileCfg` can replace `UsdFileCfg` for URDF-backed articulations.
245
+
246
+ Relevant docs:
247
+
248
+ - https://isaac-sim.github.io/IsaacLab/main/source/tutorials/01_assets/add_new_robot.html
249
+ - https://isaac-sim.github.io/IsaacLab/main/source/how-to/write_articulation_cfg.html
250
+
251
+ ForgeCAD has the information Isaac Lab needs in pieces:
252
+
253
+ - URDF export for an articulation import path
254
+ - SimReady manifest with root part, joints, drives, materials, contacts, and controller metadata
255
+ - SDF/MJCF packages for fast local physics iteration
256
+
257
+ ForgeCAD does not currently have a native USD/USDZ export command. For Isaac workflows today, use URDF as the import artifact and carry the richer ForgeCAD simulation intent through `simready-manifest.json`.
258
+
259
+ The missing ForgeCAD work for a clean Isaac Lab path is:
260
+
261
+ - direct USD authoring or a generated Isaac Sim URDF import/conversion script
262
+ - generated `ArticulationCfg` scaffold from `simready-manifest.json`
263
+ - actuator config generation from `Sim.drive.*(...)`
264
+ - reset/observation/action scaffolds equivalent to the MuJoCo Gym env
265
+ - coordinate/frame audit for Isaac's stage conventions and imported URDF axes
266
+ - Isaac Sim/Isaac Lab validation on a machine with those tools installed
267
+
268
+ Until that exists, the recommended path is:
269
+
270
+ 1. Use MuJoCo export for fast local control-loop iteration.
271
+ 2. Export URDF for Isaac Sim and keep `simready-manifest.json` beside it.
272
+ 3. Generate or hand-write Isaac Lab `ArticulationCfg` and task code from the ForgeCAD manifests.
273
+ 4. Validate imported articulation axes, actuators, masses, colliders, and reset behavior in Isaac Lab.
@@ -1,3 +1,5 @@
1
+ <!-- Generated by scripts/build-forgecad-skill.mjs — do not edit. Edit agent-skill-library/forgecad-3d-reconstruction/SKILL.md instead. -->
2
+
1
3
  # forgecad-3d-reconstruction
2
4
 
3
5
  Reconstruct a parametric ForgeCAD model from an existing 3D CAD or mesh file such as STL, OBJ, 3MF, STEP, or STP; inspect the source asset directly, author real ForgeCAD geometry, and iteratively compare the candidate with `forgecad compare 3d`.
@@ -11,132 +13,44 @@ Reconstruct a parametric ForgeCAD model from an existing 3D CAD or mesh file suc
11
13
 
12
14
  ## ForgeCAD 3D Reconstruction
13
15
 
14
- Use this skill when the user provides an existing 3D file and wants a ForgeCAD model that recreates it as parametric CAD.
15
-
16
- The reference asset is evidence, not the deliverable. The deliverable is a readable `.forge.js` model that runs, renders, inspects, and scores well against the source geometry.
17
-
18
- Do not solve reconstruction by returning `importMesh("reference.stl")` or `importStep("reference.step")` as the final model unless the user explicitly asks for an import wrapper. Imported source assets are for measurement, rendering, inspection, and scoring.
16
+ The reference asset is evidence, not the deliverable. The deliverable is a readable, parametric `.forge.js` model that runs, renders, and scores well against the source. Never return `Import.mesh()`/`Import.step()` of the source as the final model unless the user explicitly asks for an import wrapper — imports are for measurement, rendering, and scoring only.
19
17
 
20
- ### Companion Skills
18
+ Routing: user wants to KEEP the file as a live component and design around it (bracket, enclosure, mating assembly) → `forgecad-make-a-model` (Imported Parts section), not this skill; benchmark/RL episodes → `forgecad-reconstruction-benchmark`; inspection-bundle interpretation → `forgecad-render-inspect`; independent grading after reconstruction → `forgecad-model-grader`; API and command reference → `forgecad` skill + CLI.md.
21
19
 
22
- - Use `forgecad` for API syntax, direct CAD CLI behavior, and validation commands.
23
- - Use `forgecad-reconstruction-benchmark` instead when the task is a benchmark
24
- or RL episode with a fixed `submission/main.forge.js` output path.
25
- - Use `forgecad-make-a-model` when creating a normal user-facing `.forge.js`
26
- project structure outside the benchmark harness.
27
- - Use `forgecad-render-inspect` when inspection bundles need interpretation.
28
- - Use `forgecad-model-grader` only after reconstruction, when the user asks for an independent grade.
20
+ ### Workflow
29
21
 
30
- ### Required Workflow
31
-
32
- 1. Stage the reference.
33
- Put the source 3D file in a scratch folder such as `/tmp/<slug>-reconstruct/ref/` or keep the user's original path if it is already stable. Preserve the original file.
34
-
35
- 2. Inspect the source directly.
36
- No wrapper script is needed. Use the local checkout CLI:
22
+ 1. **Inspect the source directly** — the CLI reads CAD/mesh files as inputs, no wrapper script. Gather four evidence types: `ls --long` stats, an iso render, per-object views, sampled sections (invocations in CLI.md; when sharing a renderer server via `--port`, run renders sequentially).
23
+ 2. **3MF**: enumerate every build item before scoring — hidden multi-part structure is a common miss. Item ref syntax: `Import.mesh` docs.
24
+ 3. **Reconstruction Brief** before modeling: what must be exact vs. approximate vs. parametric; symmetry, origin, key reference planes; likely manufacturing process; scoring tolerance and alignment policy.
25
+ 4. **Blockout first.** Match bbox and main masses, then add features. Model real geometry with blueprint-first APIs never vertex-chase a faceted copy.
26
+ 5. **Compare numerically** — the core loop:
37
27
 
38
28
  ```bash
39
- node dist-cli/forgecad.js ls path/to/source.stl --quality live --long
40
- node dist-cli/forgecad.js render 3d path/to/source.stl /tmp/<slug>-source.png --camera iso --edges thin --size 900
41
- node dist-cli/forgecad.js inspect visual objects path/to/source.stl /tmp/<slug>-source-objects --camera iso --size 700 --force
42
- node dist-cli/forgecad.js inspect sections sample path/to/source.stl /tmp/<slug>-source-sections --count 5 --size 700 --force
43
- ```
44
-
45
- For 3MF sources, `forgecad run` prints the source archive's build
46
- items/resource objects with stable refs such as
47
- `3mf:build:001:object:2`, automatic names, per-item bounding boxes, and
48
- triangle counts. Use that item table to avoid missing hidden multi-part
49
- structure before scoring the whole shape.
50
-
51
- For STEP/STP files, the CLI auto-selects OCCT unless `--backend` is passed.
52
- Run render commands sequentially; starting multiple browser renders at once can make the shared Vite renderer race and time out.
53
-
54
- 3. Write a Reconstruction Brief.
55
- Before modeling, record:
56
- - source path and file type
57
- - bounding box, volume, triangle count, and apparent units
58
- - object identity and likely manufacturing process
59
- - major primitive families: boxes, cylinders, plates, revolutions, lofts, sweeps, holes, fillets, ribs, threads, text, freeform surfaces
60
- - symmetry, coordinate origin, and key reference planes
61
- - what must be exact, what may be approximate, and what should remain parametric
62
- - scoring tolerance and alignment policy
63
-
64
- 4. Build the ForgeCAD candidate.
65
- Model the real geometry, not a faceted copy. Start with a blockout that matches bbox and main masses, then add holes, cutouts, transitions, and details. Prefer high-level ForgeCAD APIs and blueprint-first intent over vertex chasing.
66
- 5. Compare the candidate numerically.
67
- Use the raw geometry comparison command:
68
-
69
- ```bash
70
- node dist-cli/forgecad.js compare 3d path/to/source.stl path/to/candidate.forge.js \
29
+ forgecad compare 3d path/to/source.stl path/to/candidate.forge.js \
71
30
  --samples 3000 --json --output /tmp/<slug>-score.json
72
31
  ```
73
32
 
74
- Start with `--align none`. Use `--align center` only when the source and candidate clearly use different origins but the same scale and orientation. Use `--align center-scale` only for exploratory diagnosis because it can hide dimensional errors.
75
-
76
- 6. Iterate from coarse to fine.
77
- Improve in this order:
78
- - bbox size and coordinate placement
79
- - main volumes and silhouette
80
- - major holes, bosses, ribs, shells, and cutouts
81
- - edge treatments and transitions
82
- - small details, labels, textures, and decorative features
83
-
84
- Use score metrics as evidence:
85
- - low coverage means missing or extra surface area
86
- - high RMS means broad proportional mismatch
87
- - high p95 or max means localized protrusions, holes, or outliers
88
- - bounds delta means size, origin, or scale mismatch
89
- - volume delta means mass, shell, cutout, or scale mismatch
90
-
91
- 7. Validate the final model.
92
- Minimum final checks:
93
-
94
- ```bash
95
- node dist-cli/forgecad.js run path/to/candidate.forge.js
96
- node dist-cli/forgecad.js render 3d path/to/candidate.forge.js /tmp/<slug>-candidate.png --camera iso --edges thin --size 900
97
- node dist-cli/forgecad.js compare 3d path/to/source.stl path/to/candidate.forge.js --samples 5000 --json --output /tmp/<slug>-final-score.json
98
- node dist-cli/forgecad.js inspect compare overlay path/to/candidate.forge.js /tmp/<slug>-compare --compare-samples 5000 --force --size 700
99
- ```
100
-
101
- Add targeted evidence commands such as `inspect fit interference`, `inspect manufacture thickness`, `inspect physical components`, `inspect physical floating`, or `inspect surface zebra` when the object is multi-part, hollow, mechanical, thin-walled, or surface-sensitive.
102
-
103
- ### Scoring Guidance
104
-
105
- `forgecad compare 3d` returns an overall 0-100 raw geometry score plus distance, feature, bounds, and volume metrics. Treat the score as a guide, not a license to make unmaintainable code.
106
-
107
- Suggested targets:
108
-
109
- - `95+`: excellent reconstruction for simple prismatic or revolved parts
110
- - `90+`: good target for ordinary mechanical parts with fillets and cutouts
111
- - `80+`: acceptable rough reconstruction when the source is organic, faceted, or underdetermined
112
-
113
- Always report the raw `rms`, `p95`, `max`, coverage, bounds delta, and volume delta. A high score with a large `max` distance can still hide a missing local feature.
114
-
115
- For faceted source meshes, decide whether tessellation itself is evidence. If the source is an exported primitive or low-poly mesh, exact triangle/segment matching can raise the numeric score but may reduce parametric clarity. Prefer analytic intent when the user wants a clean CAD reconstruction; match tessellation only when the faceting is part of the artifact or required by the acceptance criteria.
33
+ 6. **Iterate coarse to fine**: bbox/placement main volumes/silhouette holes/bosses/ribs/shells edge treatments small details.
116
34
 
117
- ### Subagent Validation
35
+ ### Reading the Score
118
36
 
119
- When validating this skill with a subagent, give the subagent only:
37
+ Alignment: start `--align none`. Use `--align center` only when origins clearly differ but scale and orientation match. Use `--align center-scale` only for exploratory diagnosis — it hides dimensional errors.
120
38
 
121
- - the reference file path
122
- - the desired output folder
123
- - this skill name
124
- - the command to use the local CLI: `node dist-cli/forgecad.js`
39
+ | Signal | Diagnosis |
40
+ |---|---|
41
+ | Low coverage | Missing or extra surface |
42
+ | High RMS | Broad proportional mismatch |
43
+ | High p95/max | Localized outlier feature (protrusion, hole) |
44
+ | Bounds delta | Size, origin, or scale mismatch |
45
+ | Volume delta | Mass, shell, cutout, or scale mismatch |
125
46
 
126
- Do not provide your intended modeling strategy, hidden measurements, or expected score. The point is to test whether the skill guides a fresh agent through evidence, modeling, scoring, and iteration.
47
+ Calibration: 95+ simple prismatic/revolved parts, 90+ ordinary mechanical parts with fillets/cutouts, 80+ acceptable for organic, faceted, or underdetermined sources. Always report raw rms, p95, max, coverage, bounds delta, and volume delta — a high overall score with a large max can hide a missing local feature.
127
48
 
128
- ### Output Contract
49
+ Faceted sources: decide whether tessellation itself is evidence. Matching low-poly faceting raises the score but reduces parametric clarity — prefer analytic intent unless faceting is part of the artifact or required by the acceptance criteria.
129
50
 
130
- When finished, report:
51
+ ### Done Criteria
131
52
 
132
- - source file path
133
- - candidate `.forge.js` path
134
- - Reconstruction Brief summary
135
- - source inspection bundle and renders
136
- - candidate renders and inspection bundle, if used
137
- - final `forgecad compare 3d` command and score JSON path
138
- - final score, RMS, p95, max distance, coverage, bounds delta, and volume delta
139
- - known mismatches and whether they are intentional simplifications or remaining work
53
+ The final model must run, render, re-compare at `--samples 5000`, and pass an `inspect compare overlay`. Add targeted inspects (`forgecad-render-inspect`) when the object is multi-part, hollow, thin-walled, or surface-sensitive. Report: source and candidate paths, score JSON path, final metrics, and every known mismatch classified as intentional simplification or remaining work.
140
54
 
141
55
 
142
56
  ## Bundled Files
@@ -1,3 +1,5 @@
1
+ <!-- Generated by scripts/build-forgecad-skill.mjs — do not edit. Edit agent-skill-library/forgecad-blockout-model/SKILL.md instead. -->
2
+
1
3
  # forgecad-blockout-model
2
4
 
3
5
  Create rough high-level ForgeCAD concept models from simple primitives to explore layout, proportions, motion, and part relationships without production detail. Use when asked for a quick model sketch, blockout, spatial mockup, or intuitive low-detail 3D concept.
@@ -11,25 +13,7 @@ Create rough high-level ForgeCAD concept models from simple primitives to explor
11
13
 
12
14
  ## Block Out a Model
13
15
 
14
- Create lightweight ForgeCAD concept models. These are spatial planning artifacts: fast, legible, and intentionally approximate, but still grounded in the physical object rather than an annotated lesson diagram.
15
-
16
- ### Trigger Boundary
17
-
18
- Use this skill when the user wants to answer questions like:
19
-
20
- - Roughly where do the parts go?
21
- - Does this mechanism idea make intuitive spatial sense?
22
- - What is the silhouette, footprint, or motion envelope?
23
- - Can we show the concept before spending time on detail?
24
-
25
- Do **not** use this skill for:
26
-
27
- - print-ready or fabrication-ready geometry
28
- - exact fit, tight tolerances, or detailed dimensioning
29
- - dense parametric modeling
30
- - hardware details, fillets, chamfers, or finish work unless they are essential to the concept
31
-
32
- Routing:
16
+ A blockout is a spatial planning artifact: 3-7 simple masses that answer where parts go, whether a mechanism makes spatial sense, and what the silhouette, footprint, or motion envelope looks like. Not for print-ready geometry, exact fit, tolerances, or detail work.
33
17
 
34
18
  | Need | Skill |
35
19
  |------|-------|
@@ -37,110 +21,29 @@ Routing:
37
21
  | Written concept or architecture before CAD | `forgecad-high-level-spec` |
38
22
  | Accurate, detailed, parametric ForgeCAD model | `forgecad-make-a-model` |
39
23
 
40
- ### File Placement
41
-
42
- All new `.forge.js` files go under the date-based directory structure:
43
-
44
- ```text
45
- YYYY/MM/DD/file.forge.js - single-file blockout
46
- YYYY/MM/DD/folder/file.forge.js - multi-file concept project
47
- ```
48
-
49
- Use today's date for the directory. Use the user's current ForgeCAD project when one is available; otherwise use a clearly named local model folder.
50
-
51
- #### Naming
52
-
53
- - Use kebab-case
54
- - Prefer names like `desk-lamp-blockout.forge.js` or `hinged-display-concept.forge.js`
55
- - Add `-blockout` or `-concept` unless the user already supplied a clearer name
56
-
57
- ### Workflow
58
-
59
- 1. **Load the `forgecad` skill first** and read the Core API and CLI docs. Only load more documentation if the concept truly needs it.
60
- 2. **Translate the idea into 3-7 conceptual parts** before writing geometry. Think in terms of masses and zones: base, arm, payload, sweep volume, keep-out space, hand access, wheel envelope.
61
- 3. **Choose approximate dimensions** using round numbers and obvious proportions. Favor "believably shaped" over "numerically correct".
62
- 4. **Write the simplest geometry that communicates the idea**. Default to `box()`, `cylinder()`, `sphere()`, and very simple extrusions.
63
- 5. **Place parts with readable transforms**. Keep coordinates easy to inspect and edit. Prefer centered primitives when that reduces mental load.
64
- 6. **Color by meaning** so a viewer can decode the concept immediately.
65
- 7. **Render and inspect** from a few angles. If the idea is still unclear, simplify or reposition; do not add detail as a substitute for clarity.
66
- 8. **Stop early** once the mechanism, layout, or concept is understandable.
24
+ ### Method
67
25
 
68
- ### Modeling Rules
26
+ - Load the `forgecad` skill first; read its Core API and CLI docs. Load nothing else unless the concept demands it.
27
+ - Translate the idea into 3-7 conceptual parts BEFORE writing geometry: masses and zones (base, arm, payload, sweep volume, keep-out, hand access).
28
+ - One primitive stands in for many eventual details. A bounding box beats a fake detailed part. Never add detail as a substitute for clarity — simplify or reposition instead.
29
+ - Use round-number dimensions; "believably shaped" beats numerically correct. Name uncertainty honestly: `armLengthGuess`, `baseWidthApprox`, `clearanceEnvelope`.
30
+ - At most a handful of `param()` values, for comparing proportions. Do not parameterize every dimension.
31
+ - Color by meaning; keep each conceptual part visually distinct via color or opacity. Return named shape objects so the viewer can inspect the concept part-by-part.
32
+ - Ghost geometry: transparent volumes only for REAL physical envelopes — sweep arcs, keep-out volumes, approximate payloads, reach/access zones. Never decorative teaching overlays. Exaggerate tiny clearances when needed for readability.
33
+ - Even a blockout represents the object in its normal assembled state: no labels, legends, cutaways, or permanently exploded layouts (full rule in the `forgecad` skill).
34
+ - Leave out: fasteners and screw holes, wall thicknesses, fillets and blend radii, polished materials, hidden internal structure that does not affect the concept.
69
35
 
70
- - Use one primitive to stand in for many eventual details whenever possible.
71
- - A bounding box is usually better than a fake detailed part.
72
- - Use at most a handful of top-level `param()` values when comparing rough proportions. Do not parameterize every dimension.
73
- - Name uncertainty honestly: `armLengthGuess`, `baseWidthApprox`, `screenVolume`, `clearanceEnvelope`.
74
- - Do not add text labels, callout arrows, legends, coordinate labels, or explanatory plaques to the model. Use named return objects and a short written note outside the geometry.
75
- - Do not cut away a shell, remove covers, or permanently explode parts just to show hidden intent. Even a blockout should represent the object in its normal assembled state unless the user explicitly asks for a presentation view.
76
- - Use transparent ghost geometry for:
77
- - sweep arcs
78
- - keep-out volumes
79
- - approximate payloads
80
- - user reach or access space
81
- - Ghost geometry must represent a real physical envelope, clearance, motion path, or human-access zone, not decorative teaching overlays.
82
- - Exaggerate tiny clearances if needed to keep the concept readable.
83
- - Keep each conceptual part visually distinct through color or opacity.
84
- - Prefer arrays of named shapes in the return value so the viewer can inspect the concept part-by-part.
36
+ ### Verify
85
37
 
86
- ### What to Leave Out
87
-
88
- Do not spend time on:
89
-
90
- - screw holes
91
- - exact wall thicknesses
92
- - blend radii
93
- - polished materials
94
- - hidden internal structure that does not affect the concept
95
- - mathematical precision that the concept does not justify
96
-
97
- If you notice yourself reaching for detailed constraints, pause and ask whether the blockout should instead hand off to `forgecad-make-a-model`.
98
-
99
- ### Render-Verify Loop
100
-
101
- Even rough models must be rendered. The whole point is spatial intuition.
102
-
103
- #### Minimum check
104
-
105
- ```bash
106
- forgecad run model.forge.js
107
- node dist-cli/forgecad.js render model.forge.js /tmp/blockout.png --camera 45:25 --camera 0:0 --camera 90:0 --size 600
108
- ```
109
-
110
- Inspect the render and ask:
38
+ Rendering is mandatory even for rough models. Run the script, then render from 2-3 angles with the installed `forgecad` CLI (syntax: the `forgecad` skill's CLI docs). Judge by the reader test:
111
39
 
112
40
  - Can someone unfamiliar with the idea tell what each mass represents?
113
- - Are the overall proportions believable enough to discuss?
41
+ - Are proportions believable enough to discuss?
114
42
  - Is motion or interference visible where it matters?
115
- - Are unknowns shown honestly, rather than hidden behind fake detail?
116
-
117
- If the answer is no, simplify the model or add clearer ghost volumes.
118
-
119
- ### Useful Pattern
120
-
121
- ```js
122
- // Concept only:
123
- // - dimensions are approximate
124
- // - red transparent geometry shows motion / keep-out
125
-
126
- const base = box(160, 90, 30).placeReference('center', [0, 0, 0]).color('#4c6ef5');
127
- const arm = box(22, 22, 180).placeReference('center', [0, 0, 105]).color('#f08c00');
128
- const payload = box(120, 18, 70).placeReference('center', [0, 0, 210]).color('#2b8a3e');
129
-
130
- const sweep = cylinder(12, 110, 110, 48).placeReference('center', [0, 0, 0])
131
- .rotateY(90)
132
- .translate(0, 0, 120)
133
- .color('#e03131')
134
- .material({ opacity: 0.18 });
43
+ - Are unknowns shown honestly, not hidden behind fake detail?
135
44
 
136
- return [
137
- { name: 'Base', shape: base },
138
- { name: 'Arm', shape: arm },
139
- { name: 'Payload Volume', shape: payload },
140
- { name: 'Sweep Envelope', shape: sweep },
141
- ];
142
- ```
45
+ If any answer is no, simplify or add clearer ghost volumes.
143
46
 
144
- ### Handoff Rule
47
+ ### Handoff
145
48
 
146
- When the blockout has answered the high-level questions, stop. If the next question is about real fit, tunable dimensions, part details, or manufacturing logic, switch to `forgecad-make-a-model` rather than refining the blockout indefinitely.
49
+ File placement and naming follow `forgecad-make-a-model` conventions; suffix the filename `-blockout` or `-concept` unless the user supplied a clearer name. Once the high-level questions are answered, stop. If the next question is real fit, tunable dimensions, part details, or manufacturing logic, switch to `forgecad-make-a-model` instead of refining the blockout indefinitely.