brepjs 12.8.2 → 12.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d/lib/svgPath.d.ts.map +1 -1
- package/dist/2d/lib/vectorOperations.d.ts +4 -1
- package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +5 -5
- package/dist/{Blueprint-DbVaf6k7.js → Blueprint-1HGbugaC.js} +33 -63
- package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-CUyXM6CV.cjs} +15 -45
- package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-9OnbotKT.cjs} +9 -9
- package/dist/{boolean2D-y3E92F0u.js → boolean2D-CR4efa35.js} +11 -11
- package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-BBd2oTvv.cjs} +43 -40
- package/dist/{booleanFns-BCTjYZAg.js → booleanFns-Br2KdGJq.js} +53 -50
- package/dist/brepjs.cjs +379 -284
- package/dist/brepjs.js +1437 -1341
- package/dist/core/definitionMaps.d.ts +2 -7
- package/dist/core/definitionMaps.d.ts.map +1 -1
- package/dist/core/dimensionTypes.d.ts +52 -0
- package/dist/core/dimensionTypes.d.ts.map +1 -0
- package/dist/core/disposal.d.ts +18 -0
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/errors.d.ts +1 -8
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +15 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
- package/dist/core/planeOps.d.ts +14 -0
- package/dist/core/planeOps.d.ts.map +1 -1
- package/dist/core/result.d.ts +4 -0
- package/dist/core/result.d.ts.map +1 -1
- package/dist/core/shapeTypes.d.ts +14 -146
- package/dist/core/shapeTypes.d.ts.map +1 -1
- package/dist/core/typeDiscriminants.d.ts +14 -0
- package/dist/core/typeDiscriminants.d.ts.map +1 -0
- package/dist/core/validityTypes.d.ts +100 -0
- package/dist/core/validityTypes.d.ts.map +1 -0
- package/dist/core.cjs +52 -11
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +118 -75
- package/dist/{curveFns-mROFhiuG.js → curveFns-1u0oZ0u0.js} +14 -14
- package/dist/{curveFns-BZngcnQ1.cjs → curveFns-BwLvO_Ia.cjs} +2 -2
- package/dist/{drawFns-Bwakrq7w.js → drawFns-B0na6sbo.js} +16 -16
- package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-CzlEePor.cjs} +18 -18
- package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-BAKkZG6D.cjs} +2 -2
- package/dist/{faceFns-B8GnxjdY.js → faceFns-DGMp47Os.js} +3 -3
- package/dist/{helpers-C8NoT0Wu.cjs → helpers-DVdscQxW.cjs} +73 -8
- package/dist/{helpers-X0juxnwj.js → helpers-sJjnIXDA.js} +85 -20
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
- package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
- package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
- package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/helpers.d.ts +84 -0
- package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
- package/dist/kernel/brepkit/internalOps.d.ts +28 -0
- package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/ioOps.d.ts +43 -0
- package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/measureOps.d.ts +30 -0
- package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/meshOps.d.ts +7 -0
- package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
- package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/repairOps.d.ts +14 -0
- package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
- package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
- package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/transformOps.d.ts +14 -0
- package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
- package/dist/kernel/brepkitAdapter.d.ts +1 -1
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/extendedConstructorOps.d.ts +9 -1
- package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -0
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
- package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/construction-ops.d.ts +76 -0
- package/dist/kernel/interfaces/construction-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/core.d.ts +45 -0
- package/dist/kernel/interfaces/core.d.ts.map +1 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/geometry-ops.d.ts +77 -0
- package/dist/kernel/interfaces/geometry-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/index.d.ts +29 -0
- package/dist/kernel/interfaces/index.d.ts.map +1 -0
- package/dist/kernel/interfaces/io-ops.d.ts +66 -0
- package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
- package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
- package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
- package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/transform-ops.d.ts +20 -0
- package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
- package/dist/kernel/modifierOps.d.ts +2 -2
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +2 -446
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-hp3pc1M7.cjs → loft-BNvBZzqe.cjs} +5 -5
- package/dist/{loft-Bhw-FMoL.js → loft-D0aCZRaB.js} +7 -7
- package/dist/measurement/measureFns.d.ts +2 -2
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/{measurement-D8EJ694A.js → measurement-C7o5jE6G.js} +2 -2
- package/dist/{measurement-BoNTUBAp.cjs → measurement-DZcaxo1A.cjs} +2 -2
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-7dgZgNYK.cjs} +4 -4
- package/dist/{meshFns-nQjK38EC.js → meshFns-CtUl9fGY.js} +3 -3
- package/dist/operations/compoundOpsFns.d.ts +38 -0
- package/dist/operations/compoundOpsFns.d.ts.map +1 -0
- package/dist/operations/extrude.d.ts +2 -12
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts +2 -93
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/guidedSweepFns.d.ts +3 -22
- package/dist/operations/guidedSweepFns.d.ts.map +1 -1
- package/dist/operations/loft.d.ts +2 -16
- package/dist/operations/loft.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts +3 -29
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/operations/roofFns.d.ts +2 -2
- package/dist/operations/roofFns.d.ts.map +1 -1
- package/dist/operations/sweepFns.d.ts +121 -0
- package/dist/operations/sweepFns.d.ts.map +1 -0
- package/dist/{operations-BfbkK6DU.js → operations-DisJ5F8s.js} +110 -57
- package/dist/{operations-CYpmLSC4.cjs → operations-DwZ-RBO1.cjs} +97 -44
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +14 -14
- package/dist/originTrackingFns-NJ1dWoiF.js +137 -0
- package/dist/originTrackingFns-dhaCe8Yb.cjs +136 -0
- package/dist/query/edgeFinder.d.ts +4 -14
- package/dist/query/edgeFinder.d.ts.map +1 -1
- package/dist/query/faceFinder.d.ts +4 -14
- package/dist/query/faceFinder.d.ts.map +1 -1
- package/dist/query/finderCore.d.ts +6 -0
- package/dist/query/finderCore.d.ts.map +1 -1
- package/dist/query/shapeFinders.d.ts +32 -0
- package/dist/query/shapeFinders.d.ts.map +1 -0
- package/dist/query/wireFinder.d.ts +4 -9
- package/dist/query/wireFinder.d.ts.map +1 -1
- package/dist/query.cjs +54 -32
- package/dist/query.js +56 -34
- package/dist/{result-fAX0OZzI.cjs → result-DJAAj1yb.cjs} +8 -59
- package/dist/{result-BaSD1fqR.js → result-DtuwWSUD.js} +38 -89
- package/dist/result.cjs +1 -1
- package/dist/result.js +22 -22
- package/dist/shapeFns-BJbua5kT.js +34 -0
- package/dist/shapeFns-w9tWELHX.cjs +33 -0
- package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-CAEAyk8j.js} +233 -172
- package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-owrg2MNK.cjs} +421 -360
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BLQ4I6Ig.cjs} +3 -3
- package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-BS-1220W.js} +3 -3
- package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dj6AjhOv.js} +7 -7
- package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-KU_7OD2q.cjs} +3 -3
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/compoundOpsFns.d.ts +3 -35
- package/dist/topology/compoundOpsFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +0 -1
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/metadataPropagation.d.ts +30 -0
- package/dist/topology/metadataPropagation.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/originTrackingFns.d.ts +23 -0
- package/dist/topology/originTrackingFns.d.ts.map +1 -0
- package/dist/topology/shapeFns.d.ts +6 -120
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/topologyQueryFns.d.ts +67 -0
- package/dist/topology/topologyQueryFns.d.ts.map +1 -0
- package/dist/topology/transformFns.d.ts +49 -0
- package/dist/topology/transformFns.d.ts.map +1 -0
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-ANwCzGL8.cjs → topology-CyPHYYjV.cjs} +205 -20
- package/dist/{topology-C7x98OVn.js → topology-D6LeuhI_.js} +235 -50
- package/dist/topology.cjs +18 -17
- package/dist/topology.js +92 -91
- package/dist/topologyQueryFns-De439iBP.js +119 -0
- package/dist/topologyQueryFns-fz5kz5e1.cjs +118 -0
- package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
- package/dist/utils/precisionRound.d.ts +4 -0
- package/dist/utils/precisionRound.d.ts.map +1 -1
- package/dist/utils/vec2d.d.ts +5 -0
- package/dist/utils/vec2d.d.ts.map +1 -1
- package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
- package/dist/{vectors-D_IiZx0q.cjs → vectors-C8N_QeEX.cjs} +9 -1
- package/dist/{vectors-Bx8wkNui.js → vectors-DTREgnVp.js} +15 -7
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +23 -23
- package/package.json +3 -3
- package/dist/core/geometryHelpers.d.ts +0 -30
- package/dist/core/geometryHelpers.d.ts.map +0 -1
- package/dist/core/memory.d.ts +0 -6
- package/dist/core/memory.d.ts.map +0 -1
- package/dist/core/typeErrors.d.ts +0 -17
- package/dist/core/typeErrors.d.ts.map +0 -1
- package/dist/cornerFinder-Ckz-mPHE.js +0 -59
- package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
- package/dist/shapeFns-C2SnNvdH.cjs +0 -468
- package/dist/shapeFns-FDuKkrDR.js +0 -469
- package/dist/utils/round2.d.ts +0 -3
- package/dist/utils/round2.d.ts.map +0 -1
- package/dist/utils/round5.d.ts +0 -3
- package/dist/utils/round5.d.ts.map +0 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -45,31 +45,32 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
48
|
-
const shapeTypes = require("./shapeTypes-
|
|
49
|
-
const result = require("./result-
|
|
48
|
+
const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
|
|
49
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
50
50
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const boolean2D = require("./boolean2D-
|
|
51
|
+
const vectors = require("./vectors-C8N_QeEX.cjs");
|
|
52
|
+
const operations = require("./operations-DwZ-RBO1.cjs");
|
|
53
|
+
const Blueprint = require("./Blueprint-CUyXM6CV.cjs");
|
|
54
|
+
const boolean2D = require("./boolean2D-9OnbotKT.cjs");
|
|
55
55
|
const _2d = require("./2d.cjs");
|
|
56
|
-
const helpers = require("./helpers-
|
|
56
|
+
const helpers = require("./helpers-DVdscQxW.cjs");
|
|
57
57
|
const io = require("./io.cjs");
|
|
58
|
-
const drawFns = require("./drawFns-
|
|
58
|
+
const drawFns = require("./drawFns-CzlEePor.cjs");
|
|
59
59
|
const types = require("./types-CA_xrgDq.cjs");
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const measurement = require("./measurement-
|
|
68
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
60
|
+
const shapeFns = require("./shapeFns-w9tWELHX.cjs");
|
|
61
|
+
const booleanFns = require("./booleanFns-BBd2oTvv.cjs");
|
|
62
|
+
const topology = require("./topology-CyPHYYjV.cjs");
|
|
63
|
+
const curveFns = require("./curveFns-BwLvO_Ia.cjs");
|
|
64
|
+
const faceFns = require("./faceFns-BAKkZG6D.cjs");
|
|
65
|
+
const meshFns = require("./meshFns-7dgZgNYK.cjs");
|
|
66
|
+
const topologyQueryFns = require("./topologyQueryFns-fz5kz5e1.cjs");
|
|
67
|
+
const measurement = require("./measurement-DZcaxo1A.cjs");
|
|
68
|
+
const surfaceBuilders = require("./surfaceBuilders-KU_7OD2q.cjs");
|
|
69
|
+
const solidBuilders = require("./solidBuilders-BLQ4I6Ig.cjs");
|
|
70
|
+
const core = require("./core.cjs");
|
|
69
71
|
const query = require("./query.cjs");
|
|
70
|
-
const solidBuilders = require("./solidBuilders-994_MQwB.cjs");
|
|
71
|
-
const cornerFinder = require("./cornerFinder-ZmOyOOsh.cjs");
|
|
72
72
|
const worker = require("./worker.cjs");
|
|
73
|
+
const originTrackingFns = require("./originTrackingFns-dhaCe8Yb.cjs");
|
|
73
74
|
function supportsProjection(kernel) {
|
|
74
75
|
return "projectShape" in kernel;
|
|
75
76
|
}
|
|
@@ -850,6 +851,30 @@ function warnOnce(key, message) {
|
|
|
850
851
|
_warned.add(key);
|
|
851
852
|
console.warn(`brepkit: ${message}`);
|
|
852
853
|
}
|
|
854
|
+
function mapNumericTransition(mode) {
|
|
855
|
+
switch (mode) {
|
|
856
|
+
case 0:
|
|
857
|
+
return "rmf";
|
|
858
|
+
case 1:
|
|
859
|
+
return "rightCorner";
|
|
860
|
+
case 2:
|
|
861
|
+
return "roundCorner";
|
|
862
|
+
default:
|
|
863
|
+
return void 0;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
function mapStringTransition(mode) {
|
|
867
|
+
switch (mode) {
|
|
868
|
+
case "right":
|
|
869
|
+
return "rightCorner";
|
|
870
|
+
case "round":
|
|
871
|
+
return "roundCorner";
|
|
872
|
+
case "transformed":
|
|
873
|
+
return "rmf";
|
|
874
|
+
default:
|
|
875
|
+
return void 0;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
853
878
|
function hasBooleanOptions(opts) {
|
|
854
879
|
return opts.optimisation !== void 0 || opts.simplify !== void 0 || opts.strategy !== void 0 || opts.fuzzyValue !== void 0;
|
|
855
880
|
}
|
|
@@ -1412,19 +1437,33 @@ class BrepkitAdapter {
|
|
|
1412
1437
|
const id = this.bk.loft(faceIds);
|
|
1413
1438
|
return solidHandle(id);
|
|
1414
1439
|
}
|
|
1415
|
-
sweep(wire, spine,
|
|
1416
|
-
|
|
1417
|
-
warnOnce("sweep-transition", "Sweep transition mode not supported; ignored.");
|
|
1418
|
-
}
|
|
1440
|
+
sweep(wire, spine, options) {
|
|
1441
|
+
const contactMode = options?.transitionMode !== void 0 ? mapNumericTransition(options.transitionMode) : void 0;
|
|
1419
1442
|
const profileHandle = wire;
|
|
1420
1443
|
const faceId = profileHandle.type === "wire" ? this.bk.makeFaceFromWire(profileHandle.id) : unwrap(wire, "face");
|
|
1421
1444
|
const spineHandle = spine;
|
|
1422
1445
|
if (spineHandle.type === "wire") {
|
|
1423
1446
|
const edges = this.iterShapes(spine, "edge");
|
|
1424
1447
|
const edgeIds = edges.map((e) => unwrap(e, "edge"));
|
|
1448
|
+
if (contactMode && edgeIds.length === 1) {
|
|
1449
|
+
const edgeId = edgeIds[0];
|
|
1450
|
+
if (edgeId !== void 0) {
|
|
1451
|
+
return solidHandle(this.bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0));
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
if (contactMode && edgeIds.length > 1) {
|
|
1455
|
+
warnOnce(
|
|
1456
|
+
"sweep-transition-multi-edge",
|
|
1457
|
+
"Sweep transition mode not supported for multi-edge wires; ignored."
|
|
1458
|
+
);
|
|
1459
|
+
}
|
|
1425
1460
|
const id2 = this.bk.sweepAlongEdges(faceId, edgeIds);
|
|
1426
1461
|
return solidHandle(id2);
|
|
1427
1462
|
}
|
|
1463
|
+
if (contactMode) {
|
|
1464
|
+
const edgeId = unwrap(spine, "edge");
|
|
1465
|
+
return solidHandle(this.bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0));
|
|
1466
|
+
}
|
|
1428
1467
|
const nurbsData = this.extractNurbsFromEdge(spine);
|
|
1429
1468
|
if (!nurbsData) {
|
|
1430
1469
|
throw new Error("brepkit: sweep spine must be an edge or wire");
|
|
@@ -1485,25 +1524,58 @@ class BrepkitAdapter {
|
|
|
1485
1524
|
return solidHandle(this.bk.filletVariable(solidId, JSON.stringify(spec)));
|
|
1486
1525
|
}
|
|
1487
1526
|
chamfer(shape2, edges, distance) {
|
|
1488
|
-
const
|
|
1489
|
-
if (typeof distance !== "number") {
|
|
1490
|
-
warnOnce(
|
|
1491
|
-
"chamfer-asymmetric",
|
|
1492
|
-
typeof distance === "function" ? "Per-edge chamfer distance function not supported; falling back to distance=1." : "Asymmetric chamfer not supported; using first distance only."
|
|
1493
|
-
);
|
|
1494
|
-
}
|
|
1527
|
+
const solidId = unwrapSolidOrThrow(shape2, "chamfer");
|
|
1495
1528
|
const edgeIds = edges.map((e) => unwrap(e, "edge"));
|
|
1496
|
-
|
|
1497
|
-
|
|
1529
|
+
if (typeof distance === "number") {
|
|
1530
|
+
return solidHandle(this.bk.chamfer(solidId, edgeIds, distance));
|
|
1531
|
+
}
|
|
1532
|
+
if (Array.isArray(distance)) {
|
|
1533
|
+
const [d1, d2] = distance;
|
|
1534
|
+
if (typeof this.bk.chamferAsymmetric === "function") {
|
|
1535
|
+
return solidHandle(this.bk.chamferAsymmetric(solidId, edgeIds, d1, d2));
|
|
1536
|
+
}
|
|
1537
|
+
warnOnce("chamfer-asymmetric", "chamferAsymmetric not available; using averaged distance.");
|
|
1538
|
+
return solidHandle(this.bk.chamfer(solidId, edgeIds, (d1 + d2) / 2));
|
|
1539
|
+
}
|
|
1540
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1541
|
+
for (const [i, edge] of edges.entries()) {
|
|
1542
|
+
const r = distance(edge);
|
|
1543
|
+
const eid = edgeIds[i];
|
|
1544
|
+
if (eid === void 0) continue;
|
|
1545
|
+
const [d1, d2] = Array.isArray(r) ? r : [r, r];
|
|
1546
|
+
const key = `${d1},${d2}`;
|
|
1547
|
+
const group = groups.get(key);
|
|
1548
|
+
if (group) {
|
|
1549
|
+
group.ids.push(eid);
|
|
1550
|
+
} else {
|
|
1551
|
+
groups.set(key, { ids: [eid], d1, d2 });
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
let result2 = solidId;
|
|
1555
|
+
for (const group of groups.values()) {
|
|
1556
|
+
if (group.d1 === group.d2) {
|
|
1557
|
+
result2 = this.bk.chamfer(result2, group.ids, group.d1);
|
|
1558
|
+
} else if (typeof this.bk.chamferAsymmetric === "function") {
|
|
1559
|
+
result2 = this.bk.chamferAsymmetric(result2, group.ids, group.d1, group.d2);
|
|
1560
|
+
} else {
|
|
1561
|
+
warnOnce(
|
|
1562
|
+
"chamfer-callback",
|
|
1563
|
+
"chamferAsymmetric not available; asymmetric edges use averaged distance."
|
|
1564
|
+
);
|
|
1565
|
+
result2 = this.bk.chamfer(result2, group.ids, (group.d1 + group.d2) / 2);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
return solidHandle(result2);
|
|
1498
1569
|
}
|
|
1499
1570
|
chamferDistAngle(shape2, edges, distance, angleDeg) {
|
|
1500
|
-
warnOnce(
|
|
1501
|
-
"chamfer-dist-angle",
|
|
1502
|
-
"Distance-angle chamfer approximated as averaged two-distance chamfer."
|
|
1503
|
-
);
|
|
1504
1571
|
const d2 = distance * Math.tan(angleDeg * Math.PI / 180);
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1572
|
+
const solidId = unwrapSolidOrThrow(shape2, "chamferDistAngle");
|
|
1573
|
+
const edgeIds = edges.map((e) => unwrap(e, "edge"));
|
|
1574
|
+
if (typeof this.bk.chamferAsymmetric === "function") {
|
|
1575
|
+
return solidHandle(this.bk.chamferAsymmetric(solidId, edgeIds, distance, d2));
|
|
1576
|
+
}
|
|
1577
|
+
warnOnce("chamfer-dist-angle", "chamferAsymmetric not available; using averaged distance.");
|
|
1578
|
+
return solidHandle(this.bk.chamfer(solidId, edgeIds, (distance + d2) / 2));
|
|
1507
1579
|
}
|
|
1508
1580
|
shell(shape2, faces, thickness, tolerance) {
|
|
1509
1581
|
if (tolerance !== void 0) {
|
|
@@ -1536,6 +1608,49 @@ class BrepkitAdapter {
|
|
|
1536
1608
|
if (bestMatch >= 0 && bestDot > 0.99) return bestMatch;
|
|
1537
1609
|
} catch {
|
|
1538
1610
|
}
|
|
1611
|
+
try {
|
|
1612
|
+
const origVerts = toArray(this.bk.getFaceVertices(fid));
|
|
1613
|
+
if (origVerts.length >= 1) {
|
|
1614
|
+
let ox = 0, oy = 0, oz = 0;
|
|
1615
|
+
for (const vid of origVerts) {
|
|
1616
|
+
const pos = this.bk.getVertexPosition(vid);
|
|
1617
|
+
ox += pos[0];
|
|
1618
|
+
oy += pos[1];
|
|
1619
|
+
oz += pos[2];
|
|
1620
|
+
}
|
|
1621
|
+
const n = origVerts.length;
|
|
1622
|
+
ox /= n;
|
|
1623
|
+
oy /= n;
|
|
1624
|
+
oz /= n;
|
|
1625
|
+
let bestCentroidMatch = -1;
|
|
1626
|
+
let bestCentroidDist = Infinity;
|
|
1627
|
+
for (const sf of solidFaces) {
|
|
1628
|
+
try {
|
|
1629
|
+
const sv = toArray(this.bk.getFaceVertices(sf));
|
|
1630
|
+
if (sv.length < 1) continue;
|
|
1631
|
+
let sx = 0, sy = 0, sz = 0;
|
|
1632
|
+
for (const svid of sv) {
|
|
1633
|
+
const spos = this.bk.getVertexPosition(svid);
|
|
1634
|
+
sx += spos[0];
|
|
1635
|
+
sy += spos[1];
|
|
1636
|
+
sz += spos[2];
|
|
1637
|
+
}
|
|
1638
|
+
const sn = sv.length;
|
|
1639
|
+
sx /= sn;
|
|
1640
|
+
sy /= sn;
|
|
1641
|
+
sz /= sn;
|
|
1642
|
+
const dist = Math.sqrt((ox - sx) ** 2 + (oy - sy) ** 2 + (oz - sz) ** 2);
|
|
1643
|
+
if (dist < bestCentroidDist) {
|
|
1644
|
+
bestCentroidDist = dist;
|
|
1645
|
+
bestCentroidMatch = sf;
|
|
1646
|
+
}
|
|
1647
|
+
} catch {
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
if (bestCentroidMatch >= 0 && bestCentroidDist < 1e-3) return bestCentroidMatch;
|
|
1651
|
+
}
|
|
1652
|
+
} catch {
|
|
1653
|
+
}
|
|
1539
1654
|
return fid;
|
|
1540
1655
|
});
|
|
1541
1656
|
const id = this.bk.shell(solidId, thickness, resolvedFaceIds);
|
|
@@ -2836,20 +2951,22 @@ class BrepkitAdapter {
|
|
|
2836
2951
|
// Serialization
|
|
2837
2952
|
// ═══════════════════════════════════════════════════════════════════════
|
|
2838
2953
|
toBREP(shape2) {
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2954
|
+
const h = shape2;
|
|
2955
|
+
if (h.type === "solid") {
|
|
2956
|
+
return this.bk.toBREP(h.id);
|
|
2957
|
+
}
|
|
2958
|
+
warnOnce("brep-non-solid", "toBREP for non-solid shapes uses STEP format.");
|
|
2843
2959
|
return this.exportSTEP([shape2]);
|
|
2844
2960
|
}
|
|
2845
2961
|
fromBREP(data) {
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2962
|
+
if (typeof this.bk.fromBREP === "function" && data.trimStart().startsWith("{")) {
|
|
2963
|
+
const id = this.bk.fromBREP(data);
|
|
2964
|
+
return solidHandle(id);
|
|
2965
|
+
}
|
|
2850
2966
|
const shapes = this.importSTEP(data);
|
|
2851
|
-
|
|
2852
|
-
|
|
2967
|
+
const first = shapes[0];
|
|
2968
|
+
if (!first) throw new Error("brepkit: fromBREP produced no shapes");
|
|
2969
|
+
return first;
|
|
2853
2970
|
}
|
|
2854
2971
|
// ═══════════════════════════════════════════════════════════════════════
|
|
2855
2972
|
// Mesh preparation
|
|
@@ -2882,6 +2999,49 @@ class BrepkitAdapter {
|
|
|
2882
2999
|
const profileHandle = profile;
|
|
2883
3000
|
const faceId = profileHandle.type === "wire" ? this.bk.makeFaceFromWire(profileHandle.id) : unwrap(profile, "face");
|
|
2884
3001
|
const shellMode = !!(options && options["shellMode"]);
|
|
3002
|
+
const transitionMode = options?.["transitionMode"];
|
|
3003
|
+
const contactMode = transitionMode ? mapStringTransition(transitionMode) : void 0;
|
|
3004
|
+
if (contactMode) {
|
|
3005
|
+
const spineHandle = spine;
|
|
3006
|
+
if (spineHandle.type !== "wire") {
|
|
3007
|
+
try {
|
|
3008
|
+
const edgeId = unwrap(spine, "edge");
|
|
3009
|
+
const shape22 = solidHandle(this.bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0));
|
|
3010
|
+
if (shellMode) return { shape: shape22, firstShape: profile, lastShape: profile };
|
|
3011
|
+
return shape22;
|
|
3012
|
+
} catch (e) {
|
|
3013
|
+
console.warn(
|
|
3014
|
+
"brepkit: sweepWithOptions failed, falling back to sweepSmooth/simplePipe:",
|
|
3015
|
+
e
|
|
3016
|
+
);
|
|
3017
|
+
}
|
|
3018
|
+
} else {
|
|
3019
|
+
const edges = this.iterShapes(spine, "edge");
|
|
3020
|
+
if (edges.length === 1) {
|
|
3021
|
+
const first = edges[0];
|
|
3022
|
+
if (first) {
|
|
3023
|
+
try {
|
|
3024
|
+
const edgeId = unwrap(first, "edge");
|
|
3025
|
+
const shape22 = solidHandle(
|
|
3026
|
+
this.bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0)
|
|
3027
|
+
);
|
|
3028
|
+
if (shellMode) return { shape: shape22, firstShape: profile, lastShape: profile };
|
|
3029
|
+
return shape22;
|
|
3030
|
+
} catch (e) {
|
|
3031
|
+
console.warn(
|
|
3032
|
+
"brepkit: sweepWithOptions failed, falling back to sweepSmooth/simplePipe:",
|
|
3033
|
+
e
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
} else {
|
|
3038
|
+
warnOnce(
|
|
3039
|
+
"sweepPipeShell-transition-multi-edge",
|
|
3040
|
+
"sweepPipeShell transition mode not supported for multi-edge wires; ignored."
|
|
3041
|
+
);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
2885
3045
|
const nurbsData = this.extractNurbsFromEdge(spine);
|
|
2886
3046
|
if (nurbsData && nurbsData.degree > 1) {
|
|
2887
3047
|
try {
|
|
@@ -4682,6 +4842,64 @@ function multiplyMatrices(a, b) {
|
|
|
4682
4842
|
}
|
|
4683
4843
|
return result2;
|
|
4684
4844
|
}
|
|
4845
|
+
const kernel_ERROR_PATTERNS = [
|
|
4846
|
+
{
|
|
4847
|
+
pattern: /invalid edge configuration|edges?.*(not|fail|invalid)/i,
|
|
4848
|
+
translation: "The edges may not form a continuous loop. Check that edges connect end-to-end without gaps."
|
|
4849
|
+
},
|
|
4850
|
+
{
|
|
4851
|
+
pattern: /BRepAlgoAPI.*failed|boolean.*operation.*failed/i,
|
|
4852
|
+
translation: "Boolean operation failed. Common causes: overlapping faces, zero-thickness geometry, or degenerate shapes. Try healing input shapes first."
|
|
4853
|
+
},
|
|
4854
|
+
{
|
|
4855
|
+
pattern: /fillet.*radius.*too.*large|fillet.*failed/i,
|
|
4856
|
+
translation: "Fillet operation failed. The radius may be too large for the selected edges. Try reducing the radius or check that edges have enough room."
|
|
4857
|
+
},
|
|
4858
|
+
{
|
|
4859
|
+
pattern: /chamfer.*failed|chamfer.*distance.*too.*large/i,
|
|
4860
|
+
translation: "Chamfer operation failed. The distance may be too large for the selected edges. Try reducing the distance or check edge geometry."
|
|
4861
|
+
},
|
|
4862
|
+
{
|
|
4863
|
+
pattern: /shell.*failed|offset.*failed/i,
|
|
4864
|
+
translation: "Shell/offset operation failed. The thickness may be too large, or the shape may have complex geometry. Try reducing thickness."
|
|
4865
|
+
},
|
|
4866
|
+
{
|
|
4867
|
+
pattern: /sweep.*failed|pipe.*failed/i,
|
|
4868
|
+
translation: "Sweep operation failed. Check that the profile and spine are compatible, and that the spine has no sharp twists or self-intersections."
|
|
4869
|
+
},
|
|
4870
|
+
{
|
|
4871
|
+
pattern: /loft.*failed/i,
|
|
4872
|
+
translation: "Loft operation failed. Profiles may be incompatible or have different orientations. Ensure profiles are ordered consistently."
|
|
4873
|
+
},
|
|
4874
|
+
{
|
|
4875
|
+
pattern: /extrude.*failed|prism.*failed/i,
|
|
4876
|
+
translation: "Extrusion failed. The profile may be invalid or self-intersecting. Check that the profile forms a valid closed wire."
|
|
4877
|
+
},
|
|
4878
|
+
{
|
|
4879
|
+
pattern: /revolve.*failed|revolution.*failed/i,
|
|
4880
|
+
translation: "Revolution operation failed. The profile may intersect the axis of revolution, or the angle may be invalid."
|
|
4881
|
+
},
|
|
4882
|
+
{
|
|
4883
|
+
pattern: /self.*intersect|self-intersect/i,
|
|
4884
|
+
translation: "Shape has self-intersections. The operation resulted in overlapping geometry. Simplify the input or adjust parameters."
|
|
4885
|
+
},
|
|
4886
|
+
{
|
|
4887
|
+
pattern: /degener|degenerat/i,
|
|
4888
|
+
translation: "Degenerate geometry detected. The shape has edges or faces with zero length/area. Check input geometry for collapsed elements."
|
|
4889
|
+
},
|
|
4890
|
+
{
|
|
4891
|
+
pattern: /BRepCheck.*fail|shape.*invalid|shape.*not.*valid/i,
|
|
4892
|
+
translation: "Shape validation failed. The resulting shape has invalid topology. Try healing the shape or checking input geometry."
|
|
4893
|
+
}
|
|
4894
|
+
];
|
|
4895
|
+
function translateKernelError(kernelMessage) {
|
|
4896
|
+
for (const { pattern, translation } of kernel_ERROR_PATTERNS) {
|
|
4897
|
+
if (pattern.test(kernelMessage)) {
|
|
4898
|
+
return `${translation} (kernel: ${kernelMessage})`;
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
return kernelMessage;
|
|
4902
|
+
}
|
|
4685
4903
|
const errorFactories = {
|
|
4686
4904
|
KERNEL_OPERATION: (code, message, cause) => ({ kind: "KERNEL_OPERATION", code, message, cause }),
|
|
4687
4905
|
VALIDATION: (code, message, cause) => ({ kind: "VALIDATION", code, message, cause }),
|
|
@@ -4700,7 +4918,7 @@ function kernelCall(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
|
4700
4918
|
return result.ok(shapeTypes.castShape(fn()));
|
|
4701
4919
|
} catch (e) {
|
|
4702
4920
|
const rawMessage = e instanceof Error ? e.message : String(e);
|
|
4703
|
-
const translatedMessage = kind === "KERNEL_OPERATION" ?
|
|
4921
|
+
const translatedMessage = kind === "KERNEL_OPERATION" ? translateKernelError(rawMessage) : rawMessage;
|
|
4704
4922
|
return result.err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
4705
4923
|
}
|
|
4706
4924
|
}
|
|
@@ -4709,7 +4927,7 @@ function kernelCallRaw(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
|
4709
4927
|
return result.ok(fn());
|
|
4710
4928
|
} catch (e) {
|
|
4711
4929
|
const rawMessage = e instanceof Error ? e.message : String(e);
|
|
4712
|
-
const translatedMessage = kind === "KERNEL_OPERATION" ?
|
|
4930
|
+
const translatedMessage = kind === "KERNEL_OPERATION" ? translateKernelError(rawMessage) : rawMessage;
|
|
4713
4931
|
return result.err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
4714
4932
|
}
|
|
4715
4933
|
}
|
|
@@ -4724,32 +4942,6 @@ function kernelCallScoped(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
|
4724
4942
|
__callDispose(_stack, _error, _hasError);
|
|
4725
4943
|
}
|
|
4726
4944
|
}
|
|
4727
|
-
const CURVE_TYPE_BY_INT = [
|
|
4728
|
-
"LINE",
|
|
4729
|
-
// 0
|
|
4730
|
-
"CIRCLE",
|
|
4731
|
-
// 1
|
|
4732
|
-
"ELLIPSE",
|
|
4733
|
-
// 2
|
|
4734
|
-
"HYPERBOLA",
|
|
4735
|
-
// 3
|
|
4736
|
-
"PARABOLA",
|
|
4737
|
-
// 4
|
|
4738
|
-
"BEZIER_CURVE",
|
|
4739
|
-
// 5
|
|
4740
|
-
"BSPLINE_CURVE",
|
|
4741
|
-
// 6
|
|
4742
|
-
"OFFSET_CURVE",
|
|
4743
|
-
// 7
|
|
4744
|
-
"OTHER_CURVE"
|
|
4745
|
-
// 8
|
|
4746
|
-
];
|
|
4747
|
-
const findCurveType = (type) => {
|
|
4748
|
-
const idx = typeof type === "number" ? type : Number(type?.value ?? type);
|
|
4749
|
-
const curveType = CURVE_TYPE_BY_INT[idx];
|
|
4750
|
-
if (!curveType) return result.err(result.typeCastError("UNKNOWN_CURVE_TYPE", "Unknown curve type"));
|
|
4751
|
-
return result.ok(curveType);
|
|
4752
|
-
};
|
|
4753
4945
|
const BOPAlgo_GlueShift = 1;
|
|
4754
4946
|
const BOPAlgo_GlueFull = 2;
|
|
4755
4947
|
function applyGlue(op, optimisation) {
|
|
@@ -4778,35 +4970,14 @@ function isFilletRadius(r) {
|
|
|
4778
4970
|
}
|
|
4779
4971
|
return false;
|
|
4780
4972
|
}
|
|
4781
|
-
function buildWireFinder(filters) {
|
|
4782
|
-
return helpers.createTypedFinder(
|
|
4783
|
-
"wire",
|
|
4784
|
-
filters,
|
|
4785
|
-
buildWireFinder,
|
|
4786
|
-
(_base, withFilter) => ({
|
|
4787
|
-
isClosed: () => withFilter((wire) => curveFns.curveIsClosed(wire)),
|
|
4788
|
-
isOpen: () => withFilter((wire) => !curveFns.curveIsClosed(wire)),
|
|
4789
|
-
ofEdgeCount: (count) => withFilter((wire) => {
|
|
4790
|
-
let edgeCount = 0;
|
|
4791
|
-
for (const _raw of faceFns.iterTopo(wire.wrapped, "edge")) {
|
|
4792
|
-
edgeCount++;
|
|
4793
|
-
}
|
|
4794
|
-
return edgeCount === count;
|
|
4795
|
-
})
|
|
4796
|
-
})
|
|
4797
|
-
);
|
|
4798
|
-
}
|
|
4799
|
-
function wireFinder() {
|
|
4800
|
-
return buildWireFinder([]);
|
|
4801
|
-
}
|
|
4802
4973
|
function withNearestPostFilter(baseFinder, nearestPoint) {
|
|
4803
4974
|
const findAllNearest = (shape2) => {
|
|
4804
4975
|
const candidates = baseFinder.findAll(shape2);
|
|
4805
4976
|
if (candidates.length === 0) return [];
|
|
4806
4977
|
let bestIdx = 0;
|
|
4807
|
-
let bestDist = vecOps.vecDistance(
|
|
4978
|
+
let bestDist = vecOps.vecDistance(topologyQueryFns.vertexPosition(candidates[0]), nearestPoint);
|
|
4808
4979
|
for (let i = 1; i < candidates.length; i++) {
|
|
4809
|
-
const d = vecOps.vecDistance(
|
|
4980
|
+
const d = vecOps.vecDistance(topologyQueryFns.vertexPosition(candidates[i]), nearestPoint);
|
|
4810
4981
|
if (d < bestDist) {
|
|
4811
4982
|
bestDist = d;
|
|
4812
4983
|
bestIdx = i;
|
|
@@ -4836,13 +5007,13 @@ function buildVertexFinder(filters) {
|
|
|
4836
5007
|
buildVertexFinder,
|
|
4837
5008
|
(_base, withFilter) => ({
|
|
4838
5009
|
nearestTo: (point) => withNearestPostFilter(buildVertexFinder(filters), point),
|
|
4839
|
-
atPosition: (point, tolerance = 1e-4) => withFilter((vertex) => vecOps.vecDistance(
|
|
5010
|
+
atPosition: (point, tolerance = 1e-4) => withFilter((vertex) => vecOps.vecDistance(topologyQueryFns.vertexPosition(vertex), point) < tolerance),
|
|
4840
5011
|
withinBox: (min, max) => withFilter((vertex) => {
|
|
4841
|
-
const pos =
|
|
5012
|
+
const pos = topologyQueryFns.vertexPosition(vertex);
|
|
4842
5013
|
return pos[0] >= min[0] - 1e-6 && pos[0] <= max[0] + 1e-6 && pos[1] >= min[1] - 1e-6 && pos[1] <= max[1] + 1e-6 && pos[2] >= min[2] - 1e-6 && pos[2] <= max[2] + 1e-6;
|
|
4843
5014
|
}),
|
|
4844
5015
|
atDistance: (distance, point = [0, 0, 0], tolerance = 1e-4) => withFilter((vertex) => {
|
|
4845
|
-
const pos =
|
|
5016
|
+
const pos = topologyQueryFns.vertexPosition(vertex);
|
|
4846
5017
|
return Math.abs(vecOps.vecDistance(pos, point) - distance) < tolerance;
|
|
4847
5018
|
})
|
|
4848
5019
|
})
|
|
@@ -5112,7 +5283,7 @@ function hull(shapes, options = {}) {
|
|
|
5112
5283
|
}
|
|
5113
5284
|
}
|
|
5114
5285
|
function detectSphere(shape2) {
|
|
5115
|
-
const faces =
|
|
5286
|
+
const faces = topologyQueryFns.getFaces(shape2);
|
|
5116
5287
|
if (faces.length !== 1) return null;
|
|
5117
5288
|
const face = faces[0];
|
|
5118
5289
|
const surfType = shapeTypes.getKernel().surfaceType(face.wrapped);
|
|
@@ -5148,8 +5319,8 @@ function minkowskiSphere(shape2, radius, tolerance) {
|
|
|
5148
5319
|
function minkowskiGeneral(shape2, tool, tolerance) {
|
|
5149
5320
|
const kernel = shapeTypes.getKernel();
|
|
5150
5321
|
try {
|
|
5151
|
-
const shapeVerts =
|
|
5152
|
-
const toolVerts =
|
|
5322
|
+
const shapeVerts = topologyQueryFns.getVertices(shape2);
|
|
5323
|
+
const toolVerts = topologyQueryFns.getVertices(tool);
|
|
5153
5324
|
if (shapeVerts.length === 0 || toolVerts.length === 0) {
|
|
5154
5325
|
return result.err(
|
|
5155
5326
|
result.kernelError(
|
|
@@ -5262,94 +5433,41 @@ function polyhedron(points, faces, options = {}) {
|
|
|
5262
5433
|
return result.err(result.kernelError(result.BrepErrorCode.POLYHEDRON_FAILED, `Polyhedron failed: ${raw}`, e));
|
|
5263
5434
|
}
|
|
5264
5435
|
}
|
|
5265
|
-
function
|
|
5266
|
-
if (
|
|
5267
|
-
return result.err(
|
|
5268
|
-
result.validationError(
|
|
5269
|
-
result.BrepErrorCode.MULTI_SWEEP_INSUFFICIENT_SECTIONS,
|
|
5270
|
-
`Multi-section sweep requires at least 2 sections, got ${sections.length}`
|
|
5271
|
-
)
|
|
5272
|
-
);
|
|
5436
|
+
function extrude$1(face, extrusionVec) {
|
|
5437
|
+
if (shapeTypes.getKernel().isNull(face.wrapped)) {
|
|
5438
|
+
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "extrude: face is a null shape"));
|
|
5273
5439
|
}
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
for (let i = 0; i < explicitLocations.length; i++) {
|
|
5277
|
-
const loc = explicitLocations[i];
|
|
5278
|
-
if (loc !== void 0 && (loc < 0 || loc > 1)) {
|
|
5279
|
-
return result.err(
|
|
5280
|
-
result.validationError(
|
|
5281
|
-
result.BrepErrorCode.MULTI_SWEEP_FAILED,
|
|
5282
|
-
`Section ${i} location ${loc} is out of range [0, 1]`
|
|
5283
|
-
)
|
|
5284
|
-
);
|
|
5285
|
-
}
|
|
5286
|
-
}
|
|
5287
|
-
const definedLocs = explicitLocations.filter((l) => l !== void 0);
|
|
5288
|
-
for (let i = 1; i < definedLocs.length; i++) {
|
|
5289
|
-
if ((definedLocs[i] ?? 0) <= (definedLocs[i - 1] ?? 0)) {
|
|
5290
|
-
return result.err(
|
|
5291
|
-
result.validationError(
|
|
5292
|
-
result.BrepErrorCode.MULTI_SWEEP_FAILED,
|
|
5293
|
-
"Section locations must be strictly increasing"
|
|
5294
|
-
)
|
|
5295
|
-
);
|
|
5296
|
-
}
|
|
5440
|
+
if (vecOps.vecLength(extrusionVec) === 0) {
|
|
5441
|
+
return result.err(result.validationError("EXTRUDE_ZERO_VECTOR", "extrude: extrusion vector has zero length"));
|
|
5297
5442
|
}
|
|
5298
5443
|
try {
|
|
5299
5444
|
const kernel = shapeTypes.getKernel();
|
|
5300
|
-
const
|
|
5301
|
-
const
|
|
5302
|
-
const
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
return uFirst + i / (sections.length - 1) * uRange;
|
|
5307
|
-
});
|
|
5308
|
-
const positionedWires = [];
|
|
5309
|
-
for (let i = 0; i < sections.length; i++) {
|
|
5310
|
-
const param = params[i];
|
|
5311
|
-
const section2 = sections[i];
|
|
5312
|
-
if (param === void 0 || section2 === void 0) continue;
|
|
5313
|
-
const positioned = kernel.positionOnCurve(section2.wire.wrapped, spine.wrapped, param);
|
|
5314
|
-
positionedWires.push(kernel.downcast(positioned, "wire"));
|
|
5315
|
-
}
|
|
5316
|
-
const loftResult = kernel.loftAdvanced(positionedWires, { solid, ruled, tolerance });
|
|
5317
|
-
const result$1 = shapeTypes.castShape(loftResult);
|
|
5318
|
-
if (!shapeTypes.isShape3D(result$1)) {
|
|
5319
|
-
return result.err(
|
|
5320
|
-
result.typeCastError("MULTI_SWEEP_NOT_3D", "Multi-section sweep did not produce a 3D shape")
|
|
5321
|
-
);
|
|
5322
|
-
}
|
|
5323
|
-
return result.ok(result$1);
|
|
5445
|
+
const len = vecOps.vecLength(extrusionVec);
|
|
5446
|
+
const dir = vecOps.vecNormalize(extrusionVec);
|
|
5447
|
+
const shape2 = kernel.extrude(face.wrapped, [...dir], len);
|
|
5448
|
+
const downcastShape = kernel.downcast(shape2, "solid");
|
|
5449
|
+
const solid = shapeTypes.createSolid(downcastShape);
|
|
5450
|
+
return result.ok(solid);
|
|
5324
5451
|
} catch (e) {
|
|
5325
|
-
const raw = e instanceof Error ? e.message : String(e);
|
|
5326
5452
|
return result.err(
|
|
5327
|
-
result.kernelError(
|
|
5453
|
+
result.kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
|
|
5454
|
+
operation: "extrude",
|
|
5455
|
+
vectorLength: vecOps.vecLength(extrusionVec)
|
|
5456
|
+
})
|
|
5328
5457
|
);
|
|
5329
5458
|
}
|
|
5330
5459
|
}
|
|
5331
|
-
function
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
shellMode,
|
|
5341
|
-
...tolerance !== void 0 ? { tolerance, boundTolerance: tolerance } : {}
|
|
5342
|
-
});
|
|
5343
|
-
const ocShape = typeof sweepResult === "object" && "shape" in sweepResult ? sweepResult.shape : sweepResult;
|
|
5344
|
-
const result$1 = shapeTypes.castShape(ocShape);
|
|
5345
|
-
if (!shapeTypes.isShape3D(result$1)) {
|
|
5346
|
-
return result.err(result.typeCastError("GUIDED_SWEEP_NOT_3D", "Guided sweep did not produce a 3D shape"));
|
|
5347
|
-
}
|
|
5348
|
-
return result.ok(result$1);
|
|
5349
|
-
} catch (e) {
|
|
5350
|
-
const raw = e instanceof Error ? e.message : String(e);
|
|
5351
|
-
return result.err(result.kernelError(result.BrepErrorCode.GUIDED_SWEEP_FAILED, `Guided sweep failed: ${raw}`, e));
|
|
5460
|
+
function revolve$1(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
|
|
5461
|
+
if (shapeTypes.getKernel().isNull(face.wrapped)) {
|
|
5462
|
+
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
|
|
5463
|
+
}
|
|
5464
|
+
const kernel = shapeTypes.getKernel();
|
|
5465
|
+
const shape2 = kernel.revolveVec(face.wrapped, [...center], [...direction], angle);
|
|
5466
|
+
const result$1 = shapeTypes.castShape(shape2);
|
|
5467
|
+
if (!shapeTypes.isShape3D(result$1)) {
|
|
5468
|
+
return result.err(result.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
5352
5469
|
}
|
|
5470
|
+
return result.ok(result$1);
|
|
5353
5471
|
}
|
|
5354
5472
|
const EPS = 1e-10;
|
|
5355
5473
|
function cross2(ax, ay, bx, by) {
|
|
@@ -5698,7 +5816,7 @@ function computeStraightSkeleton(polygon) {
|
|
|
5698
5816
|
return { nodes: uniqueNodes, faces };
|
|
5699
5817
|
}
|
|
5700
5818
|
function extractPolygon(w) {
|
|
5701
|
-
const edges =
|
|
5819
|
+
const edges = topologyQueryFns.getEdges(w);
|
|
5702
5820
|
const pts = edges.map((e) => {
|
|
5703
5821
|
const pt = curveFns.curveStartPoint(e);
|
|
5704
5822
|
return { x: pt[0], y: pt[1] };
|
|
@@ -6030,7 +6148,7 @@ function checkInterference(shape1, shape2, tolerance = 1e-6) {
|
|
|
6030
6148
|
}
|
|
6031
6149
|
function checkAllInterferences(shapes, tolerance = 1e-6) {
|
|
6032
6150
|
const pairs = [];
|
|
6033
|
-
const boxes = shapes.map((s) =>
|
|
6151
|
+
const boxes = shapes.map((s) => topologyQueryFns.getBounds(s));
|
|
6034
6152
|
shapes.forEach((si, i) => {
|
|
6035
6153
|
for (let j = i + 1; j < shapes.length; j++) {
|
|
6036
6154
|
if (aabbDisjoint(boxes[i], boxes[j], tolerance)) continue;
|
|
@@ -6393,25 +6511,11 @@ function validateNotNull(shape2, label) {
|
|
|
6393
6511
|
}
|
|
6394
6512
|
return result.ok(void 0);
|
|
6395
6513
|
}
|
|
6396
|
-
function collectInputFaceHashes(inputs) {
|
|
6397
|
-
const hasMetadata = inputs.some((s) => {
|
|
6398
|
-
return shapeFns.getFaceOrigins(s) !== void 0 || booleanFns.hasFaceTags(s) || booleanFns.hasColorMetadata(s);
|
|
6399
|
-
});
|
|
6400
|
-
if (!hasMetadata) return [];
|
|
6401
|
-
const hashes = [];
|
|
6402
|
-
for (const input of inputs) {
|
|
6403
|
-
const faces = shapeTypes.getKernel().iterShapes(input.wrapped, "face");
|
|
6404
|
-
for (const face of faces) {
|
|
6405
|
-
hashes.push(face.HashCode(vecOps.HASH_CODE_MAX));
|
|
6406
|
-
}
|
|
6407
|
-
}
|
|
6408
|
-
return hashes;
|
|
6409
|
-
}
|
|
6410
6514
|
function thicken$1(shape2, thickness) {
|
|
6411
6515
|
const check = validateNotNull(shape2, "thicken: shape");
|
|
6412
6516
|
if (result.isErr(check)) return check;
|
|
6413
6517
|
try {
|
|
6414
|
-
const inputFaceHashes = collectInputFaceHashes([shape2]);
|
|
6518
|
+
const inputFaceHashes = booleanFns.collectInputFaceHashes([shape2]);
|
|
6415
6519
|
const { shape: resultShape, evolution } = shapeTypes.getKernel().thickenWithHistory(
|
|
6416
6520
|
shape2.wrapped,
|
|
6417
6521
|
thickness,
|
|
@@ -6419,9 +6523,7 @@ function thicken$1(shape2, thickness) {
|
|
|
6419
6523
|
vecOps.HASH_CODE_MAX
|
|
6420
6524
|
);
|
|
6421
6525
|
const cast = shapeTypes.castShape(resultShape);
|
|
6422
|
-
|
|
6423
|
-
booleanFns.propagateFaceTagsFromEvolution(evolution, [shape2], cast);
|
|
6424
|
-
booleanFns.propagateColorsFromEvolution(evolution, [shape2], cast);
|
|
6526
|
+
booleanFns.propagateAllMetadata(evolution, [shape2], cast);
|
|
6425
6527
|
return result.ok(cast);
|
|
6426
6528
|
} catch (e) {
|
|
6427
6529
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -6453,7 +6555,7 @@ function fillet$1(shape2, edges, radius) {
|
|
|
6453
6555
|
)
|
|
6454
6556
|
);
|
|
6455
6557
|
}
|
|
6456
|
-
const selectedEdges = edges ??
|
|
6558
|
+
const selectedEdges = edges ?? topologyQueryFns.getEdges(shape2);
|
|
6457
6559
|
if (selectedEdges.length === 0) {
|
|
6458
6560
|
return result.err(
|
|
6459
6561
|
result.validationError(
|
|
@@ -6501,7 +6603,7 @@ function fillet$1(shape2, edges, radius) {
|
|
|
6501
6603
|
)
|
|
6502
6604
|
);
|
|
6503
6605
|
}
|
|
6504
|
-
const inputFaceHashes = collectInputFaceHashes([shape2]);
|
|
6606
|
+
const inputFaceHashes = booleanFns.collectInputFaceHashes([shape2]);
|
|
6505
6607
|
const { shape: resultShape, evolution } = shapeTypes.getKernel().filletWithHistory(
|
|
6506
6608
|
shape2.wrapped,
|
|
6507
6609
|
filteredEdges.map((e) => e.wrapped),
|
|
@@ -6513,9 +6615,7 @@ function fillet$1(shape2, edges, radius) {
|
|
|
6513
6615
|
if (!shapeTypes.isShape3D(cast)) {
|
|
6514
6616
|
return result.err(result.kernelError(result.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
6515
6617
|
}
|
|
6516
|
-
|
|
6517
|
-
booleanFns.propagateFaceTagsFromEvolution(evolution, [shape2], cast);
|
|
6518
|
-
booleanFns.propagateColorsFromEvolution(evolution, [shape2], cast);
|
|
6618
|
+
booleanFns.propagateAllMetadata(evolution, [shape2], cast);
|
|
6519
6619
|
return result.ok(cast);
|
|
6520
6620
|
} catch (e) {
|
|
6521
6621
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -6553,7 +6653,7 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
6553
6653
|
)
|
|
6554
6654
|
);
|
|
6555
6655
|
}
|
|
6556
|
-
const selectedEdges = edges ??
|
|
6656
|
+
const selectedEdges = edges ?? topologyQueryFns.getEdges(shape2);
|
|
6557
6657
|
if (selectedEdges.length === 0) {
|
|
6558
6658
|
return result.err(result.validationError(result.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
6559
6659
|
}
|
|
@@ -6590,7 +6690,7 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
6590
6690
|
)
|
|
6591
6691
|
);
|
|
6592
6692
|
}
|
|
6593
|
-
const inputFaceHashes = collectInputFaceHashes([shape2]);
|
|
6693
|
+
const inputFaceHashes = booleanFns.collectInputFaceHashes([shape2]);
|
|
6594
6694
|
const { shape: resultShape, evolution } = shapeTypes.getKernel().chamferWithHistory(
|
|
6595
6695
|
shape2.wrapped,
|
|
6596
6696
|
filteredEdges.map((e) => e.wrapped),
|
|
@@ -6602,9 +6702,7 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
6602
6702
|
if (!shapeTypes.isShape3D(cast)) {
|
|
6603
6703
|
return result.err(result.kernelError(result.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
6604
6704
|
}
|
|
6605
|
-
|
|
6606
|
-
booleanFns.propagateFaceTagsFromEvolution(evolution, [shape2], cast);
|
|
6607
|
-
booleanFns.propagateColorsFromEvolution(evolution, [shape2], cast);
|
|
6705
|
+
booleanFns.propagateAllMetadata(evolution, [shape2], cast);
|
|
6608
6706
|
return result.ok(cast);
|
|
6609
6707
|
} catch (e) {
|
|
6610
6708
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -6627,7 +6725,7 @@ function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
|
|
|
6627
6725
|
return result.err(result.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
6628
6726
|
}
|
|
6629
6727
|
try {
|
|
6630
|
-
const inputFaceHashes = collectInputFaceHashes([shape2]);
|
|
6728
|
+
const inputFaceHashes = booleanFns.collectInputFaceHashes([shape2]);
|
|
6631
6729
|
const { shape: resultShape, evolution } = shapeTypes.getKernel().shellWithHistory(
|
|
6632
6730
|
shape2.wrapped,
|
|
6633
6731
|
faces.map((f) => f.wrapped),
|
|
@@ -6640,9 +6738,7 @@ function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
|
|
|
6640
6738
|
if (!shapeTypes.isShape3D(cast)) {
|
|
6641
6739
|
return result.err(result.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
6642
6740
|
}
|
|
6643
|
-
|
|
6644
|
-
booleanFns.propagateFaceTagsFromEvolution(evolution, [shape2], cast);
|
|
6645
|
-
booleanFns.propagateColorsFromEvolution(evolution, [shape2], cast);
|
|
6741
|
+
booleanFns.propagateAllMetadata(evolution, [shape2], cast);
|
|
6646
6742
|
return result.ok(cast);
|
|
6647
6743
|
} catch (e) {
|
|
6648
6744
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -6662,7 +6758,7 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
|
6662
6758
|
return result.err(result.validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
6663
6759
|
}
|
|
6664
6760
|
try {
|
|
6665
|
-
const inputFaceHashes = collectInputFaceHashes([shape2]);
|
|
6761
|
+
const inputFaceHashes = booleanFns.collectInputFaceHashes([shape2]);
|
|
6666
6762
|
const { shape: resultShape, evolution } = shapeTypes.getKernel().offsetWithHistory(
|
|
6667
6763
|
shape2.wrapped,
|
|
6668
6764
|
distance,
|
|
@@ -6674,9 +6770,7 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
|
6674
6770
|
if (!shapeTypes.isShape3D(cast)) {
|
|
6675
6771
|
return result.err(result.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
6676
6772
|
}
|
|
6677
|
-
|
|
6678
|
-
booleanFns.propagateFaceTagsFromEvolution(evolution, [shape2], cast);
|
|
6679
|
-
booleanFns.propagateColorsFromEvolution(evolution, [shape2], cast);
|
|
6773
|
+
booleanFns.propagateAllMetadata(evolution, [shape2], cast);
|
|
6680
6774
|
return result.ok(cast);
|
|
6681
6775
|
} catch (e) {
|
|
6682
6776
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -6684,27 +6778,27 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
|
6684
6778
|
}
|
|
6685
6779
|
}
|
|
6686
6780
|
function translate(shape2, v) {
|
|
6687
|
-
return
|
|
6781
|
+
return topology.translate(resolve(shape2), v);
|
|
6688
6782
|
}
|
|
6689
6783
|
function rotate(shape2, angle, options) {
|
|
6690
6784
|
const pivotPoint = options?.at;
|
|
6691
|
-
return
|
|
6785
|
+
return topology.rotate(resolve(shape2), angle, pivotPoint, options?.axis);
|
|
6692
6786
|
}
|
|
6693
6787
|
function mirror(shape2, options) {
|
|
6694
6788
|
const planeOrigin = options?.at;
|
|
6695
|
-
return
|
|
6789
|
+
return topology.mirror(resolve(shape2), options?.normal ?? [1, 0, 0], planeOrigin);
|
|
6696
6790
|
}
|
|
6697
6791
|
function scale(shape2, factor, options) {
|
|
6698
|
-
return
|
|
6792
|
+
return topology.scale(resolve(shape2), factor, options?.center);
|
|
6699
6793
|
}
|
|
6700
6794
|
function clone(shape2) {
|
|
6701
6795
|
return shapeFns.clone(resolve(shape2));
|
|
6702
6796
|
}
|
|
6703
6797
|
function applyMatrix(shape2, matrix) {
|
|
6704
|
-
return
|
|
6798
|
+
return topology.applyMatrix(resolve(shape2), matrix);
|
|
6705
6799
|
}
|
|
6706
6800
|
function transformCopy(shape2, composed) {
|
|
6707
|
-
return
|
|
6801
|
+
return topology.transformCopy(resolve(shape2), composed);
|
|
6708
6802
|
}
|
|
6709
6803
|
function fuse(a, b, options) {
|
|
6710
6804
|
return booleanFns.fuse(resolve(a), resolve(b), options);
|
|
@@ -6733,7 +6827,7 @@ function resolveEdges(edgesOrFn, shape2) {
|
|
|
6733
6827
|
if (typeof edgesOrFn === "object" && "findAll" in edgesOrFn) {
|
|
6734
6828
|
return edgesOrFn.findAll(shape2);
|
|
6735
6829
|
}
|
|
6736
|
-
const finder = edgesOrFn(
|
|
6830
|
+
const finder = edgesOrFn(helpers.edgeFinder());
|
|
6737
6831
|
return finder.findAll(shape2);
|
|
6738
6832
|
}
|
|
6739
6833
|
function resolveFaces(facesOrFn, shape2) {
|
|
@@ -6787,7 +6881,7 @@ function chamfer(shape2, edgesOrDistance, maybeDistance) {
|
|
|
6787
6881
|
}
|
|
6788
6882
|
const normalized = normalizeChamferDistance(distance);
|
|
6789
6883
|
if (normalized.mode === "distAngle") {
|
|
6790
|
-
const selectedEdges = edges ??
|
|
6884
|
+
const selectedEdges = edges ?? topologyQueryFns.getEdges(s);
|
|
6791
6885
|
return topology.chamferDistAngle(
|
|
6792
6886
|
s,
|
|
6793
6887
|
[...selectedEdges],
|
|
@@ -6821,7 +6915,7 @@ function meshEdges(shape2, options) {
|
|
|
6821
6915
|
return meshFns.meshEdges(resolve(shape2), options);
|
|
6822
6916
|
}
|
|
6823
6917
|
function describe(shape2) {
|
|
6824
|
-
return
|
|
6918
|
+
return topologyQueryFns.describe(resolve(shape2));
|
|
6825
6919
|
}
|
|
6826
6920
|
function toBREP(shape2) {
|
|
6827
6921
|
return shapeFns.toBREP(resolve(shape2));
|
|
@@ -6865,11 +6959,11 @@ function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 }
|
|
|
6865
6959
|
function extrude(face, height) {
|
|
6866
6960
|
const f = resolve(face);
|
|
6867
6961
|
const vec = typeof height === "number" ? [0, 0, height] : height;
|
|
6868
|
-
return
|
|
6962
|
+
return extrude$1(f, vec);
|
|
6869
6963
|
}
|
|
6870
6964
|
function revolve(face, options) {
|
|
6871
6965
|
const pivotPoint = options?.at ?? [0, 0, 0];
|
|
6872
|
-
return
|
|
6966
|
+
return revolve$1(
|
|
6873
6967
|
resolve(face),
|
|
6874
6968
|
pivotPoint,
|
|
6875
6969
|
options?.axis ?? [0, 0, 1],
|
|
@@ -6882,7 +6976,7 @@ function loft(wires, options) {
|
|
|
6882
6976
|
}
|
|
6883
6977
|
function resolveTargetFace(shape2, faceSpec) {
|
|
6884
6978
|
if (faceSpec === void 0) {
|
|
6885
|
-
const faces =
|
|
6979
|
+
const faces = topologyQueryFns.getFaces(shape2);
|
|
6886
6980
|
if (faces.length === 0) {
|
|
6887
6981
|
return result.err(
|
|
6888
6982
|
result.validationError(result.BrepErrorCode.COMPOUND_NO_FACES, "compoundOps: shape has no faces")
|
|
@@ -6937,7 +7031,7 @@ function drill(shape2, options) {
|
|
|
6937
7031
|
if (options.depth !== void 0) {
|
|
6938
7032
|
tool = solidBuilders.makeCylinder(radius, options.depth, pos, dir);
|
|
6939
7033
|
} else {
|
|
6940
|
-
const b =
|
|
7034
|
+
const b = topologyQueryFns.getBounds(s);
|
|
6941
7035
|
const corners = [
|
|
6942
7036
|
[b.xMin, b.yMin, b.zMin],
|
|
6943
7037
|
[b.xMax, b.yMin, b.zMin],
|
|
@@ -6978,7 +7072,7 @@ function pocket(shape2, options) {
|
|
|
6978
7072
|
const faceResult = surfaceBuilders.makeFace(w);
|
|
6979
7073
|
if (result.isErr(faceResult)) return faceResult;
|
|
6980
7074
|
const extDir = vecOps.vecScale(vecOps.vecNormalize(normal), -depth);
|
|
6981
|
-
const toolResult =
|
|
7075
|
+
const toolResult = extrude$1(faceResult.value, extDir);
|
|
6982
7076
|
if (result.isErr(toolResult)) return toolResult;
|
|
6983
7077
|
return booleanFns.cut(s, toolResult.value);
|
|
6984
7078
|
}
|
|
@@ -6996,7 +7090,7 @@ function boss(shape2, options) {
|
|
|
6996
7090
|
const faceResult = surfaceBuilders.makeFace(w);
|
|
6997
7091
|
if (result.isErr(faceResult)) return faceResult;
|
|
6998
7092
|
const extDir = vecOps.vecScale(vecOps.vecNormalize(normal), height);
|
|
6999
|
-
const toolResult =
|
|
7093
|
+
const toolResult = extrude$1(faceResult.value, extDir);
|
|
7000
7094
|
if (result.isErr(toolResult)) return toolResult;
|
|
7001
7095
|
return booleanFns.fuse(s, toolResult.value);
|
|
7002
7096
|
}
|
|
@@ -7004,7 +7098,7 @@ function mirrorJoin(shape2, options) {
|
|
|
7004
7098
|
const s = resolve(shape2);
|
|
7005
7099
|
const normal = options?.normal ?? [1, 0, 0];
|
|
7006
7100
|
const planeOrigin = options?.at;
|
|
7007
|
-
const mirrored =
|
|
7101
|
+
const mirrored = topology.mirror(s, normal, planeOrigin);
|
|
7008
7102
|
return booleanFns.fuse(s, mirrored);
|
|
7009
7103
|
}
|
|
7010
7104
|
function rectangularPattern(shape2, options) {
|
|
@@ -7031,7 +7125,7 @@ function rectangularPattern(shape2, options) {
|
|
|
7031
7125
|
xNorm[1] * xSpacing * xi + yNorm[1] * ySpacing * yi,
|
|
7032
7126
|
xNorm[2] * xSpacing * xi + yNorm[2] * ySpacing * yi
|
|
7033
7127
|
];
|
|
7034
|
-
copies.push(
|
|
7128
|
+
copies.push(topology.translate(s, offset2));
|
|
7035
7129
|
}
|
|
7036
7130
|
}
|
|
7037
7131
|
return booleanFns.fuseAll(copies);
|
|
@@ -7078,7 +7172,7 @@ function createWrappedBase(val) {
|
|
|
7078
7172
|
rotateX: (a) => wrapAny(rotate(val, a, { axis: [1, 0, 0] })),
|
|
7079
7173
|
rotateY: (a) => wrapAny(rotate(val, a, { axis: [0, 1, 0] })),
|
|
7080
7174
|
rotateZ: (a) => wrapAny(rotate(val, a, { axis: [0, 0, 1] })),
|
|
7081
|
-
bounds: () =>
|
|
7175
|
+
bounds: () => topologyQueryFns.getBounds(val),
|
|
7082
7176
|
describe: () => describe(val),
|
|
7083
7177
|
clone: () => wrapAny(clone(val)),
|
|
7084
7178
|
// Meshing & Rendering
|
|
@@ -7139,10 +7233,10 @@ function createWrapped3D(val) {
|
|
|
7139
7233
|
volumeProps: () => measurement.measureVolumeProps(val),
|
|
7140
7234
|
surfaceProps: () => measurement.measureSurfaceProps(val),
|
|
7141
7235
|
// Queries
|
|
7142
|
-
edges: () =>
|
|
7143
|
-
faces: () =>
|
|
7144
|
-
wires: () =>
|
|
7145
|
-
vertices: () =>
|
|
7236
|
+
edges: () => topologyQueryFns.getEdges(val),
|
|
7237
|
+
faces: () => topologyQueryFns.getFaces(val),
|
|
7238
|
+
wires: () => topologyQueryFns.getWires(val),
|
|
7239
|
+
vertices: () => topologyQueryFns.getVertices(val),
|
|
7146
7240
|
// Patterns
|
|
7147
7241
|
linearPattern: (dir, count, spacing) => wrap3D(unwrapOrThrow(operations.linearPattern(val, dir, count, spacing))),
|
|
7148
7242
|
circularPattern: (axis, count, angle) => wrap3D(unwrapOrThrow(operations.circularPattern(val, axis, count, angle)))
|
|
@@ -7209,7 +7303,6 @@ exports.as2D = shapeTypes.as2D;
|
|
|
7209
7303
|
exports.as3D = shapeTypes.as3D;
|
|
7210
7304
|
exports.castShape = shapeTypes.castShape;
|
|
7211
7305
|
exports.castShape3D = shapeTypes.castShape3D;
|
|
7212
|
-
exports.closedWire = shapeTypes.closedWire;
|
|
7213
7306
|
exports.createCompound = shapeTypes.createCompound;
|
|
7214
7307
|
exports.createEdge = shapeTypes.createEdge;
|
|
7215
7308
|
exports.createFace = shapeTypes.createFace;
|
|
@@ -7219,29 +7312,25 @@ exports.createShell = shapeTypes.createShell;
|
|
|
7219
7312
|
exports.createSolid = shapeTypes.createSolid;
|
|
7220
7313
|
exports.createVertex = shapeTypes.createVertex;
|
|
7221
7314
|
exports.createWire = shapeTypes.createWire;
|
|
7315
|
+
exports.findCurveType = shapeTypes.findCurveType;
|
|
7316
|
+
exports.getDisposalStats = shapeTypes.getDisposalStats;
|
|
7222
7317
|
exports.getKernel = shapeTypes.getKernel;
|
|
7223
7318
|
exports.getShapeKind = shapeTypes.getShapeKind;
|
|
7224
7319
|
exports.initFromOC = shapeTypes.initFromOC;
|
|
7225
7320
|
exports.is2D = shapeTypes.is2D;
|
|
7226
7321
|
exports.is3D = shapeTypes.is3D;
|
|
7227
|
-
exports.isClosedWire = shapeTypes.isClosedWire;
|
|
7228
7322
|
exports.isCompound = shapeTypes.isCompound;
|
|
7229
7323
|
exports.isEdge = shapeTypes.isEdge;
|
|
7230
7324
|
exports.isFace = shapeTypes.isFace;
|
|
7231
7325
|
exports.isLive = shapeTypes.isLive;
|
|
7232
|
-
exports.isManifoldShell = shapeTypes.isManifoldShell;
|
|
7233
|
-
exports.isOrientedFace = shapeTypes.isOrientedFace;
|
|
7234
7326
|
exports.isShape1D = shapeTypes.isShape1D;
|
|
7235
7327
|
exports.isShape3D = shapeTypes.isShape3D;
|
|
7236
7328
|
exports.isShell = shapeTypes.isShell;
|
|
7237
7329
|
exports.isSolid = shapeTypes.isSolid;
|
|
7238
|
-
exports.isValidSolid = shapeTypes.isValidSolid;
|
|
7239
7330
|
exports.isVertex = shapeTypes.isVertex;
|
|
7240
7331
|
exports.isWire = shapeTypes.isWire;
|
|
7241
|
-
exports.manifoldShell = shapeTypes.manifoldShell;
|
|
7242
|
-
exports.orientedFace = shapeTypes.orientedFace;
|
|
7243
7332
|
exports.registerKernel = shapeTypes.registerKernel;
|
|
7244
|
-
exports.
|
|
7333
|
+
exports.resetDisposalStats = shapeTypes.resetDisposalStats;
|
|
7245
7334
|
exports.withKernel = shapeTypes.withKernel;
|
|
7246
7335
|
exports.withScope = shapeTypes.withScope;
|
|
7247
7336
|
exports.withScopeResult = shapeTypes.withScopeResult;
|
|
@@ -7256,12 +7345,14 @@ exports.collect = result.collect;
|
|
|
7256
7345
|
exports.computationError = result.computationError;
|
|
7257
7346
|
exports.err = result.err;
|
|
7258
7347
|
exports.flatMap = result.flatMap;
|
|
7348
|
+
exports.flatten = result.flatten;
|
|
7259
7349
|
exports.fromNullable = result.fromNullable;
|
|
7260
7350
|
exports.ioError = result.ioError;
|
|
7261
7351
|
exports.isErr = result.isErr;
|
|
7262
7352
|
exports.isOk = result.isOk;
|
|
7263
7353
|
exports.kernelError = result.kernelError;
|
|
7264
7354
|
exports.map = result.map;
|
|
7355
|
+
exports.mapBoth = result.mapBoth;
|
|
7265
7356
|
exports.mapErr = result.mapErr;
|
|
7266
7357
|
exports.match = result.match;
|
|
7267
7358
|
exports.moduleInitError = result.moduleInitError;
|
|
@@ -7302,13 +7393,12 @@ exports.vecRepr = vecOps.vecRepr;
|
|
|
7302
7393
|
exports.vecRotate = vecOps.vecRotate;
|
|
7303
7394
|
exports.vecScale = vecOps.vecScale;
|
|
7304
7395
|
exports.vecSub = vecOps.vecSub;
|
|
7305
|
-
exports.
|
|
7306
|
-
exports.
|
|
7307
|
-
exports.
|
|
7308
|
-
exports.
|
|
7309
|
-
exports.
|
|
7310
|
-
exports.
|
|
7311
|
-
exports.revolution = loft$2.revolution;
|
|
7396
|
+
exports.createNamedPlane = vectors.createNamedPlane;
|
|
7397
|
+
exports.createPlane = vectors.createPlane;
|
|
7398
|
+
exports.makePlane = vectors.makePlane;
|
|
7399
|
+
exports.pivotPlane = vectors.pivotPlane;
|
|
7400
|
+
exports.resolvePlane = vectors.resolvePlane;
|
|
7401
|
+
exports.translatePlane = vectors.translatePlane;
|
|
7312
7402
|
exports.addChild = operations.addChild;
|
|
7313
7403
|
exports.addStep = operations.addStep;
|
|
7314
7404
|
exports.circularPattern = operations.circularPattern;
|
|
@@ -7324,8 +7414,10 @@ exports.exportAssemblySTEP = operations.exportAssemblySTEP;
|
|
|
7324
7414
|
exports.findNode = operations.findNode;
|
|
7325
7415
|
exports.findStep = operations.findStep;
|
|
7326
7416
|
exports.getHistoryShape = operations.getShape;
|
|
7417
|
+
exports.guidedSweep = operations.guidedSweep;
|
|
7327
7418
|
exports.linearPattern = operations.linearPattern;
|
|
7328
7419
|
exports.modifyStep = operations.modifyStep;
|
|
7420
|
+
exports.multiSectionSweep = operations.multiSectionSweep;
|
|
7329
7421
|
exports.registerOperation = operations.registerOperation;
|
|
7330
7422
|
exports.registerShape = operations.registerShape;
|
|
7331
7423
|
exports.removeChild = operations.removeChild;
|
|
@@ -7340,6 +7432,9 @@ exports.twistExtrude = operations.twistExtrude;
|
|
|
7340
7432
|
exports.undoLast = operations.undoLast;
|
|
7341
7433
|
exports.updateNode = operations.updateNode;
|
|
7342
7434
|
exports.walkAssembly = operations.walkAssembly;
|
|
7435
|
+
exports.Blueprint = Blueprint.Blueprint;
|
|
7436
|
+
exports.BoundingBox2d = Blueprint.BoundingBox2d;
|
|
7437
|
+
exports.Curve2D = Blueprint.Curve2D;
|
|
7343
7438
|
exports.BaseSketcher2d = boolean2D.BaseSketcher2d;
|
|
7344
7439
|
exports.BlueprintSketcher = boolean2D.BlueprintSketcher;
|
|
7345
7440
|
exports.Blueprints = boolean2D.Blueprints;
|
|
@@ -7376,8 +7471,10 @@ exports.sketch2DOnPlane = _2d.sketch2DOnPlane;
|
|
|
7376
7471
|
exports.stretch2D = _2d.stretch2D;
|
|
7377
7472
|
exports.toSVGPathD = _2d.toSVGPathD;
|
|
7378
7473
|
exports.translate2D = _2d.translate2D;
|
|
7474
|
+
exports.edgeFinder = helpers.edgeFinder;
|
|
7379
7475
|
exports.faceFinder = helpers.faceFinder;
|
|
7380
7476
|
exports.getSingleFace = helpers.getSingleFace;
|
|
7477
|
+
exports.wireFinder = helpers.wireFinder;
|
|
7381
7478
|
exports.blueprintToDXF = io.blueprintToDXF;
|
|
7382
7479
|
exports.exportDXF = io.exportDXF;
|
|
7383
7480
|
exports.exportGlb = io.exportGlb;
|
|
@@ -7453,29 +7550,9 @@ exports.translateDrawing = drawFns.translateDrawing;
|
|
|
7453
7550
|
exports.resolveDirection = types.resolveDirection;
|
|
7454
7551
|
exports.toVec2 = types.toVec2;
|
|
7455
7552
|
exports.toVec3 = types.toVec3;
|
|
7456
|
-
exports.createNamedPlane = vectors.createNamedPlane;
|
|
7457
|
-
exports.createPlane = vectors.createPlane;
|
|
7458
|
-
exports.pivotPlane = vectors.pivotPlane;
|
|
7459
|
-
exports.resolvePlane = vectors.resolvePlane;
|
|
7460
|
-
exports.translatePlane = vectors.translatePlane;
|
|
7461
|
-
exports.composeTransforms = shapeFns.composeTransforms;
|
|
7462
|
-
exports.getBounds = shapeFns.getBounds;
|
|
7463
|
-
exports.getEdges = shapeFns.getEdges;
|
|
7464
|
-
exports.getFaceOrigins = shapeFns.getFaceOrigins;
|
|
7465
|
-
exports.getFaces = shapeFns.getFaces;
|
|
7466
7553
|
exports.getHashCode = shapeFns.getHashCode;
|
|
7467
|
-
exports.getVertices = shapeFns.getVertices;
|
|
7468
|
-
exports.getWires = shapeFns.getWires;
|
|
7469
|
-
exports.invalidateShapeCache = shapeFns.invalidateShapeCache;
|
|
7470
7554
|
exports.isEqualShape = shapeFns.isEqualShape;
|
|
7471
7555
|
exports.isSameShape = shapeFns.isSameShape;
|
|
7472
|
-
exports.iterEdges = shapeFns.iterEdges;
|
|
7473
|
-
exports.iterFaces = shapeFns.iterFaces;
|
|
7474
|
-
exports.iterVertices = shapeFns.iterVertices;
|
|
7475
|
-
exports.iterWires = shapeFns.iterWires;
|
|
7476
|
-
exports.resize = shapeFns.resize;
|
|
7477
|
-
exports.setShapeOrigin = shapeFns.setShapeOrigin;
|
|
7478
|
-
exports.vertexPosition = shapeFns.vertexPosition;
|
|
7479
7556
|
exports.colorFaces = booleanFns.colorFaces;
|
|
7480
7557
|
exports.colorShape = booleanFns.colorShape;
|
|
7481
7558
|
exports.cutAll = booleanFns.cutAll;
|
|
@@ -7495,6 +7572,7 @@ exports.box = topology.box;
|
|
|
7495
7572
|
exports.bsplineApprox = topology.bsplineApprox;
|
|
7496
7573
|
exports.chamferDistAngleShape = topology.chamferDistAngle;
|
|
7497
7574
|
exports.circle = topology.circle;
|
|
7575
|
+
exports.composeTransforms = topology.composeTransforms;
|
|
7498
7576
|
exports.compound = topology.compound;
|
|
7499
7577
|
exports.cone = topology.cone;
|
|
7500
7578
|
exports.cylinder = topology.cylinder;
|
|
@@ -7512,6 +7590,7 @@ exports.helix = topology.helix;
|
|
|
7512
7590
|
exports.line = topology.line;
|
|
7513
7591
|
exports.offsetFace = topology.offsetFace;
|
|
7514
7592
|
exports.polygon = topology.polygon;
|
|
7593
|
+
exports.resize = topology.resize;
|
|
7515
7594
|
exports.sewShells = topology.sewShells;
|
|
7516
7595
|
exports.sharedEdges = topology.sharedEdges;
|
|
7517
7596
|
exports.solid = topology.solid;
|
|
@@ -7568,6 +7647,17 @@ exports.createMeshCache = meshFns.createMeshCache;
|
|
|
7568
7647
|
exports.exportIGES = meshFns.exportIGES;
|
|
7569
7648
|
exports.exportSTEP = meshFns.exportSTEP;
|
|
7570
7649
|
exports.exportSTL = meshFns.exportSTL;
|
|
7650
|
+
exports.getBounds = topologyQueryFns.getBounds;
|
|
7651
|
+
exports.getEdges = topologyQueryFns.getEdges;
|
|
7652
|
+
exports.getFaces = topologyQueryFns.getFaces;
|
|
7653
|
+
exports.getVertices = topologyQueryFns.getVertices;
|
|
7654
|
+
exports.getWires = topologyQueryFns.getWires;
|
|
7655
|
+
exports.invalidateShapeCache = topologyQueryFns.invalidateShapeCache;
|
|
7656
|
+
exports.iterEdges = topologyQueryFns.iterEdges;
|
|
7657
|
+
exports.iterFaces = topologyQueryFns.iterFaces;
|
|
7658
|
+
exports.iterVertices = topologyQueryFns.iterVertices;
|
|
7659
|
+
exports.iterWires = topologyQueryFns.iterWires;
|
|
7660
|
+
exports.vertexPosition = topologyQueryFns.vertexPosition;
|
|
7571
7661
|
exports.createDistanceQuery = measurement.createDistanceQuery;
|
|
7572
7662
|
exports.measureArea = measurement.measureArea;
|
|
7573
7663
|
exports.measureCurvatureAt = measurement.measureCurvatureAt;
|
|
@@ -7579,8 +7669,15 @@ exports.measureSurfaceProps = measurement.measureSurfaceProps;
|
|
|
7579
7669
|
exports.measureVolume = measurement.measureVolume;
|
|
7580
7670
|
exports.measureVolumeProps = measurement.measureVolumeProps;
|
|
7581
7671
|
exports.fill = surfaceBuilders.fill;
|
|
7582
|
-
exports.
|
|
7583
|
-
exports.
|
|
7672
|
+
exports.closedWire = core.closedWire;
|
|
7673
|
+
exports.isClosedWire = core.isClosedWire;
|
|
7674
|
+
exports.isManifoldShell = core.isManifoldShell;
|
|
7675
|
+
exports.isOrientedFace = core.isOrientedFace;
|
|
7676
|
+
exports.isValidSolid = core.isValidSolid;
|
|
7677
|
+
exports.manifoldShell = core.manifoldShell;
|
|
7678
|
+
exports.orientedFace = core.orientedFace;
|
|
7679
|
+
exports.validSolid = core.validSolid;
|
|
7680
|
+
exports.cornerFinder = query.cornerFinder;
|
|
7584
7681
|
exports.createOperationRegistry = worker.createOperationRegistry;
|
|
7585
7682
|
exports.createTaskQueue = worker.createTaskQueue;
|
|
7586
7683
|
exports.createWorkerClient = worker.createWorkerClient;
|
|
@@ -7596,6 +7693,8 @@ exports.isSuccessResponse = worker.isSuccessResponse;
|
|
|
7596
7693
|
exports.pendingCount = worker.pendingCount;
|
|
7597
7694
|
exports.registerHandler = worker.registerHandler;
|
|
7598
7695
|
exports.rejectAll = worker.rejectAll;
|
|
7696
|
+
exports.getFaceOrigins = originTrackingFns.getFaceOrigins;
|
|
7697
|
+
exports.setShapeOrigin = originTrackingFns.setShapeOrigin;
|
|
7599
7698
|
exports.BrepWrapperError = BrepWrapperError;
|
|
7600
7699
|
exports.BrepkitAdapter = BrepkitAdapter;
|
|
7601
7700
|
exports.addMate = addMate;
|
|
@@ -7612,13 +7711,11 @@ exports.describe = describe;
|
|
|
7612
7711
|
exports.drill = drill;
|
|
7613
7712
|
exports.extrude = extrude;
|
|
7614
7713
|
exports.fillet = fillet;
|
|
7615
|
-
exports.findCurveType = findCurveType;
|
|
7616
7714
|
exports.fromBREP = fromBREP;
|
|
7617
7715
|
exports.fromKernelDir = fromKernelDir;
|
|
7618
7716
|
exports.fromKernelPnt = fromKernelPnt;
|
|
7619
7717
|
exports.fromKernelVec = fromKernelVec;
|
|
7620
7718
|
exports.fuse = fuse;
|
|
7621
|
-
exports.guidedSweep = guidedSweep;
|
|
7622
7719
|
exports.heal = heal;
|
|
7623
7720
|
exports.hull = hull;
|
|
7624
7721
|
exports.importDXF = importDXF;
|
|
@@ -7639,7 +7736,6 @@ exports.meshEdges = meshEdges;
|
|
|
7639
7736
|
exports.minkowski = minkowski;
|
|
7640
7737
|
exports.mirror = mirror;
|
|
7641
7738
|
exports.mirrorJoin = mirrorJoin;
|
|
7642
|
-
exports.multiSectionSweep = multiSectionSweep;
|
|
7643
7739
|
exports.offset = offset;
|
|
7644
7740
|
exports.pocket = pocket;
|
|
7645
7741
|
exports.polyhedron = polyhedron;
|
|
@@ -7668,7 +7764,6 @@ exports.toKernelVec = toKernelVec;
|
|
|
7668
7764
|
exports.transformCopy = transformCopy;
|
|
7669
7765
|
exports.translate = translate;
|
|
7670
7766
|
exports.vertexFinder = vertexFinder;
|
|
7671
|
-
exports.wireFinder = wireFinder;
|
|
7672
7767
|
exports.withKernelDir = withKernelDir;
|
|
7673
7768
|
exports.withKernelPnt = withKernelPnt;
|
|
7674
7769
|
exports.withKernelVec = withKernelVec;
|