brepjs 13.4.0 → 14.1.2
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/2d.cjs +15 -14
- package/dist/2d.js +6 -5
- package/dist/arrayAccess-CmulMesb.cjs +40 -0
- package/dist/arrayAccess-xxcB3YNq.js +23 -0
- package/dist/{blueprint-CB_85Lz_.js → blueprint-B3A5x7P9.js} +9 -9
- package/dist/{blueprint-CDnBM-tA.cjs → blueprint-D0XChcek.cjs} +13 -13
- package/dist/{blueprintFns-DVDommWB.js → blueprintFns-BwAMXY3t.js} +4 -125
- package/dist/{blueprintFns-D4YucGaQ.cjs → blueprintFns-COrEYX29.cjs} +3 -142
- package/dist/{boolean2D-lqfKJKUY.cjs → boolean2D-BPsyKImE.cjs} +19 -18
- package/dist/{boolean2D-Mzp-0g7o.js → boolean2D-D_Te-6N6.js} +12 -11
- package/dist/{booleanFns-Bw8sAMgI.cjs → booleanFns-B6M6Lm0V.cjs} +24 -22
- package/dist/{booleanFns-B46fgObh.js → booleanFns-CgsaJFBf.js} +8 -6
- package/dist/brepjs.cjs +301 -90
- package/dist/brepjs.js +189 -26
- package/dist/constants-B9u763C3.js +9 -0
- package/dist/constants-unWN8k4c.cjs +26 -0
- package/dist/core/errors.d.ts +5 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +2 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -1
- package/dist/core.cjs +8 -7
- package/dist/core.js +5 -4
- package/dist/{cornerFinder-aBLykolI.js → cornerFinder-AEFnAxt4.js} +3 -3
- package/dist/{cornerFinder-BszIcLqj.cjs → cornerFinder-DTt_SvtC.cjs} +4 -4
- package/dist/{curveFns-DY4dFcP-.js → curveFns-CcInoOEA.js} +2 -2
- package/dist/{curveFns-CZszKLQB.cjs → curveFns-DCEcwcpd.cjs} +2 -2
- package/dist/{drawFns-BHNDF8hb.cjs → drawFns-BOwBIzPa.cjs} +34 -17
- package/dist/{drawFns-l5CY2s-l.js → drawFns-n9qif7QN.js} +16 -14
- package/dist/{errors-BlC5ZWv4.cjs → errors-9zQcQK1H.cjs} +28 -0
- package/dist/{errors-BVOlxlIA.js → errors-C-cgQA3w.js} +23 -1
- package/dist/{extrudeFns-b0uLn4E4.js → extrudeFns-DrDr9-nU.js} +3 -3
- package/dist/{extrudeFns-GpCB_Uzs.cjs → extrudeFns-Rcut7h8S.cjs} +3 -3
- package/dist/{faceFns-Cat-4X74.js → faceFns-TSH54pPQ.js} +93 -3
- package/dist/{faceFns-BywUjlJ7.cjs → faceFns-cE2WxY6I.cjs} +110 -2
- package/dist/{helpers-1iCCEElA.cjs → helpers-DZje6XWE.cjs} +18 -17
- package/dist/{helpers-DgX1UucG.js → helpers-XrXlKm8D.js} +8 -7
- package/dist/{historyFns-BFwp8NLX.js → historyFns-2hCWrX_X.js} +10 -10
- package/dist/{historyFns-DqxDtXIZ.cjs → historyFns-BiQ9dmzp.cjs} +10 -10
- package/dist/{importFns-ChXEJAvu.cjs → importFns-DGE5nCSW.cjs} +4 -4
- package/dist/{importFns-Cb8fcldB.js → importFns-m0xyj0Zt.js} +4 -4
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/brepkitAdapter.d.ts +149 -242
- package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkit/evolutionOps.d.ts +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -1
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/{measureFns-D3rAp1X1.js → measureFns-DHByqdmn.js} +9 -16
- package/dist/{measureFns-Bx-kl7_g.cjs → measureFns-D_QKZ5yg.cjs} +9 -16
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-D3KAZ_ma.cjs → meshFns-CVe3Kc77.cjs} +4 -4
- package/dist/{meshFns-BPi0bhm9.js → meshFns-DL4Djz3w.js} +3 -3
- package/dist/ns/booleans.d.ts +10 -0
- package/dist/ns/booleans.d.ts.map +1 -0
- package/dist/ns/construction.d.ts +10 -0
- package/dist/ns/construction.d.ts.map +1 -0
- package/dist/ns/ioNs.d.ts +18 -0
- package/dist/ns/ioNs.d.ts.map +1 -0
- package/dist/ns/measurement.d.ts +6 -0
- package/dist/ns/measurement.d.ts.map +1 -0
- package/dist/ns/modifiers.d.ts +6 -0
- package/dist/ns/modifiers.d.ts.map +1 -0
- package/dist/ns/patterns.d.ts +5 -0
- package/dist/ns/patterns.d.ts.map +1 -0
- package/dist/ns/primitives.d.ts +7 -0
- package/dist/ns/primitives.d.ts.map +1 -0
- package/dist/ns/query.d.ts +6 -0
- package/dist/ns/query.d.ts.map +1 -0
- package/dist/ns/transforms.d.ts +5 -0
- package/dist/ns/transforms.d.ts.map +1 -0
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{planeOps-BqLav0Ir.cjs → planeOps-6Wu7dMDN.cjs} +4 -3
- package/dist/{planeOps-D88tfyJs.js → planeOps-gTOEarV2.js} +3 -2
- package/dist/{primitiveFns-BGh9A9jR.cjs → primitiveFns-CRPGjIFg.cjs} +69 -69
- package/dist/{primitiveFns-CnZkW6Bi.js → primitiveFns-CeKiYSSW.js} +7 -7
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{arrayAccess-B5LgmXBo.js → shapeFns-DCi9O27X.js} +8 -30
- package/dist/{arrayAccess-t2dlxGSK.cjs → shapeFns-aEeSHNqX.cjs} +24 -64
- package/dist/shapeRef.cjs +8 -0
- package/dist/shapeRef.d.ts +5 -0
- package/dist/shapeRef.d.ts.map +1 -0
- package/dist/shapeRef.js +2 -0
- package/dist/shapeRefFns-B1TODUMl.js +194 -0
- package/dist/shapeRefFns-CVdS6jWS.cjs +229 -0
- package/dist/{shapeTypes-Di6GlhPk.js → shapeTypes-BO1aiDhi.js} +2642 -2546
- package/dist/{shapeTypes-8eK48l-X.cjs → shapeTypes-BqWQlrYE.cjs} +2642 -2546
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-D9KYP9sL.cjs → solidBuilders-0iVdiZUw.cjs} +3 -3
- package/dist/{solidBuilders-ctO_wFrm.js → solidBuilders-jk7HfWs8.js} +3 -3
- package/dist/{surfaceBuilders-CZzipftq.cjs → surfaceBuilders-C_8rs79F.cjs} +3 -3
- package/dist/{surfaceBuilders-BaqeZa0x.js → surfaceBuilders-DE5e6bp8.js} +3 -3
- package/dist/topology/api.d.ts +3 -3
- package/dist/topology/api.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts +4 -3
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeRef/index.d.ts +7 -0
- package/dist/topology/shapeRef/index.d.ts.map +1 -0
- package/dist/topology/shapeRef/scoring.d.ts +16 -0
- package/dist/topology/shapeRef/scoring.d.ts.map +1 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts +47 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts.map +1 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts +40 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +1 -0
- package/dist/topology.cjs +20 -20
- package/dist/topology.js +6 -6
- package/dist/{vecOps-DKGelwGL.cjs → vecOps-BXvBYIor.cjs} +0 -26
- package/dist/{vecOps-DFfUfsmc.js → vecOps-D9etjPgV.js} +1 -9
- package/dist/vectors.cjs +5 -4
- package/dist/vectors.js +3 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +14 -4
- /package/dist/{workerHandler-nLkvSOKX.cjs → workerHandler-C-7OUJsa.cjs} +0 -0
- /package/dist/{workerHandler-BrOTzYRI.js → workerHandler-o2xzAfFk.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
7
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
|
+
const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
|
|
4
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
5
|
+
const require_shapeFns = require("./shapeFns-aEeSHNqX.cjs");
|
|
6
|
+
const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
|
|
7
|
+
const require_solidBuilders = require("./solidBuilders-0iVdiZUw.cjs");
|
|
8
8
|
//#region src/topology/threeHelpers.ts
|
|
9
9
|
/**
|
|
10
10
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -135,7 +135,7 @@ function deduplicatedSubShapes(parentKernel, type) {
|
|
|
135
135
|
const results = [];
|
|
136
136
|
const seen = /* @__PURE__ */ new Map();
|
|
137
137
|
for (const item of items) {
|
|
138
|
-
const hash = kernel.hashCode(item,
|
|
138
|
+
const hash = kernel.hashCode(item, require_constants.HASH_CODE_MAX);
|
|
139
139
|
const bucket = seen.get(hash);
|
|
140
140
|
if (!bucket) {
|
|
141
141
|
seen.set(hash, [item]);
|
|
@@ -153,7 +153,7 @@ function deduplicatedSubShapes(parentKernel, type) {
|
|
|
153
153
|
* face so facesOfEdge can verify via isSame without re-extracting face edges.
|
|
154
154
|
*/
|
|
155
155
|
function getEdgeToFacesMap(parent) {
|
|
156
|
-
const cache =
|
|
156
|
+
const cache = require_shapeFns.getOrCreateCache(parent);
|
|
157
157
|
if (cache.edgeToFaces) return cache.edgeToFaces;
|
|
158
158
|
const kernel = require_shapeTypes.getKernel();
|
|
159
159
|
const edgeToFaces = /* @__PURE__ */ new Map();
|
|
@@ -161,7 +161,7 @@ function getEdgeToFacesMap(parent) {
|
|
|
161
161
|
for (const f of allFaces) {
|
|
162
162
|
const edges = kernel.iterShapes(f, "edge");
|
|
163
163
|
for (const e of edges) {
|
|
164
|
-
const hash = kernel.hashCode(e,
|
|
164
|
+
const hash = kernel.hashCode(e, require_constants.HASH_CODE_MAX);
|
|
165
165
|
let bucket = edgeToFaces.get(hash);
|
|
166
166
|
if (!bucket) {
|
|
167
167
|
bucket = [];
|
|
@@ -189,13 +189,13 @@ function getEdgeToFacesMap(parent) {
|
|
|
189
189
|
function facesOfEdge(parent, edge) {
|
|
190
190
|
const kernel = require_shapeTypes.getKernel();
|
|
191
191
|
const edgeToFaces = getEdgeToFacesMap(parent);
|
|
192
|
-
const hash = kernel.hashCode(edge.wrapped,
|
|
192
|
+
const hash = kernel.hashCode(edge.wrapped, require_constants.HASH_CODE_MAX);
|
|
193
193
|
const bucket = edgeToFaces.get(hash) ?? [];
|
|
194
194
|
const results = [];
|
|
195
195
|
const seen = /* @__PURE__ */ new Map();
|
|
196
196
|
for (const entry of bucket) {
|
|
197
197
|
if (!kernel.isSame(entry.edge, edge.wrapped)) continue;
|
|
198
|
-
const fHash = kernel.hashCode(entry.face,
|
|
198
|
+
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
199
199
|
const fBucket = seen.get(fHash);
|
|
200
200
|
if (!fBucket) {
|
|
201
201
|
seen.set(fHash, [entry.face]);
|
|
@@ -251,11 +251,11 @@ function adjacentFaces(parent, face) {
|
|
|
251
251
|
const neighborRaw = [];
|
|
252
252
|
const seen = /* @__PURE__ */ new Map();
|
|
253
253
|
for (const edgeHandle of faceEdgeHandles) {
|
|
254
|
-
const hash = kernel.hashCode(edgeHandle.wrapped,
|
|
254
|
+
const hash = kernel.hashCode(edgeHandle.wrapped, require_constants.HASH_CODE_MAX);
|
|
255
255
|
const entries = edgeToFaces.get(hash) ?? [];
|
|
256
256
|
for (const entry of entries) {
|
|
257
257
|
if (kernel.isSame(entry.face, face.wrapped)) continue;
|
|
258
|
-
const fHash = kernel.hashCode(entry.face,
|
|
258
|
+
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
259
259
|
const bucket = seen.get(fHash);
|
|
260
260
|
if (!bucket) {
|
|
261
261
|
seen.set(fHash, [entry.face]);
|
|
@@ -281,7 +281,7 @@ function sharedEdges(face1, face2) {
|
|
|
281
281
|
const edges2 = kernel.iterShapes(face2.wrapped, "edge");
|
|
282
282
|
const edge2Map = /* @__PURE__ */ new Map();
|
|
283
283
|
for (const e2 of edges2) {
|
|
284
|
-
const hash = kernel.hashCode(e2,
|
|
284
|
+
const hash = kernel.hashCode(e2, require_constants.HASH_CODE_MAX);
|
|
285
285
|
let bucket = edge2Map.get(hash);
|
|
286
286
|
if (!bucket) {
|
|
287
287
|
bucket = [];
|
|
@@ -380,7 +380,7 @@ function resolveEdgeCallback$1(selectedEdges, callbackFn) {
|
|
|
380
380
|
if (typeof val === "number" && val <= 0) continue;
|
|
381
381
|
if (Array.isArray(val) && (val[0] <= 0 || val[1] <= 0)) continue;
|
|
382
382
|
filteredEdges.push(edge);
|
|
383
|
-
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped,
|
|
383
|
+
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped, require_constants.HASH_CODE_MAX), val);
|
|
384
384
|
}
|
|
385
385
|
if (filteredEdges.length === 0) return null;
|
|
386
386
|
const kernelParam = (ocEdge) => {
|
|
@@ -397,15 +397,15 @@ function fuseWithEvolution(a, b, { optimisation = "none", simplify = false, sign
|
|
|
397
397
|
if (require_errors.isErr(checkA)) return checkA;
|
|
398
398
|
const checkB = validateShape3D(b, "fuseWithEvolution: second operand");
|
|
399
399
|
if (require_errors.isErr(checkB)) return checkB;
|
|
400
|
-
const inputFaceHashes =
|
|
401
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
400
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
401
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
402
402
|
optimisation,
|
|
403
403
|
simplify,
|
|
404
404
|
fuzzyValue
|
|
405
405
|
});
|
|
406
406
|
const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape", "Common causes: overlapping coplanar faces, zero-thickness geometry, or non-manifold input. Try autoHeal() on inputs first.");
|
|
407
407
|
if (fuseResult.ok) {
|
|
408
|
-
|
|
408
|
+
require_shapeFns.propagateAllMetadata(evolution, [a, b], fuseResult.value);
|
|
409
409
|
return require_errors.ok({
|
|
410
410
|
shape: fuseResult.value,
|
|
411
411
|
evolution
|
|
@@ -419,15 +419,15 @@ function cutWithEvolution(base, tool, { optimisation = "none", simplify = false,
|
|
|
419
419
|
if (require_errors.isErr(checkBase)) return checkBase;
|
|
420
420
|
const checkTool = validateShape3D(tool, "cutWithEvolution: tool");
|
|
421
421
|
if (require_errors.isErr(checkTool)) return checkTool;
|
|
422
|
-
const inputFaceHashes =
|
|
423
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes,
|
|
422
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([base, tool]);
|
|
423
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
424
424
|
optimisation,
|
|
425
425
|
simplify,
|
|
426
426
|
fuzzyValue
|
|
427
427
|
});
|
|
428
428
|
const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape", "Common causes: tool does not fully intersect the base, or produces a zero-thickness sliver. Ensure the tool extends through the shape.");
|
|
429
429
|
if (cutResult.ok) {
|
|
430
|
-
|
|
430
|
+
require_shapeFns.propagateAllMetadata(evolution, [base, tool], cutResult.value);
|
|
431
431
|
return require_errors.ok({
|
|
432
432
|
shape: cutResult.value,
|
|
433
433
|
evolution
|
|
@@ -441,14 +441,14 @@ function intersectWithEvolution(a, b, { simplify = false, signal, fuzzyValue } =
|
|
|
441
441
|
if (require_errors.isErr(checkA)) return checkA;
|
|
442
442
|
const checkB = validateShape3D(b, "intersectWithEvolution: second operand");
|
|
443
443
|
if (require_errors.isErr(checkB)) return checkB;
|
|
444
|
-
const inputFaceHashes =
|
|
445
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
444
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
445
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
446
446
|
simplify,
|
|
447
447
|
fuzzyValue
|
|
448
448
|
});
|
|
449
449
|
const intResult = castToShape3D(resultShape, "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape", "Shapes may not overlap. Verify they share a common volume before intersecting.");
|
|
450
450
|
if (intResult.ok) {
|
|
451
|
-
|
|
451
|
+
require_shapeFns.propagateAllMetadata(evolution, [a, b], intResult.value);
|
|
452
452
|
return require_errors.ok({
|
|
453
453
|
shape: intResult.value,
|
|
454
454
|
evolution
|
|
@@ -469,7 +469,7 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
469
469
|
if (require_errors.isErr(check)) return check;
|
|
470
470
|
if (typeof radius === "number" && radius <= 0) return require_errors.err(require_errors.validationError("INVALID_FILLET_RADIUS", "Fillet radius must be positive", void 0, void 0, "Provide a positive radius value greater than 0"));
|
|
471
471
|
if (Array.isArray(radius) && (radius[0] <= 0 || radius[1] <= 0)) return require_errors.err(require_errors.validationError("INVALID_FILLET_RADIUS", "Fillet radii must both be positive", void 0, void 0, "Both radius values must be greater than 0"));
|
|
472
|
-
const selectedEdges = edges ??
|
|
472
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
473
473
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FILLET_NO_EDGES, "No edges found for fillet", void 0, void 0, "Check that the shape has edges, or adjust your edge finder criteria"));
|
|
474
474
|
try {
|
|
475
475
|
let filteredEdges;
|
|
@@ -483,11 +483,11 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
483
483
|
filteredEdges = [...selectedEdges];
|
|
484
484
|
kernelRadius = radius;
|
|
485
485
|
}
|
|
486
|
-
const inputFaceHashes =
|
|
487
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes,
|
|
486
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
487
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
488
488
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
489
489
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
490
|
-
|
|
490
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
491
491
|
return require_errors.ok({
|
|
492
492
|
shape: cast,
|
|
493
493
|
evolution
|
|
@@ -513,7 +513,7 @@ function chamferWithEvolution(shape, edges, distance) {
|
|
|
513
513
|
if (require_errors.isErr(check)) return check;
|
|
514
514
|
if (typeof distance === "number" && distance <= 0) return require_errors.err(require_errors.validationError("INVALID_CHAMFER_DISTANCE", "Chamfer distance must be positive", void 0, void 0, "Provide a positive distance value greater than 0"));
|
|
515
515
|
if (Array.isArray(distance) && (distance[0] <= 0 || distance[1] <= 0)) return require_errors.err(require_errors.validationError("INVALID_CHAMFER_DISTANCE", "Chamfer distances must both be positive", void 0, void 0, "Both distance values must be greater than 0"));
|
|
516
|
-
const selectedEdges = edges ??
|
|
516
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
517
517
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
518
518
|
try {
|
|
519
519
|
let filteredEdges;
|
|
@@ -527,11 +527,11 @@ function chamferWithEvolution(shape, edges, distance) {
|
|
|
527
527
|
filteredEdges = [...selectedEdges];
|
|
528
528
|
kernelDistance = distance;
|
|
529
529
|
}
|
|
530
|
-
const inputFaceHashes =
|
|
531
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes,
|
|
530
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
531
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
532
532
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
533
533
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
534
|
-
|
|
534
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
535
535
|
return require_errors.ok({
|
|
536
536
|
shape: cast,
|
|
537
537
|
evolution
|
|
@@ -559,11 +559,11 @@ function shellWithEvolution(shape, faces, thickness, tolerance = .001) {
|
|
|
559
559
|
if (thickness <= 0) return require_errors.err(require_errors.validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
560
560
|
if (faces.length === 0) return require_errors.err(require_errors.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
561
561
|
try {
|
|
562
|
-
const inputFaceHashes =
|
|
563
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes,
|
|
562
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
563
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
564
564
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
565
565
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
566
|
-
|
|
566
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
567
567
|
return require_errors.ok({
|
|
568
568
|
shape: cast,
|
|
569
569
|
evolution
|
|
@@ -636,7 +636,7 @@ function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
|
636
636
|
if (typeof val === "number" && val <= 0) continue;
|
|
637
637
|
if (Array.isArray(val) && (val[0] <= 0 || val[1] <= 0)) continue;
|
|
638
638
|
filteredEdges.push(edge);
|
|
639
|
-
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped,
|
|
639
|
+
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped, require_constants.HASH_CODE_MAX), val);
|
|
640
640
|
}
|
|
641
641
|
if (filteredEdges.length === 0) return null;
|
|
642
642
|
const kernelParam = (ocEdge) => {
|
|
@@ -654,7 +654,7 @@ function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
|
654
654
|
function finalizeShape3D(evolution, resultShape, inputs, not3dCode, not3dMessage) {
|
|
655
655
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
656
656
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(not3dCode, not3dMessage));
|
|
657
|
-
|
|
657
|
+
require_shapeFns.propagateAllMetadata(evolution, inputs, cast);
|
|
658
658
|
return require_errors.ok(cast);
|
|
659
659
|
}
|
|
660
660
|
/**
|
|
@@ -672,10 +672,10 @@ function resolveDraftCallback(faces, angle) {
|
|
|
672
672
|
const a = angle(face);
|
|
673
673
|
if (a === null || a === 0 || Math.abs(a) >= 90) continue;
|
|
674
674
|
filteredFaces.push(face);
|
|
675
|
-
hashToAngle.set(require_shapeTypes.getKernel().hashCode(face.wrapped,
|
|
675
|
+
hashToAngle.set(require_shapeTypes.getKernel().hashCode(face.wrapped, require_constants.HASH_CODE_MAX), a);
|
|
676
676
|
}
|
|
677
677
|
const kernelAngle = (ocFace) => {
|
|
678
|
-
const a = hashToAngle.get(ocFace.HashCode(
|
|
678
|
+
const a = hashToAngle.get(ocFace.HashCode(require_constants.HASH_CODE_MAX));
|
|
679
679
|
if (a === void 0) throw new Error("draft: face hash not found — possible hash collision");
|
|
680
680
|
return a;
|
|
681
681
|
};
|
|
@@ -695,10 +695,10 @@ function thicken(shape, thickness) {
|
|
|
695
695
|
const check = validateNotNull(shape, "thicken: shape");
|
|
696
696
|
if (require_errors.isErr(check)) return check;
|
|
697
697
|
try {
|
|
698
|
-
const inputFaceHashes =
|
|
699
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes,
|
|
698
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
699
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
700
700
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
701
|
-
|
|
701
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
702
702
|
return require_errors.ok(cast);
|
|
703
703
|
} catch (e) {
|
|
704
704
|
return require_errors.err(require_errors.kernelError("THICKEN_FAILED", `Thicken operation failed: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
@@ -722,7 +722,7 @@ function fillet(shape, edges, radius) {
|
|
|
722
722
|
pairHint: "Both radius values must be greater than 0"
|
|
723
723
|
});
|
|
724
724
|
if (paramErr) return paramErr;
|
|
725
|
-
const selectedEdges = edges ??
|
|
725
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
726
726
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FILLET_NO_EDGES, "No edges found for fillet", void 0, void 0, "Check that the shape has edges, or adjust your edge finder criteria"));
|
|
727
727
|
try {
|
|
728
728
|
let filteredEdges;
|
|
@@ -736,8 +736,8 @@ function fillet(shape, edges, radius) {
|
|
|
736
736
|
filteredEdges = [...selectedEdges];
|
|
737
737
|
kernelRadius = radius;
|
|
738
738
|
}
|
|
739
|
-
const inputFaceHashes =
|
|
740
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes,
|
|
739
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
740
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
741
741
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
|
|
742
742
|
} catch (e) {
|
|
743
743
|
return require_errors.err(require_errors.kernelError("FILLET_FAILED", `Fillet operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
@@ -765,7 +765,7 @@ function chamfer(shape, edges, distance) {
|
|
|
765
765
|
pairHint: "Both distance values must be greater than 0"
|
|
766
766
|
});
|
|
767
767
|
if (paramErr) return paramErr;
|
|
768
|
-
const selectedEdges = edges ??
|
|
768
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
769
769
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
770
770
|
try {
|
|
771
771
|
let filteredEdges;
|
|
@@ -779,8 +779,8 @@ function chamfer(shape, edges, distance) {
|
|
|
779
779
|
filteredEdges = [...selectedEdges];
|
|
780
780
|
kernelDistance = distance;
|
|
781
781
|
}
|
|
782
|
-
const inputFaceHashes =
|
|
783
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes,
|
|
782
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
783
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
784
784
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape");
|
|
785
785
|
} catch (e) {
|
|
786
786
|
return require_errors.err(require_errors.kernelError("CHAMFER_FAILED", `Chamfer operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
@@ -804,11 +804,11 @@ function shell(shape, faces, thickness, tolerance = .001) {
|
|
|
804
804
|
if (thickness <= 0) return require_errors.err(require_errors.validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
805
805
|
if (faces.length === 0) return require_errors.err(require_errors.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
806
806
|
try {
|
|
807
|
-
const inputFaceHashes =
|
|
808
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes,
|
|
807
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
808
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
809
809
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
810
810
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
811
|
-
|
|
811
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
812
812
|
return require_errors.ok(cast);
|
|
813
813
|
} catch (e) {
|
|
814
814
|
return require_errors.err(require_errors.kernelError("SHELL_FAILED", `Shell operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
@@ -830,11 +830,11 @@ function offset(shape, distance, tolerance = 1e-6) {
|
|
|
830
830
|
if (require_errors.isErr(check)) return check;
|
|
831
831
|
if (distance === 0) return require_errors.err(require_errors.validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
832
832
|
try {
|
|
833
|
-
const inputFaceHashes =
|
|
834
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes,
|
|
833
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
834
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
835
835
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
836
836
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
837
|
-
|
|
837
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
838
838
|
return require_errors.ok(cast);
|
|
839
839
|
} catch (e) {
|
|
840
840
|
return require_errors.err(require_errors.kernelError("OFFSET_FAILED", `Offset operation failed: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
@@ -864,7 +864,7 @@ function draft(shape, faces, pullDirection, neutralPlane, angle) {
|
|
|
864
864
|
try {
|
|
865
865
|
const { filteredFaces, kernelAngle } = resolveDraftCallback(faces, angle);
|
|
866
866
|
if (filteredFaces.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.DRAFT_NO_FACES, "No faces with valid draft angle", void 0, void 0, "Check that the angle callback returns non-zero values between -90 and 90 degrees"));
|
|
867
|
-
const inputFaceHashes =
|
|
867
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
868
868
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().draftWithHistory(shape.wrapped, filteredFaces.map((f) => f.wrapped), [
|
|
869
869
|
pullDirection[0],
|
|
870
870
|
pullDirection[1],
|
|
@@ -873,7 +873,7 @@ function draft(shape, faces, pullDirection, neutralPlane, angle) {
|
|
|
873
873
|
neutralPlane[0],
|
|
874
874
|
neutralPlane[1],
|
|
875
875
|
neutralPlane[2]
|
|
876
|
-
], kernelAngle, inputFaceHashes,
|
|
876
|
+
], kernelAngle, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
877
877
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.DRAFT_NOT_3D, "Draft result is not a 3D shape");
|
|
878
878
|
} catch (e) {
|
|
879
879
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -899,7 +899,7 @@ function variableFillet(shape, edge, radii) {
|
|
|
899
899
|
const kernel = require_shapeTypes.getKernel();
|
|
900
900
|
try {
|
|
901
901
|
const spec = JSON.stringify({
|
|
902
|
-
edge: kernel.hashCode(edge.wrapped,
|
|
902
|
+
edge: kernel.hashCode(edge.wrapped, require_constants.HASH_CODE_MAX),
|
|
903
903
|
radii: radii.map((r) => ({
|
|
904
904
|
param: r.param,
|
|
905
905
|
radius: r.radius
|
|
@@ -1030,8 +1030,8 @@ function autoHeal(shape, options) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
});
|
|
1032
1032
|
steps.push("Shape invalid — applying shape-level healing");
|
|
1033
|
-
const wiresBefore =
|
|
1034
|
-
const facesBefore =
|
|
1033
|
+
const wiresBefore = require_shapeFns.getWires(shape).length;
|
|
1034
|
+
const facesBefore = require_shapeFns.getFaces(shape).length;
|
|
1035
1035
|
let current = shape;
|
|
1036
1036
|
let solidHealed = false;
|
|
1037
1037
|
if (sewTolerance !== void 0) try {
|
|
@@ -1054,7 +1054,7 @@ function autoHeal(shape, options) {
|
|
|
1054
1054
|
});
|
|
1055
1055
|
}
|
|
1056
1056
|
if (fixSelfIntersection && fixWires) {
|
|
1057
|
-
const wires =
|
|
1057
|
+
const wires = require_shapeFns.getWires(current);
|
|
1058
1058
|
let fixCount = 0;
|
|
1059
1059
|
for (const wire of wires) try {
|
|
1060
1060
|
require_shapeTypes.getKernel().fixSelfIntersection(wire.wrapped);
|
|
@@ -1109,8 +1109,8 @@ function autoHeal(shape, options) {
|
|
|
1109
1109
|
succeeded: false,
|
|
1110
1110
|
detail: "skipped by options"
|
|
1111
1111
|
});
|
|
1112
|
-
const wiresAfter =
|
|
1113
|
-
const facesAfter =
|
|
1112
|
+
const wiresAfter = require_shapeFns.getWires(current).length;
|
|
1113
|
+
const facesAfter = require_shapeFns.getFaces(current).length;
|
|
1114
1114
|
const wiresHealed = Math.abs(wiresAfter - wiresBefore);
|
|
1115
1115
|
const facesHealed = Math.abs(facesAfter - facesBefore);
|
|
1116
1116
|
if (wiresHealed > 0) steps.push(`Wire count changed by ${wiresHealed}`);
|
|
@@ -1191,7 +1191,7 @@ function box(width, depth, height, options) {
|
|
|
1191
1191
|
0,
|
|
1192
1192
|
0
|
|
1193
1193
|
] : void 0);
|
|
1194
|
-
if (center) return
|
|
1194
|
+
if (center) return require_shapeFns.translate(solid, [
|
|
1195
1195
|
center[0] - width / 2,
|
|
1196
1196
|
center[1] - depth / 2,
|
|
1197
1197
|
center[2] - height / 2
|
|
@@ -1219,7 +1219,7 @@ function cylinder(radius, height, options) {
|
|
|
1219
1219
|
-axis[1] * height * .5,
|
|
1220
1220
|
-axis[2] * height * .5
|
|
1221
1221
|
];
|
|
1222
|
-
solid =
|
|
1222
|
+
solid = require_shapeFns.translate(solid, halfShift);
|
|
1223
1223
|
}
|
|
1224
1224
|
return solid;
|
|
1225
1225
|
}
|
|
@@ -1228,7 +1228,7 @@ function cylinder(radius, height, options) {
|
|
|
1228
1228
|
*/
|
|
1229
1229
|
function sphere(radius, options) {
|
|
1230
1230
|
let solid = require_solidBuilders.makeSphere(radius);
|
|
1231
|
-
if (options?.at) solid =
|
|
1231
|
+
if (options?.at) solid = require_shapeFns.translate(solid, options.at);
|
|
1232
1232
|
return solid;
|
|
1233
1233
|
}
|
|
1234
1234
|
/**
|
|
@@ -1256,7 +1256,7 @@ function cone(bottomRadius, topRadius, height, options) {
|
|
|
1256
1256
|
-axis[1] * height * .5,
|
|
1257
1257
|
-axis[2] * height * .5
|
|
1258
1258
|
];
|
|
1259
|
-
solid =
|
|
1259
|
+
solid = require_shapeFns.translate(solid, halfShift);
|
|
1260
1260
|
}
|
|
1261
1261
|
return solid;
|
|
1262
1262
|
}
|
|
@@ -1283,7 +1283,7 @@ function torus(majorRadius, minorRadius, options) {
|
|
|
1283
1283
|
*/
|
|
1284
1284
|
function ellipsoid(rx, ry, rz, options) {
|
|
1285
1285
|
let solid = require_solidBuilders.makeEllipsoid(rx, ry, rz);
|
|
1286
|
-
if (options?.at) solid =
|
|
1286
|
+
if (options?.at) solid = require_shapeFns.translate(solid, options.at);
|
|
1287
1287
|
return solid;
|
|
1288
1288
|
}
|
|
1289
1289
|
/** Create a straight edge between two 3D points. */
|
|
@@ -1356,7 +1356,7 @@ function ellipseArc(majorRadius, minorRadius, startAngle, endAngle, options) {
|
|
|
1356
1356
|
0,
|
|
1357
1357
|
1
|
|
1358
1358
|
];
|
|
1359
|
-
return require_surfaceBuilders.makeEllipseArc(majorRadius, minorRadius, startAngle *
|
|
1359
|
+
return require_surfaceBuilders.makeEllipseArc(majorRadius, minorRadius, startAngle * require_constants.DEG2RAD, endAngle * require_constants.DEG2RAD, options?.at ?? [
|
|
1360
1360
|
0,
|
|
1361
1361
|
0,
|
|
1362
1362
|
0
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Y as getKernel, _ as isSolid, c as createSolid, h as isShape3D, p as isFace, r as castShapeWithKnownType, t as castShape, x as isClosedWire, y as isWire } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeEllipse, f as makeEllipseArc, g as makeThreePointArc, h as makeTangentArc, i as makeNewFaceWithinFace, l as makeBezierCurve, m as makeLine, o as makePolygon, p as makeHelix, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeCircle } from "./surfaceBuilders-
|
|
7
|
-
import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-
|
|
1
|
+
import { Y as getKernel, _ as isSolid, c as createSolid, h as isShape3D, p as isFace, r as castShapeWithKnownType, t as castShape, x as isClosedWire, y as isWire } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, T as isOk, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, v as andThen, w as isErr } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { _ as downcast } from "./faceFns-TSH54pPQ.js";
|
|
4
|
+
import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-B9u763C3.js";
|
|
5
|
+
import { I as getWires, M as getEdges, N as getFaces, P as getOrCreateCache, _ as propagateAllMetadata, g as collectInputFaceHashes, h as translate } from "./shapeFns-DCi9O27X.js";
|
|
6
|
+
import { a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeEllipse, f as makeEllipseArc, g as makeThreePointArc, h as makeTangentArc, i as makeNewFaceWithinFace, l as makeBezierCurve, m as makeLine, o as makePolygon, p as makeHelix, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeCircle } from "./surfaceBuilders-DE5e6bp8.js";
|
|
7
|
+
import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-jk7HfWs8.js";
|
|
8
8
|
//#region src/topology/threeHelpers.ts
|
|
9
9
|
/**
|
|
10
10
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
package/dist/query.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_helpers = require("./helpers-
|
|
3
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
2
|
+
const require_helpers = require("./helpers-DZje6XWE.cjs");
|
|
3
|
+
const require_cornerFinder = require("./cornerFinder-DTt_SvtC.cjs");
|
|
4
4
|
exports.cornerFinder = require_cornerFinder.cornerFinder;
|
|
5
5
|
exports.edgeFinder = require_helpers.edgeFinder;
|
|
6
6
|
exports.faceFinder = require_helpers.faceFinder;
|
package/dist/query.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-
|
|
2
|
-
import { t as cornerFinder } from "./cornerFinder-
|
|
1
|
+
import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-XrXlKm8D.js";
|
|
2
|
+
import { t as cornerFinder } from "./cornerFinder-AEFnAxt4.js";
|
|
3
3
|
export { cornerFinder, edgeFinder, faceFinder, getSingleFace };
|
package/dist/result.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("./errors-
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
3
|
exports.BrepBugError = require_errors.BrepBugError;
|
|
4
4
|
exports.BrepErrorCode = require_errors.BrepErrorCode;
|
|
5
5
|
exports.OK = require_errors.OK;
|
package/dist/result.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as ok, B as unwrapOr, E as map, I as tryCatch, L as tryCatchAsync, N as pipeline, O as mapErr, R as unwrap, T as isOk, V as unwrapOrElse, a as moduleInitError, b as err, c as sketcherStateError, d as validationError, g as OK, h as bug, i as kernelError, k as match, l as typeCastError, m as BrepBugError, n as computationError, o as queryError, r as ioError, t as BrepErrorCode, v as andThen, w as isErr, x as flatMap, y as collect, z as unwrapErr } from "./errors-C-cgQA3w.js";
|
|
2
2
|
export { BrepBugError, BrepErrorCode, OK, andThen, bug, collect, computationError, err, flatMap, ioError, isErr, isOk, kernelError, map, mapErr, match, moduleInitError, ok, pipeline, queryError, sketcherStateError, tryCatch, tryCatchAsync, typeCastError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, validationError };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Y as getKernel, r as castShapeWithKnownType, t as castShape } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Y as getKernel, r as castShapeWithKnownType, t as castShape } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { C as kernelCallRaw, S as kernelCall } from "./faceFns-TSH54pPQ.js";
|
|
4
|
+
import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-B9u763C3.js";
|
|
5
5
|
//#region src/topology/topologyQueryFns.ts
|
|
6
6
|
/**
|
|
7
7
|
* Topology query functions — extract sub-shapes, compute bounds, and
|
|
@@ -741,11 +741,11 @@ function transformCopy(shape, composed) {
|
|
|
741
741
|
*/
|
|
742
742
|
/** Clone a shape (deep copy via kernel topology downcast). */
|
|
743
743
|
function clone(shape) {
|
|
744
|
-
return
|
|
744
|
+
return kernelCall(() => getKernel().downcast(shape.wrapped), BrepErrorCode.CLONE_FAILED, "Failed to clone shape");
|
|
745
745
|
}
|
|
746
746
|
/** Serialize a shape to BREP string format. */
|
|
747
747
|
function toBREP(shape) {
|
|
748
|
-
return getKernel().toBREP(shape.wrapped);
|
|
748
|
+
return kernelCallRaw(() => getKernel().toBREP(shape.wrapped), BrepErrorCode.TO_BREP_FAILED, "Failed to serialize shape to BREP");
|
|
749
749
|
}
|
|
750
750
|
/** Get the topology hash code of a shape. */
|
|
751
751
|
function getHashCode(shape) {
|
|
@@ -765,29 +765,7 @@ function isEqualShape(a, b) {
|
|
|
765
765
|
}
|
|
766
766
|
/** Simplify a shape by merging same-domain faces/edges. Returns a new shape. */
|
|
767
767
|
function simplify(shape) {
|
|
768
|
-
return
|
|
768
|
+
return kernelCall(() => getKernel().simplify(shape.wrapped), BrepErrorCode.SIMPLIFY_FAILED, "Failed to simplify shape");
|
|
769
769
|
}
|
|
770
770
|
//#endregion
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Safe array access utilities.
|
|
774
|
-
* Replaces `arr[i]!` patterns where TypeScript's `noUncheckedIndexedAccess` requires
|
|
775
|
-
* a non-null assertion but bounds are proven by surrounding code.
|
|
776
|
-
*/
|
|
777
|
-
/** Access element by index, throwing if out of bounds. Use when bounds are logically guaranteed. */
|
|
778
|
-
function getAtOrThrow(arr, index, msg) {
|
|
779
|
-
if (index < 0 || index >= arr.length) throw new Error(msg ?? `Index ${index} out of bounds (length ${arr.length})`);
|
|
780
|
-
return arr[index];
|
|
781
|
-
}
|
|
782
|
-
/** Get the first element of a non-empty array, throwing if empty. */
|
|
783
|
-
function firstOrThrow(arr, msg) {
|
|
784
|
-
if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
|
|
785
|
-
return arr[0];
|
|
786
|
-
}
|
|
787
|
-
/** Get the last element of a non-empty array, throwing if empty. */
|
|
788
|
-
function lastOrThrow(arr, msg) {
|
|
789
|
-
if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
|
|
790
|
-
return arr[arr.length - 1];
|
|
791
|
-
}
|
|
792
|
-
//#endregion
|
|
793
|
-
export { tagFaces as A, invalidateShapeCache as B, colorShape as C, getFaceTags as D, findFacesByTag as E, getEdges as F, vertexPosition as G, iterFaces as H, getFaces as I, getOrCreateCache as L, setShapeOrigin as M, describe as N, getTagMetadata as O, getBounds as P, getVertices as R, colorFaces as S, getShapeColor as T, iterVertices as U, iterEdges as V, iterWires as W, transformCopy as _, getHashCode as a, propagateAllMetadata as b, isSameShape as c, applyMatrix as d, composeTransforms as f, scale as g, rotate as h, clone as i, getFaceOrigins as j, setTagMetadata as k, simplify as l, resize as m, getAtOrThrow as n, isEmpty as o, mirror as p, lastOrThrow as r, isEqualShape as s, firstOrThrow as t, toBREP as u, translate as v, getFaceColor as w, propagateMetadataByHash as x, collectInputFaceHashes as y, getWires as z };
|
|
771
|
+
export { describe as A, iterVertices as B, findFacesByTag as C, tagFaces as D, setTagMetadata as E, getVertices as F, vertexPosition as H, getWires as I, invalidateShapeCache as L, getEdges as M, getFaces as N, getFaceOrigins as O, getOrCreateCache as P, iterEdges as R, getShapeColor as S, getTagMetadata as T, iterWires as V, propagateAllMetadata as _, isSameShape as a, colorShape as b, applyMatrix as c, resize as d, rotate as f, collectInputFaceHashes as g, translate as h, isEqualShape as i, getBounds as j, setShapeOrigin as k, composeTransforms as l, transformCopy as m, getHashCode as n, simplify as o, scale as p, isEmpty as r, toBREP as s, clone as t, mirror as u, propagateMetadataByHash as v, getFaceTags as w, getFaceColor as x, colorFaces as y, iterFaces as z };
|