brepjs 13.4.0 → 14.1.3
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-CDnBM-tA.cjs → blueprint-C6B--LQ6.cjs} +13 -13
- package/dist/{blueprint-CB_85Lz_.js → blueprint-CzFYcmzV.js} +9 -9
- package/dist/{blueprintFns-D4YucGaQ.cjs → blueprintFns-B2AvzIXt.cjs} +3 -142
- package/dist/{blueprintFns-DVDommWB.js → blueprintFns-wka8INr_.js} +4 -125
- package/dist/{boolean2D-lqfKJKUY.cjs → boolean2D-6bQx64bR.cjs} +19 -18
- package/dist/{boolean2D-Mzp-0g7o.js → boolean2D-CfCt_m29.js} +12 -11
- package/dist/{booleanFns-B46fgObh.js → booleanFns-B6zxpf96.js} +8 -6
- package/dist/{booleanFns-Bw8sAMgI.cjs → booleanFns-C2pjUC6-.cjs} +24 -22
- 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-DBXma4vL.js} +3 -3
- package/dist/{cornerFinder-BszIcLqj.cjs → cornerFinder-DrHIlWCS.cjs} +4 -4
- package/dist/{curveFns-CZszKLQB.cjs → curveFns-C_vQNb7-.cjs} +2 -2
- package/dist/{curveFns-DY4dFcP-.js → curveFns-DmID8AQO.js} +2 -2
- package/dist/{drawFns-BHNDF8hb.cjs → drawFns-DRG-UpkW.cjs} +34 -17
- package/dist/{drawFns-l5CY2s-l.js → drawFns-rLQIZezc.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-1qcdK9dq.js} +3 -3
- package/dist/{extrudeFns-GpCB_Uzs.cjs → extrudeFns-BP7fNL5O.cjs} +3 -3
- package/dist/{faceFns-Cat-4X74.js → faceFns-BHT5DAOL.js} +93 -3
- package/dist/{faceFns-BywUjlJ7.cjs → faceFns-BwzwlBjE.cjs} +110 -2
- package/dist/{helpers-DgX1UucG.js → helpers-B94CkHQe.js} +8 -7
- package/dist/{helpers-1iCCEElA.cjs → helpers-C4Ajoc6x.cjs} +18 -17
- package/dist/{historyFns-BFwp8NLX.js → historyFns-BsSuAQ0m.js} +10 -10
- package/dist/{historyFns-DqxDtXIZ.cjs → historyFns-CrsjeD69.cjs} +10 -10
- package/dist/{importFns-ChXEJAvu.cjs → importFns-DPwXjtkm.cjs} +4 -4
- package/dist/{importFns-Cb8fcldB.js → importFns-DQsQOpRY.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-iarjC69-.js} +9 -16
- package/dist/{measureFns-Bx-kl7_g.cjs → measureFns-j1ze9DDM.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-CONktkIA.cjs} +4 -4
- package/dist/{meshFns-BPi0bhm9.js → meshFns-DRl9xnbO.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-CGg6EBKg.cjs} +69 -69
- package/dist/{primitiveFns-CnZkW6Bi.js → primitiveFns-CMIscOrN.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-Brq2J-mW.js} +8 -30
- package/dist/{arrayAccess-t2dlxGSK.cjs → shapeFns-DY7pjzrz.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-BOljxSxd.cjs +229 -0
- package/dist/shapeRefFns-BqOlRA7C.js +194 -0
- package/dist/{shapeTypes-8eK48l-X.cjs → shapeTypes-B3kwoJWf.cjs} +2643 -2551
- package/dist/{shapeTypes-Di6GlhPk.js → shapeTypes-CoNj-AHu.js} +2644 -2552
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-ctO_wFrm.js → solidBuilders-BzIatk9a.js} +3 -3
- package/dist/{solidBuilders-D9KYP9sL.cjs → solidBuilders-V8qvmW7h.cjs} +3 -3
- package/dist/{surfaceBuilders-BaqeZa0x.js → surfaceBuilders-Cfo4nH6A.js} +3 -3
- package/dist/{surfaceBuilders-CZzipftq.cjs → surfaceBuilders-CoiofY0Y.cjs} +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,9 +1,11 @@
|
|
|
1
|
-
import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-CoNj-AHu.js";
|
|
2
|
+
import { A as ok, R as unwrap, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { n as HASH_CODE_MAX } from "./constants-B9u763C3.js";
|
|
4
|
+
import { h as vecScale, t as vecAdd } from "./vecOps-D9etjPgV.js";
|
|
5
|
+
import { o as resolvePlane } from "./planeOps-gTOEarV2.js";
|
|
6
|
+
import { F as getVertices, I as getWires, M as getEdges, _ as propagateAllMetadata, g as collectInputFaceHashes, v as propagateMetadataByHash } from "./shapeFns-Brq2J-mW.js";
|
|
7
|
+
import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
|
|
8
|
+
import { r as makeFace } from "./surfaceBuilders-Cfo4nH6A.js";
|
|
7
9
|
//#region src/topology/booleanFns.ts
|
|
8
10
|
/**
|
|
9
11
|
* Boolean and compound operations — functional replacements for _3DShape boolean methods.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-B3kwoJWf.cjs");
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
4
|
+
const require_vecOps = require("./vecOps-BXvBYIor.cjs");
|
|
5
|
+
const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
|
|
6
|
+
const require_shapeFns = require("./shapeFns-DY7pjzrz.cjs");
|
|
7
|
+
const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
|
|
8
|
+
const require_surfaceBuilders = require("./surfaceBuilders-CoiofY0Y.cjs");
|
|
7
9
|
//#region src/topology/booleanFns.ts
|
|
8
10
|
/**
|
|
9
11
|
* Boolean and compound operations — functional replacements for _3DShape boolean methods.
|
|
@@ -39,8 +41,8 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
|
|
|
39
41
|
if (require_errors.isErr(checkA)) return checkA;
|
|
40
42
|
const checkB = validateShape3D(b, "fuse: second operand");
|
|
41
43
|
if (require_errors.isErr(checkB)) return checkB;
|
|
42
|
-
const inputFaceHashes =
|
|
43
|
-
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
44
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
45
|
+
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
44
46
|
optimisation,
|
|
45
47
|
simplify,
|
|
46
48
|
fuzzyValue
|
|
@@ -50,7 +52,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
|
|
|
50
52
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
|
|
51
53
|
}
|
|
52
54
|
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.", diagnostics);
|
|
53
|
-
if (fuseResult.ok)
|
|
55
|
+
if (fuseResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], fuseResult.value);
|
|
54
56
|
return fuseResult;
|
|
55
57
|
}
|
|
56
58
|
function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
|
|
@@ -59,8 +61,8 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
|
|
|
59
61
|
if (require_errors.isErr(checkBase)) return checkBase;
|
|
60
62
|
const checkTool = validateShape3D(tool, "cut: tool");
|
|
61
63
|
if (require_errors.isErr(checkTool)) return checkTool;
|
|
62
|
-
const inputFaceHashes =
|
|
63
|
-
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes,
|
|
64
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([base, tool]);
|
|
65
|
+
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
64
66
|
optimisation,
|
|
65
67
|
simplify,
|
|
66
68
|
fuzzyValue
|
|
@@ -70,7 +72,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
|
|
|
70
72
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
|
|
71
73
|
}
|
|
72
74
|
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.", diagnostics);
|
|
73
|
-
if (cutResult.ok)
|
|
75
|
+
if (cutResult.ok) require_shapeFns.propagateAllMetadata(evolution, [base, tool], cutResult.value);
|
|
74
76
|
return cutResult;
|
|
75
77
|
}
|
|
76
78
|
function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
|
|
@@ -79,8 +81,8 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
|
|
|
79
81
|
if (require_errors.isErr(checkA)) return checkA;
|
|
80
82
|
const checkB = validateShape3D(b, "intersect: second operand");
|
|
81
83
|
if (require_errors.isErr(checkB)) return checkB;
|
|
82
|
-
const inputFaceHashes =
|
|
83
|
-
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
84
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
85
|
+
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
84
86
|
simplify,
|
|
85
87
|
fuzzyValue
|
|
86
88
|
});
|
|
@@ -89,7 +91,7 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
|
|
|
89
91
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
|
|
90
92
|
}
|
|
91
93
|
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.", diagnostics);
|
|
92
|
-
if (intResult.ok)
|
|
94
|
+
if (intResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], intResult.value);
|
|
93
95
|
return intResult;
|
|
94
96
|
}
|
|
95
97
|
/**
|
|
@@ -135,7 +137,7 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
|
|
|
135
137
|
fuzzyValue,
|
|
136
138
|
...signal ? { signal } : {}
|
|
137
139
|
}), "FUSE_ALL_NOT_3D", "fuseAll did not produce a 3D shape");
|
|
138
|
-
if (fuseAllResult.ok)
|
|
140
|
+
if (fuseAllResult.ok) require_shapeFns.propagateMetadataByHash(shapes, fuseAllResult.value);
|
|
139
141
|
return fuseAllResult;
|
|
140
142
|
}
|
|
141
143
|
return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal, fuzzyValue);
|
|
@@ -155,7 +157,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal,
|
|
|
155
157
|
simplify,
|
|
156
158
|
fuzzyValue
|
|
157
159
|
}), "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
|
|
158
|
-
if (cutAllResult.ok)
|
|
160
|
+
if (cutAllResult.ok) require_shapeFns.propagateMetadataByHash(allInputs, cutAllResult.value);
|
|
159
161
|
return cutAllResult;
|
|
160
162
|
}
|
|
161
163
|
/**
|
|
@@ -220,9 +222,9 @@ function buildEdgeAdjacency(edges) {
|
|
|
220
222
|
const vertexToEdges = /* @__PURE__ */ new Map();
|
|
221
223
|
const edgeVertexHashes = /* @__PURE__ */ new Map();
|
|
222
224
|
for (const edge of edges) {
|
|
223
|
-
const verts =
|
|
224
|
-
const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped,
|
|
225
|
-
const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped,
|
|
225
|
+
const verts = require_shapeFns.getVertices(edge);
|
|
226
|
+
const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped, require_constants.HASH_CODE_MAX) : -1;
|
|
227
|
+
const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped, require_constants.HASH_CODE_MAX) : h0;
|
|
226
228
|
edgeVertexHashes.set(edge, [h0, h1]);
|
|
227
229
|
for (const h of [h0, h1]) {
|
|
228
230
|
const bucket = vertexToEdges.get(h) ?? [];
|
|
@@ -326,9 +328,9 @@ function findOuterWireIndex(wires) {
|
|
|
326
328
|
function sectionToFace(shape, plane, options = {}) {
|
|
327
329
|
const sectionResult = section(shape, plane, options);
|
|
328
330
|
if (!sectionResult.ok) return sectionResult;
|
|
329
|
-
const wires =
|
|
331
|
+
const wires = require_shapeFns.getWires(sectionResult.value);
|
|
330
332
|
if (wires.length === 0) {
|
|
331
|
-
const edges =
|
|
333
|
+
const edges = require_shapeFns.getEdges(sectionResult.value);
|
|
332
334
|
if (edges.length === 0) return require_errors.err(require_errors.kernelError("SECTION_FAILED", "sectionToFace: section produced no geometry", void 0, void 0, "The cutting plane may not intersect the shape. Verify plane position relative to shape bounds."));
|
|
333
335
|
wires.push(...assembleWiresFromEdges(edges));
|
|
334
336
|
}
|