forgecad 0.9.15 → 0.9.16

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 (70) hide show
  1. package/dist/assets/{AdminPage-CDyGUinA.js → AdminPage-CXvls4-J.js} +1 -1
  2. package/dist/assets/{BenchmarkPage-DfPMY_-d.js → BenchmarkPage-B27zk8xL.js} +1 -1
  3. package/dist/assets/{BlogPage-kF0fkdJT.js → BlogPage-CMAVvgQL.js} +1 -1
  4. package/dist/assets/{DocsPage-B954L3YN.js → DocsPage-knf4I4h7.js} +1 -1
  5. package/dist/assets/EditorApp-BHMQlJ-D.js +14686 -0
  6. package/dist/assets/{EditorApp-CuDLxKqL.css → EditorApp-BpjZgzk0.css} +148 -0
  7. package/dist/assets/{EmbedViewer-C77B-TrF.js → EmbedViewer-D7ZGlFjx.js} +2 -2
  8. package/dist/assets/{LandingPageProofDriven-Cr6fXMDj.js → LandingPageProofDriven-CnevhTE8.js} +2 -2
  9. package/dist/assets/{LegalPage-Dzklqmmg.js → LegalPage-BPTUmqeg.js} +1 -1
  10. package/dist/assets/{PricingPage-zWXkvlwl.js → PricingPage-B0D4goG_.js} +1 -1
  11. package/dist/assets/{SettingsPage-Bz0of4KQ.js → SettingsPage-CFF-UgjI.js} +1 -1
  12. package/dist/assets/{app-D3kDkggg.js → app-T0pDcSX4.js} +1184 -218
  13. package/dist/assets/cli/{render-DSY3mMQa.js → render-C5pcIISc.js} +144 -26
  14. package/dist/assets/{constructionHistoryWorker-gpDo-uH2.js → constructionHistoryWorker-Ba2Hm58b.js} +1 -0
  15. package/dist/assets/{evalWorker-CU0Ke6DP.js → evalWorker-vkx310U2.js} +1380 -2173
  16. package/dist/assets/{inspectWorker-COyp8XXA.js → inspectWorker-BuTJDVX6.js} +252 -30
  17. package/dist/assets/{targets-B9sGB5nB.js → jointPose-B_Cgedn9.js} +71 -3
  18. package/dist/assets/{manifold-DNkrUWpA.js → manifold-BWgsjmAM.js} +1 -1
  19. package/dist/assets/{manifold-C-3h2M7p.js → manifold-D6IFSkhH.js} +2 -2
  20. package/dist/assets/{manifold-BRI5prcH.js → manifold-rZexZI0G.js} +1 -1
  21. package/dist/assets/{reportWorker-CdBz5bNg.js → reportWorker-0AGij1Ru.js} +1373 -2166
  22. package/dist/assets/{scalar-sampling-budget-wJF98aY9.js → scalar-sampling-budget-J5cuzxT1.js} +1494 -2251
  23. package/dist/assets/{scanProxyWorker-B-9VbLIs.js → scanProxyWorker-Vl4Wxa1y.js} +18 -5
  24. package/dist/cli/render.html +1 -1
  25. package/dist/docs/index.html +1 -1
  26. package/dist/docs-raw/AI/usage.md +2 -0
  27. package/dist/docs-raw/CLI.md +4 -0
  28. package/dist/docs-raw/generated/assembly.md +104 -6
  29. package/dist/docs-raw/generated/concepts.md +14 -4
  30. package/dist/docs-raw/generated/lib.md +2 -18
  31. package/dist/docs-raw/generated/output.md +14 -4
  32. package/dist/docs-raw/generated/runtime-names.md +27 -19
  33. package/dist/docs-raw/skills/forgecad-make-a-model.md +39 -38
  34. package/dist/docs-raw/skills/forgecad-project.md +2 -0
  35. package/dist/docs-raw/welcome.md +2 -0
  36. package/dist/index.html +1 -1
  37. package/dist/sitemap.xml +13 -13
  38. package/dist-cli/{check-compiler-SDX5QIXI.js → check-compiler-SYQ2PWOB.js} +1 -1
  39. package/dist-cli/{check-query-propagation-EAYEFT77.js → check-query-propagation-HIAGV62W.js} +1 -1
  40. package/dist-cli/{chunk-N4O47JLF.js → chunk-SPZE3DUY.js} +1591 -2356
  41. package/dist-cli/forgecad.js +1698 -487
  42. package/dist-skill/CONTEXT.md +117 -46
  43. package/dist-skill/docs/CLI.md +4 -0
  44. package/dist-skill/docs/generated/assembly.md +83 -5
  45. package/dist-skill/docs/generated/lib.md +2 -18
  46. package/dist-skill/docs/generated/output.md +14 -4
  47. package/dist-skill/docs/generated/runtime-names.md +18 -19
  48. package/dist-skill/library/forgecad-make-a-model/SKILL.md +39 -38
  49. package/dist-skill/library/forgecad-project/SKILL.md +2 -0
  50. package/examples/api/helix-basics.forge.js +2 -2
  51. package/examples/api/route3d-elbow.forge.js +3 -0
  52. package/examples/api/variable-sweep-test.forge.js +3 -1
  53. package/package.json +4 -1
  54. package/dist/assets/EditorApp-Beb-IZ0y.js +0 -14014
  55. package/examples/api/bolted-service-cover.forge.js +0 -17
  56. package/examples/api/cable-gland-anchor.forge.js +0 -14
  57. package/examples/api/captured-cartridge-guide.forge.js +0 -14
  58. package/examples/api/captured-linear-slide.forge.js +0 -13
  59. package/examples/api/clevis-pin-joint.forge.js +0 -13
  60. package/examples/api/datum-enclosure.forge.js +0 -16
  61. package/examples/api/hose-barb-port.forge.js +0 -14
  62. package/examples/api/knuckled-hinge-assembly.forge.js +0 -15
  63. package/examples/api/living-hinge-cover.forge.js +0 -14
  64. package/examples/api/pcb-terminal-block.forge.js +0 -22
  65. package/examples/api/pinned-lever-pivot-stack.forge.js +0 -14
  66. package/examples/api/retained-shaft-knob-stack.forge.js +0 -15
  67. package/examples/api/routed-tube-clip.forge.js +0 -15
  68. package/examples/api/seated-bearing-stack.forge.js +0 -30
  69. package/examples/api/snap-latch-cover.forge.js +0 -14
  70. package/examples/api/thumb-screw-clamp.forge.js +0 -15
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { D as DoubleSide, cC as initSolverWasm, cB as initKernel, S as Scene, cD as BoxGeometry, bV as MeshStandardMaterial, a4 as BackSide, b7 as PointLight, M as Mesh, aa as MeshBasicMaterial, cE as localAabbPlaneRelation, h as Vector2, cF as ShapeUtils, cG as analyzePhysicalConnectivity, g as Vector3, $ as Matrix4, cH as Frustum, G as Box3, a0 as MathUtils, cI as meshContactDataFor, cJ as AabbSpatialIndex, cK as detectPhysicalContact, cL as resolveThicknessInspectionOptions, R as Raycaster, cM as thicknessColor, cN as thicknessClass, a$ as BufferAttribute, cO as roughnessClassForAngle, cP as resolveRoughnessInspectionOptions, cQ as roughnessColorForAngle, cR as roughnessScoreForAngle, cS as activateBackend, e as Color, ba as COMPARISON_COLORS, ay as resolveForgeRenderStyle, by as getRenderStylePreset, ax as setParamOverrides, bl as runScript, cm as scanProxyGridForBounds, cT as Group, be as shapeToGeometry, bm as MeshPhysicalMaterial, bA as NormalBlending, cU as createScanProxyGeometry, bw as AdditiveBlending, aO as LineBasicMaterial, bn as LineSegments, aN as BufferGeometry, P as PerspectiveCamera, cj as DEFAULT_VIEW_CONFIG, bs as worldAuthorPlaneToLocal, cV as resolveSectionHatchMetrics, cu as buildGeometryComparisonPointCloud, cs as triangleSoupFromMeshes, O as OrthographicCamera, k as ShaderMaterial, bG as ZEBRA_STRIPE_FRAGMENT_SHADER, bH as ZEBRA_STRIPE_VERTEX_SHADER, bB as ZEBRA_STRIPE_SOFTNESS, bC as ZEBRA_STRIPE_SCALE, bD as ZEBRA_LIGHT_COLOR, bE as ZEBRA_DARK_COLOR, bF as ZEBRA_ACCENT_COLOR, bx as geometryWithVisibleVertexColors, cW as intersectWithPlane, cX as setActiveBackend, W as WebGLRenderer, A as ACESFilmicToneMapping, c as SRGBColorSpace, cY as parseCameraCliSpec, cZ as PMREMGenerator, b0 as CanvasTexture, b1 as Object3D, b2 as FogExp2, b3 as Fog, b4 as AmbientLight, b8 as DirectionalLight, b5 as HemisphereLight, aI as findJointAnimationClip, p as Plane, bJ as SURFACE_FIELD_FRAGMENT_SHADER, bK as SURFACE_FIELD_VERTEX_SHADER, bI as SCAN_PROXY_LAYER_STYLES, Y as Vector4, bY as SDF_RAYMARCH_PROXY_VERTEX_SHADER, bX as buildSdfRaymarchFragmentShader, aJ as resolveJointAnimation, aK as resolveJointViewValues, bP as ROUGHNESS_COLORS, c_ as PointsMaterial, c$ as Points, b9 as heatPointsForSide, d0 as analyzeCollisionIntersections, d1 as serializeCollisionFinding, d2 as summarizeThicknessSamples, bR as THICKNESS_COLORS, b6 as SpotLight, c0 as CylinderGeometry, d3 as TorusGeometry, bM as CatmullRomCurve3, bN as TubeGeometry, cy as resolveScalarSceneSampleBudget, bf as buildComparisonHeatPatchGeometry, bg as EdgesGeometry, d4 as SphereGeometry, d5 as ConeGeometry, bb as comparisonHeatDepthTest, bc as comparisonHeatEdgeOpacity, bd as comparisonHeatPatchOpacity, cA as comparisonCandidateContextOpacity, d6 as DEFAULT_COMPARISON_CANDIDATE_OPACITY } from "../scalar-sampling-budget-wJF98aY9.js";
5
- import { m as mergeViewportRenderSceneStates, p as parseRenderSceneCliSpec, g as getSceneObjectTreePath } from "../targets-B9sGB5nB.js";
4
+ import { D as DoubleSide, cC as initSolverWasm, cB as initKernel, S as Scene, cD as BoxGeometry, bU as MeshStandardMaterial, a4 as BackSide, b7 as PointLight, M as Mesh, aa as MeshBasicMaterial, cE as localAabbPlaneRelation, h as Vector2, cF as ShapeUtils, cG as analyzePhysicalConnectivity, g as Vector3, $ as Matrix4, cH as Frustum, G as Box3, a0 as MathUtils, cI as meshContactDataFor, cJ as AabbSpatialIndex, cK as detectPhysicalContact, cL as resolveThicknessInspectionOptions, R as Raycaster, cM as thicknessColor, cN as thicknessClass, a$ as BufferAttribute, cO as roughnessClassForAngle, cP as resolveRoughnessInspectionOptions, cQ as roughnessColorForAngle, cR as roughnessScoreForAngle, cS as activateBackend, e as Color, ba as COMPARISON_COLORS, ay as resolveForgeRenderStyle, by as getRenderStylePreset, ax as setParamOverrides, bl as runScript, cl as scanProxyGridForBounds, cT as Group, be as shapeToGeometry, bm as MeshPhysicalMaterial, bA as NormalBlending, cU as createScanProxyGeometry, bw as AdditiveBlending, aO as LineBasicMaterial, bn as LineSegments, aN as BufferGeometry, P as PerspectiveCamera, ci as DEFAULT_VIEW_CONFIG, bs as worldAuthorPlaneToLocal, cV as resolveSectionHatchMetrics, ct as buildGeometryComparisonPointCloud, cr as triangleSoupFromMeshes, O as OrthographicCamera, k as ShaderMaterial, bG as ZEBRA_STRIPE_FRAGMENT_SHADER, bH as ZEBRA_STRIPE_VERTEX_SHADER, bB as ZEBRA_STRIPE_SOFTNESS, bC as ZEBRA_STRIPE_SCALE, bD as ZEBRA_LIGHT_COLOR, bE as ZEBRA_DARK_COLOR, bF as ZEBRA_ACCENT_COLOR, bx as geometryWithVisibleVertexColors, cW as intersectWithPlane, cX as setActiveBackend, W as WebGLRenderer, A as ACESFilmicToneMapping, c as SRGBColorSpace, cY as parseCameraCliSpec, cZ as PMREMGenerator, b0 as CanvasTexture, b1 as Object3D, b2 as FogExp2, b3 as Fog, b4 as AmbientLight, b8 as DirectionalLight, b5 as HemisphereLight, aI as findJointAnimationClip, p as Plane, bJ as SURFACE_FIELD_FRAGMENT_SHADER, bK as SURFACE_FIELD_VERTEX_SHADER, bI as SCAN_PROXY_LAYER_STYLES, Y as Vector4, bX as SDF_RAYMARCH_PROXY_VERTEX_SHADER, bW as buildSdfRaymarchFragmentShader, aJ as resolveJointAnimation, aK as resolveJointViewValues, bP as ROUGHNESS_COLORS, c_ as PointsMaterial, c$ as Points, b9 as heatPointsForSide, d0 as analyzeCollisionIntersections, d1 as serializeCollisionFinding, d2 as summarizeThicknessSamples, bO as THICKNESS_GRADIENT_COLORS, d3 as THICKNESS_COLORS, b6 as SpotLight, b$ as CylinderGeometry, d4 as TorusGeometry, bM as CatmullRomCurve3, bN as TubeGeometry, cx as resolveScalarSceneSampleBudget, bf as buildComparisonHeatPatchGeometry, bg as EdgesGeometry, d5 as SphereGeometry, d6 as ConeGeometry, bb as comparisonHeatDepthTest, bc as comparisonHeatEdgeOpacity, bd as comparisonHeatPatchOpacity, cz as comparisonCandidateContextOpacity, d7 as DEFAULT_COMPARISON_CANDIDATE_OPACITY } from "../scalar-sampling-budget-J5cuzxT1.js";
5
+ import { m as mergeViewportRenderSceneStates, v as validateJointOverrides, b as buildBaseJointValues, p as parseRenderSceneCliSpec, g as getSceneObjectTreePath } from "../jointPose-B_Cgedn9.js";
6
6
  const CAD_MATERIAL_PROPS = {
7
7
  color: 6003669,
8
8
  metalness: 0.05,
@@ -1110,6 +1110,92 @@ ${body}
1110
1110
  pathCount
1111
1111
  };
1112
1112
  }
1113
+ class DisjointSet {
1114
+ constructor(size) {
1115
+ __publicField(this, "parent");
1116
+ __publicField(this, "rank");
1117
+ this.parent = Array.from({ length: size }, (_, index) => index);
1118
+ this.rank = Array.from({ length: size }, () => 0);
1119
+ }
1120
+ find(index) {
1121
+ const parent = this.parent[index];
1122
+ if (parent === index) return index;
1123
+ const root = this.find(parent);
1124
+ this.parent[index] = root;
1125
+ return root;
1126
+ }
1127
+ union(a, b) {
1128
+ const rootA = this.find(a);
1129
+ const rootB = this.find(b);
1130
+ if (rootA === rootB) return;
1131
+ if (this.rank[rootA] < this.rank[rootB]) {
1132
+ this.parent[rootA] = rootB;
1133
+ } else if (this.rank[rootA] > this.rank[rootB]) {
1134
+ this.parent[rootB] = rootA;
1135
+ } else {
1136
+ this.parent[rootB] = rootA;
1137
+ this.rank[rootA] += 1;
1138
+ }
1139
+ }
1140
+ }
1141
+ function connectedCoplanarSurfacePatches(triangles) {
1142
+ const snap = surfacePatchSnap(triangles);
1143
+ const planeKeys = triangles.map((triangle) => planeKey(triangle, snap));
1144
+ const edgeOwners = /* @__PURE__ */ new Map();
1145
+ const sets = new DisjointSet(triangles.length);
1146
+ triangles.forEach((triangle, index) => {
1147
+ for (const key of triangleEdgeKeys(triangle, snap)) {
1148
+ const owners = edgeOwners.get(key);
1149
+ if (owners) {
1150
+ for (const owner of owners) {
1151
+ if (planeKeys[owner] === planeKeys[index]) sets.union(owner, index);
1152
+ }
1153
+ owners.push(index);
1154
+ } else {
1155
+ edgeOwners.set(key, [index]);
1156
+ }
1157
+ }
1158
+ });
1159
+ const patchByRoot = /* @__PURE__ */ new Map();
1160
+ triangles.forEach((triangle, index) => {
1161
+ const root = sets.find(index);
1162
+ const patch = patchByRoot.get(root) ?? { triangleIndexes: [], area: 0 };
1163
+ patch.triangleIndexes.push(index);
1164
+ patch.area += triangle.area;
1165
+ patchByRoot.set(root, patch);
1166
+ });
1167
+ return [...patchByRoot.values()];
1168
+ }
1169
+ function surfacePatchSnap(triangles) {
1170
+ const bounds = new Box3();
1171
+ for (const triangle of triangles) {
1172
+ bounds.expandByPoint(triangle.a);
1173
+ bounds.expandByPoint(triangle.b);
1174
+ bounds.expandByPoint(triangle.c);
1175
+ }
1176
+ const size = bounds.getSize(new Vector3());
1177
+ return Math.max(1e-6, size.length() * 1e-8);
1178
+ }
1179
+ function planeKey(triangle, snap) {
1180
+ const normalSnap = 1e-6;
1181
+ const distance = triangle.normal.dot(triangle.a);
1182
+ return [
1183
+ Math.round(triangle.normal.x / normalSnap),
1184
+ Math.round(triangle.normal.y / normalSnap),
1185
+ Math.round(triangle.normal.z / normalSnap),
1186
+ Math.round(distance / snap)
1187
+ ].join(",");
1188
+ }
1189
+ function triangleEdgeKeys(triangle, snap) {
1190
+ const vertices = [vertexKey$2(triangle.a, snap), vertexKey$2(triangle.b, snap), vertexKey$2(triangle.c, snap)];
1191
+ return [edgeKey$1(vertices[0], vertices[1]), edgeKey$1(vertices[1], vertices[2]), edgeKey$1(vertices[2], vertices[0])];
1192
+ }
1193
+ function vertexKey$2(point, snap) {
1194
+ return `${Math.round(point.x / snap)},${Math.round(point.y / snap)},${Math.round(point.z / snap)}`;
1195
+ }
1196
+ function edgeKey$1(a, b) {
1197
+ return a < b ? `${a}|${b}` : `${b}|${a}`;
1198
+ }
1113
1199
  const MIN_TRIANGLE_AREA = 1e-12;
1114
1200
  const R2_ALPHA = 0.7548776662466927;
1115
1201
  const R2_BETA = 0.5698402909980532;
@@ -1162,7 +1248,7 @@ function allocateAreaSampleCounts(triangles, maxSamples) {
1162
1248
  return counts;
1163
1249
  }
1164
1250
  function sampleSurfaceTriangles(triangles, maxSamples) {
1165
- const counts = allocateAreaSampleCounts(triangles, maxSamples);
1251
+ const counts = allocateSurfacePatchSampleCounts(triangles, maxSamples);
1166
1252
  const samples = [];
1167
1253
  const position = new Vector3();
1168
1254
  let sampleIndex = 0;
@@ -1187,6 +1273,35 @@ function sampleSurfaceTriangles(triangles, maxSamples) {
1187
1273
  });
1188
1274
  return samples;
1189
1275
  }
1276
+ function allocateSurfacePatchSampleCounts(triangles, maxSamples) {
1277
+ const counts = new Array(triangles.length).fill(0);
1278
+ if (triangles.length === 0) return counts;
1279
+ const patches = connectedCoplanarSurfacePatches(triangles);
1280
+ const patchCounts = allocateAreaSampleCounts(
1281
+ patches.map((patch, index) => {
1282
+ var _a, _b, _c, _d;
1283
+ return {
1284
+ index,
1285
+ a: ((_a = triangles[patch.triangleIndexes[0]]) == null ? void 0 : _a.a) ?? new Vector3(),
1286
+ b: ((_b = triangles[patch.triangleIndexes[0]]) == null ? void 0 : _b.b) ?? new Vector3(),
1287
+ c: ((_c = triangles[patch.triangleIndexes[0]]) == null ? void 0 : _c.c) ?? new Vector3(),
1288
+ normal: ((_d = triangles[patch.triangleIndexes[0]]) == null ? void 0 : _d.normal) ?? new Vector3(0, 0, 1),
1289
+ area: patch.area
1290
+ };
1291
+ }),
1292
+ maxSamples
1293
+ );
1294
+ patches.forEach((patch, patchIndex) => {
1295
+ const patchBudget = patchCounts[patchIndex] ?? 0;
1296
+ if (patchBudget <= 0) return;
1297
+ const patchTriangles = patch.triangleIndexes.map((index) => triangles[index]);
1298
+ const localCounts = allocateAreaSampleCounts(patchTriangles, patchBudget);
1299
+ patch.triangleIndexes.forEach((triangleIndex, localIndex) => {
1300
+ counts[triangleIndex] += localCounts[localIndex] ?? 0;
1301
+ });
1302
+ });
1303
+ return counts;
1304
+ }
1190
1305
  function totalSurfaceArea(triangles) {
1191
1306
  return triangles.reduce((sum, triangle) => sum + triangle.area, 0);
1192
1307
  }
@@ -3754,10 +3869,9 @@ function getSessionThicknessInspection(session, rawOptions) {
3754
3869
  objects,
3755
3870
  warnings,
3756
3871
  style: {
3757
- criticalColor: THICKNESS_COLORS.critical,
3758
- warningColor: THICKNESS_COLORS.warning,
3759
- okColor: THICKNESS_COLORS.ok,
3760
- thickColor: THICKNESS_COLORS.thick,
3872
+ gradientColors: THICKNESS_GRADIENT_COLORS.map((color) => [...color]),
3873
+ colorMinThickness: options.colorMinThickness,
3874
+ colorMaxThickness: options.colorMaxThickness,
3761
3875
  unknownColor: THICKNESS_COLORS.unknown
3762
3876
  }
3763
3877
  }
@@ -4742,13 +4856,6 @@ function buildCameraRig(center, distance, _maxDim, spec, fovDeg = 45) {
4742
4856
  orbitBasePitchDeg: Number.isFinite(orbitBasePitchDeg) ? orbitBasePitchDeg : DEFAULT_PITCH_DEG
4743
4857
  };
4744
4858
  }
4745
- function buildBaseJointValues(joints) {
4746
- const out = {};
4747
- joints.forEach((joint) => {
4748
- out[joint.name] = joint.defaultValue;
4749
- });
4750
- return out;
4751
- }
4752
4859
  function resolveRequestedSceneState(opts) {
4753
4860
  let sceneState = (opts == null ? void 0 : opts.sceneState) ?? null;
4754
4861
  if (opts == null ? void 0 : opts.sceneSpec) {
@@ -4773,8 +4880,8 @@ function resolveRenderableJointNodeName(obj, joints) {
4773
4880
  }
4774
4881
  function applyObjectTransforms(session, animationProgress) {
4775
4882
  const animatedValues = resolveJointAnimation(session.selectedAnimation, animationProgress ?? 0, session.baseJointValues);
4776
- const effectiveJointValues = resolveJointViewValues(session.joints, session.jointCouplings, animatedValues);
4777
- const jointMatrices = computeJointNodeMatrices(session.joints, effectiveJointValues);
4883
+ const effectiveJointValues = resolveJointViewValues(session.transformJoints, session.transformJointCouplings, animatedValues);
4884
+ const jointMatrices = computeJointNodeMatrices(session.transformJoints, effectiveJointValues);
4778
4885
  const objectMatrices = /* @__PURE__ */ new Map();
4779
4886
  session.renderables.forEach((renderable) => {
4780
4887
  var _a;
@@ -5001,7 +5108,7 @@ Available renderable objects: ${available}`;
5001
5108
  return "No visible renderable objects found.";
5002
5109
  }
5003
5110
  function createSession(code, opts) {
5004
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
5111
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
5005
5112
  const size = (opts == null ? void 0 : opts.size) ?? 1024;
5006
5113
  const pixelRatio = (opts == null ? void 0 : opts.pixelRatio) ?? 1;
5007
5114
  const debug = createCaptureDebugLogger(opts == null ? void 0 : opts.debug);
@@ -5033,6 +5140,7 @@ function createSession(code, opts) {
5033
5140
  const result = runScript(code, (opts == null ? void 0 : opts.fileName) || "main.forge.js", (opts == null ? void 0 : opts.allFiles) || {}, {
5034
5141
  quality: (opts == null ? void 0 : opts.quality) ?? "high",
5035
5142
  readBinaryFile: binaryFileMapReader(opts == null ? void 0 : opts.binaryFiles),
5143
+ assemblyState: opts == null ? void 0 : opts.jointOverrides,
5036
5144
  debug: (opts == null ? void 0 : opts.debug) ? (phase, detail) => debug(`runScript:${phase}`, detail) : void 0
5037
5145
  });
5038
5146
  debug("session:runScript:end", {
@@ -5189,8 +5297,15 @@ function createSession(code, opts) {
5189
5297
  }
5190
5298
  const joints = ((_e = result.jointsView) == null ? void 0 : _e.enabled) === false ? [] : ((_f = result.jointsView) == null ? void 0 : _f.joints) ?? [];
5191
5299
  const jointCouplings = ((_g = result.jointsView) == null ? void 0 : _g.enabled) === false ? [] : ((_h = result.jointsView) == null ? void 0 : _h.couplings) ?? [];
5192
- const animationClips = ((_i = result.jointsView) == null ? void 0 : _i.enabled) === false ? [] : ((_j = result.jointsView) == null ? void 0 : _j.animations) ?? [];
5193
- const defaultAnimation = ((_k = result.jointsView) == null ? void 0 : _k.defaultAnimation) ?? null;
5300
+ try {
5301
+ validateJointOverrides(result.jointsView, (opts == null ? void 0 : opts.jointOverrides) ?? {});
5302
+ } catch (err) {
5303
+ return { ok: false, error: err instanceof Error ? err.message : String(err) };
5304
+ }
5305
+ const transformJoints = ((_i = result.jointsView) == null ? void 0 : _i.motionSource) === "assembly" ? [] : joints;
5306
+ const transformJointCouplings = ((_j = result.jointsView) == null ? void 0 : _j.motionSource) === "assembly" ? [] : jointCouplings;
5307
+ const animationClips = ((_k = result.jointsView) == null ? void 0 : _k.enabled) === false ? [] : ((_l = result.jointsView) == null ? void 0 : _l.animations) ?? [];
5308
+ const defaultAnimation = ((_m = result.jointsView) == null ? void 0 : _m.defaultAnimation) ?? null;
5194
5309
  let selectedAnimation;
5195
5310
  let sweep = null;
5196
5311
  let cutawayBase = null;
@@ -5266,8 +5381,8 @@ function createSession(code, opts) {
5266
5381
  id: obj.source.id,
5267
5382
  name: objectLabel,
5268
5383
  ms: Number((performance.now() - geometryStart).toFixed(1)),
5269
- triangles: Math.floor((((_l = geo.solid.getAttribute("position")) == null ? void 0 : _l.count) ?? 0) / 3),
5270
- edgeSegments: Math.floor((((_m = geo.edges.getAttribute("position")) == null ? void 0 : _m.count) ?? 0) / 2)
5384
+ triangles: Math.floor((((_n = geo.solid.getAttribute("position")) == null ? void 0 : _n.count) ?? 0) / 3),
5385
+ edgeSegments: Math.floor((((_o = geo.edges.getAttribute("position")) == null ? void 0 : _o.count) ?? 0) / 2)
5271
5386
  });
5272
5387
  const materialDefaults = renderStylePreset.material;
5273
5388
  const surfaceField = renderStylePreset.surfaceField;
@@ -5423,7 +5538,7 @@ function createSession(code, opts) {
5423
5538
  ...scanProxy ? { scanProxy } : {},
5424
5539
  solidMaterial,
5425
5540
  wireMaterial,
5426
- jointNodeName: resolveRenderableJointNodeName(obj.source, joints),
5541
+ jointNodeName: resolveRenderableJointNodeName(obj.source, transformJoints),
5427
5542
  sourceColor: obj.color ?? "#5b9bd5",
5428
5543
  opacity: obj.opacity,
5429
5544
  sectionMesh,
@@ -5442,7 +5557,7 @@ function createSession(code, opts) {
5442
5557
  { bodyShape: () => new EmptyInspectionShape() }
5443
5558
  ) : null;
5444
5559
  const connectivityEntries = (connectivityBodyInput == null ? void 0 : connectivityBodyInput.entries) ?? [];
5445
- const groundOffset = Number.isFinite((_n = sceneConfig == null ? void 0 : sceneConfig.ground) == null ? void 0 : _n.offset) ? sceneConfig.ground.offset : 0;
5560
+ const groundOffset = Number.isFinite((_p = sceneConfig == null ? void 0 : sceneConfig.ground) == null ? void 0 : _p.offset) ? sceneConfig.ground.offset : 0;
5446
5561
  const floatingGroundZ = bbox.min[2] - groundOffset;
5447
5562
  let sceneConfigCameraState = null;
5448
5563
  if ((sceneConfig == null ? void 0 : sceneConfig.camera) && !(requestedSceneState == null ? void 0 : requestedSceneState.camera)) {
@@ -5471,7 +5586,7 @@ function createSession(code, opts) {
5471
5586
  } : null;
5472
5587
  const cameraSpec = sceneConfigCameraState && (opts == null ? void 0 : opts.capture) === "section-sweep" ? fitCameraStateToBounds(sceneConfigCameraState, bbox, cameraFov) : (requestedSceneState == null ? void 0 : requestedSceneState.camera) ?? cutawayCameraState ?? sceneConfigCameraState;
5473
5588
  const cameraRig = buildCameraRig(center, distance, maxDim, cameraSpec, cameraFov);
5474
- const explicitCameraFov = (cameraSpec == null ? void 0 : cameraSpec.fov) ?? ((_o = sceneConfig == null ? void 0 : sceneConfig.camera) == null ? void 0 : _o.fov);
5589
+ const explicitCameraFov = (cameraSpec == null ? void 0 : cameraSpec.fov) ?? ((_q = sceneConfig == null ? void 0 : sceneConfig.camera) == null ? void 0 : _q.fov);
5475
5590
  if (explicitCameraFov && cameraRig.camera instanceof PerspectiveCamera) {
5476
5591
  cameraRig.camera.fov = explicitCameraFov;
5477
5592
  cameraRig.camera.updateProjectionMatrix();
@@ -5504,12 +5619,14 @@ function createSession(code, opts) {
5504
5619
  roughnessInspection: null,
5505
5620
  joints,
5506
5621
  jointCouplings,
5507
- jointOverlayConfig: ((_p = result.viewConfig) == null ? void 0 : _p.jointOverlay) ?? DEFAULT_VIEW_CONFIG.jointOverlay,
5622
+ transformJoints,
5623
+ transformJointCouplings,
5624
+ jointOverlayConfig: ((_r = result.viewConfig) == null ? void 0 : _r.jointOverlay) ?? DEFAULT_VIEW_CONFIG.jointOverlay,
5508
5625
  animationClips,
5509
5626
  defaultAnimation,
5510
5627
  selectedAnimation,
5511
5628
  availableCutPlaneNames: availableCutPlanes.map((cp) => cp.name),
5512
- baseJointValues: buildBaseJointValues(joints),
5629
+ baseJointValues: buildBaseJointValues(transformJoints, (opts == null ? void 0 : opts.jointOverrides) ?? {}),
5513
5630
  fixedCameraState: cameraRig.fixedCameraState,
5514
5631
  orbitTarget: cameraRig.orbitTarget,
5515
5632
  orbitRadius: cameraRig.orbitRadius,
@@ -5576,6 +5693,7 @@ window.__forgeRender = async (code, opts) => {
5576
5693
  focus: opts == null ? void 0 : opts.focus,
5577
5694
  hide: opts == null ? void 0 : opts.hide,
5578
5695
  paramOverrides: opts == null ? void 0 : opts.paramOverrides,
5696
+ jointOverrides: opts == null ? void 0 : opts.jointOverrides,
5579
5697
  renderStyle: opts == null ? void 0 : opts.renderStyle,
5580
5698
  scanGranularity: opts == null ? void 0 : opts.scanGranularity,
5581
5699
  respectAuthoredSceneStyle: opts == null ? void 0 : opts.respectAuthoredSceneStyle,
@@ -7845,6 +7845,7 @@ class Transform {
7845
7845
  return this.rotateAxis([0, 0, 1], angleDeg, pivot);
7846
7846
  }
7847
7847
  /** Scale after the current transform. */
7848
+ // biome-ignore lint/suspicious/useAdjacentOverloadSignatures: Static Transform.scale() and chainable instance scale() intentionally share the CAD API name.
7848
7849
  scale(v) {
7849
7850
  return this.mul(Transform.scale(v));
7850
7851
  }