brepjs 18.115.0 → 18.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs.cjs +95 -2
- package/dist/brepjs.js +95 -2
- package/dist/operations.cjs +1 -1
- package/dist/operations.js +1 -1
- package/dist/{refResolveFns-pRVyjy35.cjs → refResolveFns-BiEBAREW.cjs} +26 -7
- package/dist/{refResolveFns-hEOEcFZ8.js → refResolveFns-Ck6kJzLE.js} +26 -7
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{threadFns-bCOhVQLb.js → threadFns-Dgr2qyJv.js} +20 -3
- package/dist/{threadFns-C8bErjVC.cjs → threadFns-KrG_i9_w.cjs} +19 -2
- package/dist/topology/shapeRef/refResolveFns.d.ts +5 -4
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -17,7 +17,7 @@ const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
|
17
17
|
const require_surfaceBuilders = require("./surfaceBuilders-UyyfZy8w.cjs");
|
|
18
18
|
const require_solidBuilders = require("./solidBuilders-DiUv_mD0.cjs");
|
|
19
19
|
const require_healingFns = require("./healingFns-xLJ6Cp_O.cjs");
|
|
20
|
-
const require_threadFns = require("./threadFns-
|
|
20
|
+
const require_threadFns = require("./threadFns-KrG_i9_w.cjs");
|
|
21
21
|
const require_blueprintSketcher = require("./blueprintSketcher-RK-cH6ps.cjs");
|
|
22
22
|
const require_helpers = require("./helpers-BSLPCflF.cjs");
|
|
23
23
|
const require_drawFns = require("./drawFns-DNxs7PAT.cjs");
|
|
@@ -30,7 +30,7 @@ const require_loftFns = require("./loftFns-fpTmrIdd.cjs");
|
|
|
30
30
|
const require_cameraFns = require("./cameraFns-uo1sZbBT.cjs");
|
|
31
31
|
const require_textMetrics = require("./textMetrics-IC_IoI7l.cjs");
|
|
32
32
|
const require_adjacencyFns = require("./adjacencyFns-d8ZabkvX.cjs");
|
|
33
|
-
const require_refResolveFns = require("./refResolveFns-
|
|
33
|
+
const require_refResolveFns = require("./refResolveFns-BiEBAREW.cjs");
|
|
34
34
|
const require_workerPool = require("./workerPool-D30NsiIW.cjs");
|
|
35
35
|
const require_primitiveFns = require("./primitiveFns-DLIWtQWA.cjs");
|
|
36
36
|
//#region src/topology/shapeBooleans.ts
|
|
@@ -5837,6 +5837,76 @@ function cacheKey(node, env, kernelId, tolerance) {
|
|
|
5837
5837
|
const tolHash = tolerance === void 0 ? "d" : fnvMixNumber(fnvInit(), tolerance).toString(16);
|
|
5838
5838
|
return `${toHex(node.structuralHash)}:${kernelId}:${toHex(projHash)}:${tolHash}`;
|
|
5839
5839
|
}
|
|
5840
|
+
/**
|
|
5841
|
+
* Peel outer Translate nodes off `node`, accumulating their env-evaluated
|
|
5842
|
+
* offsets. Pure translations compose by addition, so the inner geometry is
|
|
5843
|
+
* placement-independent: it meshes once and the cached mesh is shifted per
|
|
5844
|
+
* placement instead of re-tessellating. Stops at the first non-Translate node
|
|
5845
|
+
* (or one whose offset can't be evaluated in `env`).
|
|
5846
|
+
*/
|
|
5847
|
+
function peelTranslate(node, env) {
|
|
5848
|
+
let inner = node;
|
|
5849
|
+
let ox = 0;
|
|
5850
|
+
let oy = 0;
|
|
5851
|
+
let oz = 0;
|
|
5852
|
+
while (inner.kind === "Translate") {
|
|
5853
|
+
const v = evalVec3(inner.vector, env, "evaluateMesh.peelTranslate");
|
|
5854
|
+
if (!v.ok) break;
|
|
5855
|
+
ox += v.value[0];
|
|
5856
|
+
oy += v.value[1];
|
|
5857
|
+
oz += v.value[2];
|
|
5858
|
+
inner = inner.target;
|
|
5859
|
+
}
|
|
5860
|
+
return {
|
|
5861
|
+
inner,
|
|
5862
|
+
offset: [
|
|
5863
|
+
ox,
|
|
5864
|
+
oy,
|
|
5865
|
+
oz
|
|
5866
|
+
]
|
|
5867
|
+
};
|
|
5868
|
+
}
|
|
5869
|
+
/** Shift every vertex of a mesh by `offset`; normals, UVs and triangles are unchanged. */
|
|
5870
|
+
function translateMesh(m, offset) {
|
|
5871
|
+
const [dx, dy, dz] = offset;
|
|
5872
|
+
if (dx === 0 && dy === 0 && dz === 0) return m;
|
|
5873
|
+
const vertices = new Float32Array(m.vertices.length);
|
|
5874
|
+
for (let i = 0; i < m.vertices.length; i += 3) {
|
|
5875
|
+
vertices[i] = (m.vertices[i] ?? 0) + dx;
|
|
5876
|
+
vertices[i + 1] = (m.vertices[i + 1] ?? 0) + dy;
|
|
5877
|
+
vertices[i + 2] = (m.vertices[i + 2] ?? 0) + dz;
|
|
5878
|
+
}
|
|
5879
|
+
return {
|
|
5880
|
+
...m,
|
|
5881
|
+
vertices
|
|
5882
|
+
};
|
|
5883
|
+
}
|
|
5884
|
+
/**
|
|
5885
|
+
* Re-key a reused inner mesh's face groups onto the PLACED shape. `locate` gives
|
|
5886
|
+
* moved faces location-dependent hashes, so the inner mesh's `faceId`s describe
|
|
5887
|
+
* the *unplaced* shape; remap them to the placed faces (1:1 by iteration order,
|
|
5888
|
+
* since `locate` shares the source TShape) so face picking and metadata lookup
|
|
5889
|
+
* resolve against the placed mesh. Origins are translation-invariant, so only
|
|
5890
|
+
* `faceId` changes.
|
|
5891
|
+
*
|
|
5892
|
+
* Takes pre-captured hash arrays (not shapes): a bounded shape cache can evict
|
|
5893
|
+
* and dispose one shape while the other is being evaluated, so the caller reads
|
|
5894
|
+
* each shape's face hashes immediately after evaluating it, never holding a
|
|
5895
|
+
* shape handle across the next `evaluate`.
|
|
5896
|
+
*/
|
|
5897
|
+
function relocateFaceGroups(faceGroups, innerHashes, placedHashes) {
|
|
5898
|
+
const remap = /* @__PURE__ */ new Map();
|
|
5899
|
+
const n = Math.min(innerHashes.length, placedHashes.length);
|
|
5900
|
+
for (let i = 0; i < n; i++) {
|
|
5901
|
+
const a = innerHashes[i];
|
|
5902
|
+
const b = placedHashes[i];
|
|
5903
|
+
if (a !== void 0 && b !== void 0) remap.set(a, b);
|
|
5904
|
+
}
|
|
5905
|
+
return faceGroups.map((g) => ({
|
|
5906
|
+
...g,
|
|
5907
|
+
faceId: remap.get(g.faceId) ?? g.faceId
|
|
5908
|
+
}));
|
|
5909
|
+
}
|
|
5840
5910
|
var Evaluator = class {
|
|
5841
5911
|
cache = /* @__PURE__ */ new Map();
|
|
5842
5912
|
refCounts = /* @__PURE__ */ new Map();
|
|
@@ -5913,6 +5983,29 @@ var Evaluator = class {
|
|
|
5913
5983
|
}
|
|
5914
5984
|
return require_errors.ok(cached);
|
|
5915
5985
|
}
|
|
5986
|
+
const { inner, offset } = peelTranslate(node, env);
|
|
5987
|
+
if (inner !== node) {
|
|
5988
|
+
const innerMesh = this.evaluateMesh(inner, env, meshOpts);
|
|
5989
|
+
if (!innerMesh.ok) return innerMesh;
|
|
5990
|
+
const innerShape = this.evaluate(inner, env);
|
|
5991
|
+
if (!innerShape.ok) return innerShape;
|
|
5992
|
+
const innerHashes = require_topologyQueryFns.getFaces(innerShape.value).map(require_shapeFns.getHashCode);
|
|
5993
|
+
const placedShape = this.evaluate(node, env);
|
|
5994
|
+
if (!placedShape.ok) return placedShape;
|
|
5995
|
+
const placedHashes = require_topologyQueryFns.getFaces(placedShape.value).map(require_shapeFns.getHashCode);
|
|
5996
|
+
const moved = translateMesh(innerMesh.value, offset);
|
|
5997
|
+
const faceGroups = relocateFaceGroups(moved.faceGroups, innerHashes, placedHashes);
|
|
5998
|
+
const placedSet = new Set(placedHashes);
|
|
5999
|
+
if (faceGroups.every((g) => placedSet.has(g.faceId))) {
|
|
6000
|
+
const placed = {
|
|
6001
|
+
...moved,
|
|
6002
|
+
faceGroups
|
|
6003
|
+
};
|
|
6004
|
+
this.meshCache.set(meshKey, placed);
|
|
6005
|
+
if (this.maxMeshCacheEntries !== void 0) this.trimMeshCache(this.maxMeshCacheEntries);
|
|
6006
|
+
return require_errors.ok(placed);
|
|
6007
|
+
}
|
|
6008
|
+
}
|
|
5916
6009
|
}
|
|
5917
6010
|
const shape = this.evaluate(node, env);
|
|
5918
6011
|
if (!shape.ok) return shape;
|
package/dist/brepjs.js
CHANGED
|
@@ -15,7 +15,7 @@ import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayA
|
|
|
15
15
|
import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-rkE-jE90.js";
|
|
16
16
|
import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-C32wXQWG.js";
|
|
17
17
|
import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, M as toLODGeometryData, N as toLODGeometryLevels, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as toGroupedBufferGeometryData, k as chamferDistAngle, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-2TJHHDg5.js";
|
|
18
|
-
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-
|
|
18
|
+
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-Dgr2qyJv.js";
|
|
19
19
|
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-7rtwqUHZ.js";
|
|
20
20
|
import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DhJwFrkC.js";
|
|
21
21
|
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-SQIBls6p.js";
|
|
@@ -29,7 +29,7 @@ import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft,
|
|
|
29
29
|
import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-bk9e0F-T.js";
|
|
30
30
|
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-COGYk0LE.js";
|
|
31
31
|
import { a as sharedEdges, c as wiresOfFace, i as facesOfVertex, n as edgesOfFace, o as verticesOfEdge, r as facesOfEdge, s as verticesOfFace, t as adjacentFaces } from "./adjacencyFns-BYnyXXqt.js";
|
|
32
|
-
import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-
|
|
32
|
+
import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-Ck6kJzLE.js";
|
|
33
33
|
import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
|
|
34
34
|
import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-CBrOyk5S.js";
|
|
35
35
|
//#region \0rolldown/runtime.js
|
|
@@ -5840,6 +5840,76 @@ function cacheKey(node, env, kernelId, tolerance) {
|
|
|
5840
5840
|
const tolHash = tolerance === void 0 ? "d" : fnvMixNumber(fnvInit(), tolerance).toString(16);
|
|
5841
5841
|
return `${toHex(node.structuralHash)}:${kernelId}:${toHex(projHash)}:${tolHash}`;
|
|
5842
5842
|
}
|
|
5843
|
+
/**
|
|
5844
|
+
* Peel outer Translate nodes off `node`, accumulating their env-evaluated
|
|
5845
|
+
* offsets. Pure translations compose by addition, so the inner geometry is
|
|
5846
|
+
* placement-independent: it meshes once and the cached mesh is shifted per
|
|
5847
|
+
* placement instead of re-tessellating. Stops at the first non-Translate node
|
|
5848
|
+
* (or one whose offset can't be evaluated in `env`).
|
|
5849
|
+
*/
|
|
5850
|
+
function peelTranslate(node, env) {
|
|
5851
|
+
let inner = node;
|
|
5852
|
+
let ox = 0;
|
|
5853
|
+
let oy = 0;
|
|
5854
|
+
let oz = 0;
|
|
5855
|
+
while (inner.kind === "Translate") {
|
|
5856
|
+
const v = evalVec3(inner.vector, env, "evaluateMesh.peelTranslate");
|
|
5857
|
+
if (!v.ok) break;
|
|
5858
|
+
ox += v.value[0];
|
|
5859
|
+
oy += v.value[1];
|
|
5860
|
+
oz += v.value[2];
|
|
5861
|
+
inner = inner.target;
|
|
5862
|
+
}
|
|
5863
|
+
return {
|
|
5864
|
+
inner,
|
|
5865
|
+
offset: [
|
|
5866
|
+
ox,
|
|
5867
|
+
oy,
|
|
5868
|
+
oz
|
|
5869
|
+
]
|
|
5870
|
+
};
|
|
5871
|
+
}
|
|
5872
|
+
/** Shift every vertex of a mesh by `offset`; normals, UVs and triangles are unchanged. */
|
|
5873
|
+
function translateMesh(m, offset) {
|
|
5874
|
+
const [dx, dy, dz] = offset;
|
|
5875
|
+
if (dx === 0 && dy === 0 && dz === 0) return m;
|
|
5876
|
+
const vertices = new Float32Array(m.vertices.length);
|
|
5877
|
+
for (let i = 0; i < m.vertices.length; i += 3) {
|
|
5878
|
+
vertices[i] = (m.vertices[i] ?? 0) + dx;
|
|
5879
|
+
vertices[i + 1] = (m.vertices[i + 1] ?? 0) + dy;
|
|
5880
|
+
vertices[i + 2] = (m.vertices[i + 2] ?? 0) + dz;
|
|
5881
|
+
}
|
|
5882
|
+
return {
|
|
5883
|
+
...m,
|
|
5884
|
+
vertices
|
|
5885
|
+
};
|
|
5886
|
+
}
|
|
5887
|
+
/**
|
|
5888
|
+
* Re-key a reused inner mesh's face groups onto the PLACED shape. `locate` gives
|
|
5889
|
+
* moved faces location-dependent hashes, so the inner mesh's `faceId`s describe
|
|
5890
|
+
* the *unplaced* shape; remap them to the placed faces (1:1 by iteration order,
|
|
5891
|
+
* since `locate` shares the source TShape) so face picking and metadata lookup
|
|
5892
|
+
* resolve against the placed mesh. Origins are translation-invariant, so only
|
|
5893
|
+
* `faceId` changes.
|
|
5894
|
+
*
|
|
5895
|
+
* Takes pre-captured hash arrays (not shapes): a bounded shape cache can evict
|
|
5896
|
+
* and dispose one shape while the other is being evaluated, so the caller reads
|
|
5897
|
+
* each shape's face hashes immediately after evaluating it, never holding a
|
|
5898
|
+
* shape handle across the next `evaluate`.
|
|
5899
|
+
*/
|
|
5900
|
+
function relocateFaceGroups(faceGroups, innerHashes, placedHashes) {
|
|
5901
|
+
const remap = /* @__PURE__ */ new Map();
|
|
5902
|
+
const n = Math.min(innerHashes.length, placedHashes.length);
|
|
5903
|
+
for (let i = 0; i < n; i++) {
|
|
5904
|
+
const a = innerHashes[i];
|
|
5905
|
+
const b = placedHashes[i];
|
|
5906
|
+
if (a !== void 0 && b !== void 0) remap.set(a, b);
|
|
5907
|
+
}
|
|
5908
|
+
return faceGroups.map((g) => ({
|
|
5909
|
+
...g,
|
|
5910
|
+
faceId: remap.get(g.faceId) ?? g.faceId
|
|
5911
|
+
}));
|
|
5912
|
+
}
|
|
5843
5913
|
var Evaluator = class {
|
|
5844
5914
|
cache = /* @__PURE__ */ new Map();
|
|
5845
5915
|
refCounts = /* @__PURE__ */ new Map();
|
|
@@ -5916,6 +5986,29 @@ var Evaluator = class {
|
|
|
5916
5986
|
}
|
|
5917
5987
|
return ok(cached);
|
|
5918
5988
|
}
|
|
5989
|
+
const { inner, offset } = peelTranslate(node, env);
|
|
5990
|
+
if (inner !== node) {
|
|
5991
|
+
const innerMesh = this.evaluateMesh(inner, env, meshOpts);
|
|
5992
|
+
if (!innerMesh.ok) return innerMesh;
|
|
5993
|
+
const innerShape = this.evaluate(inner, env);
|
|
5994
|
+
if (!innerShape.ok) return innerShape;
|
|
5995
|
+
const innerHashes = getFaces(innerShape.value).map(getHashCode);
|
|
5996
|
+
const placedShape = this.evaluate(node, env);
|
|
5997
|
+
if (!placedShape.ok) return placedShape;
|
|
5998
|
+
const placedHashes = getFaces(placedShape.value).map(getHashCode);
|
|
5999
|
+
const moved = translateMesh(innerMesh.value, offset);
|
|
6000
|
+
const faceGroups = relocateFaceGroups(moved.faceGroups, innerHashes, placedHashes);
|
|
6001
|
+
const placedSet = new Set(placedHashes);
|
|
6002
|
+
if (faceGroups.every((g) => placedSet.has(g.faceId))) {
|
|
6003
|
+
const placed = {
|
|
6004
|
+
...moved,
|
|
6005
|
+
faceGroups
|
|
6006
|
+
};
|
|
6007
|
+
this.meshCache.set(meshKey, placed);
|
|
6008
|
+
if (this.maxMeshCacheEntries !== void 0) this.trimMeshCache(this.maxMeshCacheEntries);
|
|
6009
|
+
return ok(placed);
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
5919
6012
|
}
|
|
5920
6013
|
const shape = this.evaluate(node, env);
|
|
5921
6014
|
if (!shape.ok) return shape;
|
package/dist/operations.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_threadFns = require("./threadFns-
|
|
2
|
+
const require_threadFns = require("./threadFns-KrG_i9_w.cjs");
|
|
3
3
|
const require_loftFns = require("./loftFns-fpTmrIdd.cjs");
|
|
4
4
|
exports.addChild = require_threadFns.addChild;
|
|
5
5
|
exports.addJoint = require_threadFns.addJoint;
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, O as prismaticJoint, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-
|
|
1
|
+
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, O as prismaticJoint, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-Dgr2qyJv.js";
|
|
2
2
|
import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-CmShFQlv.js";
|
|
3
3
|
export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, exportURDF, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, importURDF, inverseKinematics, jointTrajectory, jointTransform, jointsFromDH, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
|
|
@@ -739,19 +739,38 @@ function resolveRefIn(ref, shape) {
|
|
|
739
739
|
return resolveLineageRef(ref, rolesFor(ref, shape, /* @__PURE__ */ new Map()), shape);
|
|
740
740
|
}
|
|
741
741
|
/**
|
|
742
|
+
* A plain options object worth recursing into for nested refs — a literal `{}`
|
|
743
|
+
* (or null-prototype) that isn't a lineage ref, a shape handle, or a Date/Map/
|
|
744
|
+
* class instance (which `Object.entries` would silently flatten away).
|
|
745
|
+
*/
|
|
746
|
+
function isPlainOptions(value) {
|
|
747
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
748
|
+
const proto = Object.getPrototypeOf(value);
|
|
749
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
750
|
+
return !("wrapped" in value);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
742
753
|
* Replace every lineage ref in an operation's params with the live entity it
|
|
743
|
-
* resolves to in `shape`, recursing into arrays (
|
|
744
|
-
*
|
|
745
|
-
* re-derived once per `origin` and
|
|
746
|
-
* replay engine pass stable entity
|
|
754
|
+
* resolves to in `shape`, recursing into arrays (a fillet's edge list) and
|
|
755
|
+
* nested plain objects (a `{ selection: { edge } }` options bag). Refs that
|
|
756
|
+
* can't resolve are left as-is. Role tables are re-derived once per `origin` and
|
|
757
|
+
* reused across the whole params map. Lets a replay engine pass stable entity
|
|
758
|
+
* selections that survive upstream edits.
|
|
747
759
|
*/
|
|
748
760
|
function resolveRefParams(params, shape) {
|
|
749
761
|
const roleCache = /* @__PURE__ */ new Map();
|
|
750
762
|
const resolveValue = (value) => {
|
|
763
|
+
if (isLineageRef(value)) {
|
|
764
|
+
const res = resolveLineageRef(value, rolesFor(value, shape, roleCache), shape);
|
|
765
|
+
return res.ok ? res.entity : value;
|
|
766
|
+
}
|
|
751
767
|
if (Array.isArray(value)) return value.map(resolveValue);
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
|
|
768
|
+
if (isPlainOptions(value)) {
|
|
769
|
+
const nested = {};
|
|
770
|
+
for (const [k, v] of Object.entries(value)) nested[k] = resolveValue(v);
|
|
771
|
+
return nested;
|
|
772
|
+
}
|
|
773
|
+
return value;
|
|
755
774
|
};
|
|
756
775
|
const out = { ...params };
|
|
757
776
|
for (const [key, value] of Object.entries(params)) out[key] = resolveValue(value);
|
|
@@ -739,19 +739,38 @@ function resolveRefIn(ref, shape) {
|
|
|
739
739
|
return resolveLineageRef(ref, rolesFor(ref, shape, /* @__PURE__ */ new Map()), shape);
|
|
740
740
|
}
|
|
741
741
|
/**
|
|
742
|
+
* A plain options object worth recursing into for nested refs — a literal `{}`
|
|
743
|
+
* (or null-prototype) that isn't a lineage ref, a shape handle, or a Date/Map/
|
|
744
|
+
* class instance (which `Object.entries` would silently flatten away).
|
|
745
|
+
*/
|
|
746
|
+
function isPlainOptions(value) {
|
|
747
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
748
|
+
const proto = Object.getPrototypeOf(value);
|
|
749
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
750
|
+
return !("wrapped" in value);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
742
753
|
* Replace every lineage ref in an operation's params with the live entity it
|
|
743
|
-
* resolves to in `shape`, recursing into arrays (
|
|
744
|
-
*
|
|
745
|
-
* re-derived once per `origin` and
|
|
746
|
-
* replay engine pass stable entity
|
|
754
|
+
* resolves to in `shape`, recursing into arrays (a fillet's edge list) and
|
|
755
|
+
* nested plain objects (a `{ selection: { edge } }` options bag). Refs that
|
|
756
|
+
* can't resolve are left as-is. Role tables are re-derived once per `origin` and
|
|
757
|
+
* reused across the whole params map. Lets a replay engine pass stable entity
|
|
758
|
+
* selections that survive upstream edits.
|
|
747
759
|
*/
|
|
748
760
|
function resolveRefParams(params, shape) {
|
|
749
761
|
const roleCache = /* @__PURE__ */ new Map();
|
|
750
762
|
const resolveValue = (value) => {
|
|
763
|
+
if (isLineageRef(value)) {
|
|
764
|
+
const res = resolveLineageRef(value, rolesFor(value, shape, roleCache), shape);
|
|
765
|
+
return res.ok ? res.entity : value;
|
|
766
|
+
}
|
|
751
767
|
if (Array.isArray(value)) return value.map(resolveValue);
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
|
|
768
|
+
if (isPlainOptions(value)) {
|
|
769
|
+
const nested = {};
|
|
770
|
+
for (const [k, v] of Object.entries(value)) nested[k] = resolveValue(v);
|
|
771
|
+
return nested;
|
|
772
|
+
}
|
|
773
|
+
return value;
|
|
755
774
|
};
|
|
756
775
|
const out = { ...params };
|
|
757
776
|
for (const [key, value] of Object.entries(params)) out[key] = resolveValue(value);
|
package/dist/shapeRef.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_refResolveFns = require("./refResolveFns-
|
|
2
|
+
const require_refResolveFns = require("./refResolveFns-BiEBAREW.cjs");
|
|
3
3
|
exports.assignRoles = require_refResolveFns.assignRoles;
|
|
4
4
|
exports.captureHint = require_refResolveFns.captureHint;
|
|
5
5
|
exports.createDerivedFaceRef = require_refResolveFns.createDerivedFaceRef;
|
package/dist/shapeRef.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-
|
|
1
|
+
import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-Ck6kJzLE.js";
|
|
2
2
|
export { assignRoles, captureHint, createDerivedFaceRef, createEdgeRef, createRef, createVertexRef, defaultScorer, isDerivedFaceRef, isEdgeRef, isFaceRef, isLineageRef, isVertexRef, resolveDerivedFaceRef, resolveEdgeRef, resolveLineageRef, resolveRef, resolveRefIn, resolveRefParams, resolveVertexRef, updateRoles };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { B as createKernelHandle, R as DisposalScope, Y as _usingCtx, Z as getKernel, t as castShape } from "./shapeTypes-Dpu6mD3m.js";
|
|
1
|
+
import { B as createKernelHandle, R as DisposalScope, Y as _usingCtx, Z as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-Dpu6mD3m.js";
|
|
2
2
|
import { A as ok, T as isOk, b as err, d as validationError, n as computationError, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
|
|
4
4
|
import { y as fromBREP } from "./faceFns-B86WGqDg.js";
|
|
5
5
|
import { s as toBREP } from "./shapeFns-DrZOVwHX.js";
|
|
6
6
|
import { h as fuseAll } from "./solidBuilders-C32wXQWG.js";
|
|
7
7
|
import { t as loft } from "./loftFns-CmShFQlv.js";
|
|
8
|
+
import { c as resolveRefParams } from "./refResolveFns-Ck6kJzLE.js";
|
|
8
9
|
import { E as wire, h as line } from "./primitiveFns-CBrOyk5S.js";
|
|
9
10
|
//#region src/utils/uuid.ts
|
|
10
11
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
@@ -1300,6 +1301,22 @@ function registerOperation(registry, type, fn) {
|
|
|
1300
1301
|
return { operations: ops };
|
|
1301
1302
|
}
|
|
1302
1303
|
/**
|
|
1304
|
+
* Resolve any lineage refs in a step's params against its input shape, so an
|
|
1305
|
+
* operation re-targets the SAME entity (edge/face/vertex) after an upstream
|
|
1306
|
+
* parameter edit rebuilds the model. The stored step keeps its refs; resolution
|
|
1307
|
+
* happens fresh at replay.
|
|
1308
|
+
*
|
|
1309
|
+
* Only **single-input** steps auto-resolve: with multiple inputs we can't tell
|
|
1310
|
+
* which input a ref targets, and resolving against the wrong one could silently
|
|
1311
|
+
* return an entity from the wrong shape. Multi-input refs (and ref-free or non-3D
|
|
1312
|
+
* cases) are left raw for the operation to resolve against the input it chooses.
|
|
1313
|
+
*/
|
|
1314
|
+
function resolveStepParams(params, inputs) {
|
|
1315
|
+
const [primary, second] = inputs;
|
|
1316
|
+
if (primary !== void 0 && second === void 0 && isShape3D(primary)) return resolveRefParams(params, primary);
|
|
1317
|
+
return { ...params };
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1303
1320
|
* Replay an entire history from scratch using the given registry.
|
|
1304
1321
|
*
|
|
1305
1322
|
* All initial shapes (those not produced by any step) must already be in the
|
|
@@ -1323,7 +1340,7 @@ function replayHistory(history, registry) {
|
|
|
1323
1340
|
inputs.push(shape);
|
|
1324
1341
|
}
|
|
1325
1342
|
try {
|
|
1326
|
-
const output = fn(inputs, step.parameters);
|
|
1343
|
+
const output = fn(inputs, resolveStepParams(step.parameters, inputs));
|
|
1327
1344
|
current = addStep(current, {
|
|
1328
1345
|
id: step.id,
|
|
1329
1346
|
type: step.type,
|
|
@@ -1367,7 +1384,7 @@ function replayFrom(history, stepId, registry) {
|
|
|
1367
1384
|
inputs.push(shape);
|
|
1368
1385
|
}
|
|
1369
1386
|
try {
|
|
1370
|
-
const output = fn(inputs, step.parameters);
|
|
1387
|
+
const output = fn(inputs, resolveStepParams(step.parameters, inputs));
|
|
1371
1388
|
current = addStep(current, {
|
|
1372
1389
|
id: step.id,
|
|
1373
1390
|
type: step.type,
|
|
@@ -5,6 +5,7 @@ const require_faceFns = require("./faceFns-BV0GnTlt.cjs");
|
|
|
5
5
|
const require_shapeFns = require("./shapeFns-ybo0INGL.cjs");
|
|
6
6
|
const require_solidBuilders = require("./solidBuilders-DiUv_mD0.cjs");
|
|
7
7
|
const require_loftFns = require("./loftFns-fpTmrIdd.cjs");
|
|
8
|
+
const require_refResolveFns = require("./refResolveFns-BiEBAREW.cjs");
|
|
8
9
|
const require_primitiveFns = require("./primitiveFns-DLIWtQWA.cjs");
|
|
9
10
|
//#region src/utils/uuid.ts
|
|
10
11
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
@@ -1300,6 +1301,22 @@ function registerOperation(registry, type, fn) {
|
|
|
1300
1301
|
return { operations: ops };
|
|
1301
1302
|
}
|
|
1302
1303
|
/**
|
|
1304
|
+
* Resolve any lineage refs in a step's params against its input shape, so an
|
|
1305
|
+
* operation re-targets the SAME entity (edge/face/vertex) after an upstream
|
|
1306
|
+
* parameter edit rebuilds the model. The stored step keeps its refs; resolution
|
|
1307
|
+
* happens fresh at replay.
|
|
1308
|
+
*
|
|
1309
|
+
* Only **single-input** steps auto-resolve: with multiple inputs we can't tell
|
|
1310
|
+
* which input a ref targets, and resolving against the wrong one could silently
|
|
1311
|
+
* return an entity from the wrong shape. Multi-input refs (and ref-free or non-3D
|
|
1312
|
+
* cases) are left raw for the operation to resolve against the input it chooses.
|
|
1313
|
+
*/
|
|
1314
|
+
function resolveStepParams(params, inputs) {
|
|
1315
|
+
const [primary, second] = inputs;
|
|
1316
|
+
if (primary !== void 0 && second === void 0 && require_shapeTypes.isShape3D(primary)) return require_refResolveFns.resolveRefParams(params, primary);
|
|
1317
|
+
return { ...params };
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1303
1320
|
* Replay an entire history from scratch using the given registry.
|
|
1304
1321
|
*
|
|
1305
1322
|
* All initial shapes (those not produced by any step) must already be in the
|
|
@@ -1323,7 +1340,7 @@ function replayHistory(history, registry) {
|
|
|
1323
1340
|
inputs.push(shape);
|
|
1324
1341
|
}
|
|
1325
1342
|
try {
|
|
1326
|
-
const output = fn(inputs, step.parameters);
|
|
1343
|
+
const output = fn(inputs, resolveStepParams(step.parameters, inputs));
|
|
1327
1344
|
current = addStep(current, {
|
|
1328
1345
|
id: step.id,
|
|
1329
1346
|
type: step.type,
|
|
@@ -1367,7 +1384,7 @@ function replayFrom(history, stepId, registry) {
|
|
|
1367
1384
|
inputs.push(shape);
|
|
1368
1385
|
}
|
|
1369
1386
|
try {
|
|
1370
|
-
const output = fn(inputs, step.parameters);
|
|
1387
|
+
const output = fn(inputs, resolveStepParams(step.parameters, inputs));
|
|
1371
1388
|
current = addStep(current, {
|
|
1372
1389
|
id: step.id,
|
|
1373
1390
|
type: step.type,
|
|
@@ -45,9 +45,10 @@ export declare function resolveLineageRef(ref: LineageRef, roles: RoleTable, sha
|
|
|
45
45
|
export declare function resolveRefIn(ref: LineageRef, shape: Shape3D): LineageResolution;
|
|
46
46
|
/**
|
|
47
47
|
* Replace every lineage ref in an operation's params with the live entity it
|
|
48
|
-
* resolves to in `shape`, recursing into arrays (
|
|
49
|
-
*
|
|
50
|
-
* re-derived once per `origin` and
|
|
51
|
-
* replay engine pass stable entity
|
|
48
|
+
* resolves to in `shape`, recursing into arrays (a fillet's edge list) and
|
|
49
|
+
* nested plain objects (a `{ selection: { edge } }` options bag). Refs that
|
|
50
|
+
* can't resolve are left as-is. Role tables are re-derived once per `origin` and
|
|
51
|
+
* reused across the whole params map. Lets a replay engine pass stable entity
|
|
52
|
+
* selections that survive upstream edits.
|
|
52
53
|
*/
|
|
53
54
|
export declare function resolveRefParams(params: Readonly<Record<string, unknown>>, shape: Shape3D): Record<string, unknown>;
|