brepjs 12.8.2 → 12.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d/blueprints/{approximations.d.ts → blueprintApproximations.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintApproximations.d.ts.map +1 -0
- package/dist/2d/blueprints/{customCorners.d.ts → blueprintCustomCorners.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +1 -0
- package/dist/2d/blueprints/blueprintFns.d.ts +17 -3
- package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
- package/dist/2d/blueprints/{offset.d.ts → blueprintOffset.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintOffset.d.ts.map +1 -0
- package/dist/2d/blueprints/index.d.ts +4 -4
- package/dist/2d/blueprints/index.d.ts.map +1 -1
- package/dist/2d/lib/Curve2D.d.ts +1 -1
- package/dist/2d/lib/Curve2D.d.ts.map +1 -1
- 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-CzEysb7A.js +108 -0
- package/dist/2d-DCxS_sb_.cjs +107 -0
- package/dist/2d.cjs +24 -88
- package/dist/2d.d.ts +1 -1
- package/dist/2d.js +34 -99
- package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-BoC0DsDm.cjs} +15 -45
- package/dist/{Blueprint-DbVaf6k7.js → Blueprint-CQNRtmYG.js} +33 -63
- package/dist/{boolean2D-y3E92F0u.js → boolean2D-DXAt4GAK.js} +132 -62
- package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-N9Pgumgg.cjs} +112 -42
- package/dist/{booleanFns-BCTjYZAg.js → booleanFns-BXV7Oh0h.js} +53 -50
- package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-CxArUj_q.cjs} +43 -40
- package/dist/brepjs.cjs +448 -379
- package/dist/brepjs.js +1634 -1563
- 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 +7 -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/{definitionMaps.d.ts → typeDiscriminants.d.ts} +5 -1
- 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 +119 -76
- package/dist/{curveFns-BZngcnQ1.cjs → curveFns-CWZRuXQ3.cjs} +2 -2
- package/dist/{curveFns-mROFhiuG.js → curveFns-OmbtFSG8.js} +14 -14
- package/dist/{drawFns-Bwakrq7w.js → drawFns-8S0ULGRj.js} +146 -118
- package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-voV2wEp8.cjs} +153 -125
- package/dist/{faceFns-B8GnxjdY.js → faceFns-Bn2seBfp.js} +16 -24
- package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-CmIrjdt1.cjs} +2 -10
- package/dist/{helpers-X0juxnwj.js → helpers-CEn618MW.js} +89 -21
- package/dist/{helpers-C8NoT0Wu.cjs → helpers-mipaxDTy.cjs} +77 -9
- package/dist/index.d.ts +20 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/io/gltfImportFns.d.ts +18 -0
- package/dist/io/gltfImportFns.d.ts.map +1 -0
- package/dist/io/ioUtils.d.ts +16 -0
- package/dist/io/ioUtils.d.ts.map +1 -0
- package/dist/io/objImportFns.d.ts.map +1 -1
- package/dist/io/threemfImportFns.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/builder-ops.d.ts +57 -0
- package/dist/kernel/interfaces/builder-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/core.d.ts +30 -0
- package/dist/kernel/interfaces/core.d.ts.map +1 -0
- package/dist/kernel/interfaces/curve-ops.d.ts +41 -0
- package/dist/kernel/interfaces/curve-ops.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/index.d.ts +37 -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/primitive-ops.d.ts +13 -0
- package/dist/kernel/interfaces/primitive-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/surface-ops.d.ts +50 -0
- package/dist/kernel/interfaces/surface-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 +35 -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/measurement/measureCache.d.ts +11 -9
- package/dist/measurement/measureCache.d.ts.map +1 -1
- package/dist/measurement/measureFns.d.ts +24 -71
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/measurement/measureTypes.d.ts +30 -0
- package/dist/measurement/measureTypes.d.ts.map +1 -0
- package/dist/{measurement-D8EJ694A.js → measurement-fJWDEpz0.js} +53 -34
- package/dist/measurement-ph-kanQ7.cjs +154 -0
- package/dist/measurement.cjs +2 -1
- package/dist/measurement.d.ts +1 -1
- package/dist/measurement.d.ts.map +1 -1
- package/dist/measurement.js +4 -3
- package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-B9p4EVV8.cjs} +4 -4
- package/dist/{meshFns-nQjK38EC.js → meshFns-D0qIoxm-.js} +3 -3
- package/dist/operations/compoundOpsFns.d.ts +38 -0
- package/dist/operations/compoundOpsFns.d.ts.map +1 -0
- package/dist/operations/convexHullFns.d.ts +21 -0
- package/dist/operations/convexHullFns.d.ts.map +1 -0
- 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/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/straightSkeleton.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-DX_qy_TB.js} +29 -177
- package/dist/{operations-CYpmLSC4.cjs → operations-Ds4xoyxR.cjs} +6 -154
- package/dist/operations.cjs +6 -10
- package/dist/operations.d.ts +0 -2
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +26 -30
- package/dist/originTrackingFns-BOCAMfd0.js +137 -0
- package/dist/originTrackingFns-SPU7ly3_.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-BaSD1fqR.js → result-CoDaWsvc.js} +48 -90
- package/dist/{result-fAX0OZzI.cjs → result-DULetAht.cjs} +17 -59
- package/dist/result.cjs +1 -1
- package/dist/result.js +23 -23
- package/dist/shapeFns-BZ6zk7nd.js +34 -0
- package/dist/shapeFns-bRkrwI8R.cjs +33 -0
- package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-T0n6mRmt.cjs} +170 -137
- package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-dhhm-T5A.js} +205 -172
- package/dist/sketching/CompoundSketch.d.ts +4 -4
- package/dist/sketching/CompoundSketch.d.ts.map +1 -1
- package/dist/sketching/Sketch.d.ts +3 -3
- package/dist/sketching/Sketch.d.ts.map +1 -1
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketches.d.ts +1 -1
- package/dist/sketching/Sketches.d.ts.map +1 -1
- package/dist/sketching/draw.d.ts +1 -20
- package/dist/sketching/draw.d.ts.map +1 -1
- package/dist/sketching/draw3d.d.ts +22 -0
- package/dist/sketching/draw3d.d.ts.map +1 -0
- package/dist/sketching/sketchFns.d.ts +3 -3
- package/dist/sketching/sketchFns.d.ts.map +1 -1
- package/dist/sketching/sketchLib.d.ts +2 -2
- package/dist/sketching/sketchLib.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.d.ts +2 -1
- package/dist/sketching.d.ts.map +1 -1
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BEAoLYvr.cjs} +3 -3
- package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-tVmD3R7Z.js} +12 -12
- package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-DYS8AMSS.cjs} +3 -3
- package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dl0ATFbO.js} +15 -15
- package/dist/sweepFns-BKnQs59A.js +215 -0
- package/dist/sweepFns-COqeYIUp.cjs +214 -0
- package/dist/text/textBlueprints.d.ts +4 -3
- package/dist/text/textBlueprints.d.ts.map +1 -1
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/cast.d.ts +1 -5
- package/dist/topology/cast.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/curveFns.d.ts +1 -1
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +2 -3
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/{colorFns.d.ts → metadata/colorFns.d.ts} +2 -2
- package/dist/topology/metadata/colorFns.d.ts.map +1 -0
- package/dist/topology/{faceTagFns.d.ts → metadata/faceTagFns.d.ts} +2 -2
- package/dist/topology/metadata/faceTagFns.d.ts.map +1 -0
- package/dist/topology/metadata/metadataPropagation.d.ts +30 -0
- package/dist/topology/metadata/metadataPropagation.d.ts.map +1 -0
- package/dist/topology/metadata/originTrackingFns.d.ts +23 -0
- package/dist/topology/metadata/originTrackingFns.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- 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-C7x98OVn.js → topology-C1oUQXZS.js} +235 -50
- package/dist/{topology-ANwCzGL8.cjs → topology-xyDYbkHW.cjs} +205 -20
- package/dist/topology.cjs +18 -17
- package/dist/topology.js +97 -96
- package/dist/topologyQueryFns-0IptTUCo.cjs +118 -0
- package/dist/topologyQueryFns-Dj4Xd5kx.js +119 -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-Bx8wkNui.js → vectors-B8juLsQB.js} +15 -7
- package/dist/{vectors-D_IiZx0q.cjs → vectors-I_0zdD3O.cjs} +9 -1
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +23 -23
- package/package.json +9 -9
- package/dist/2d/blueprints/approximations.d.ts.map +0 -1
- package/dist/2d/blueprints/customCorners.d.ts.map +0 -1
- package/dist/2d/blueprints/offset.d.ts.map +0 -1
- package/dist/core/definitionMaps.d.ts.map +0 -1
- 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/loft-Bhw-FMoL.js +0 -228
- package/dist/loft-hp3pc1M7.cjs +0 -227
- package/dist/measurement-BoNTUBAp.cjs +0 -135
- package/dist/operations/extrude.d.ts +0 -72
- package/dist/operations/extrude.d.ts.map +0 -1
- package/dist/operations/loft.d.ts +0 -33
- package/dist/operations/loft.d.ts.map +0 -1
- package/dist/shapeFns-C2SnNvdH.cjs +0 -468
- package/dist/shapeFns-FDuKkrDR.js +0 -469
- package/dist/topology/colorFns.d.ts.map +0 -1
- package/dist/topology/faceTagFns.d.ts.map +0 -1
- 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
|
@@ -44,17 +44,17 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
44
44
|
};
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
|
-
const vectors = require("./vectors-
|
|
48
|
-
const result = require("./result-
|
|
49
|
-
const faceFns = require("./faceFns-
|
|
47
|
+
const vectors = require("./vectors-I_0zdD3O.cjs");
|
|
48
|
+
const result = require("./result-DULetAht.cjs");
|
|
49
|
+
const faceFns = require("./faceFns-CmIrjdt1.cjs");
|
|
50
50
|
const types = require("./types-CA_xrgDq.cjs");
|
|
51
51
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const curveFns = require("./curveFns-
|
|
55
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
56
|
-
const helpers = require("./helpers-
|
|
57
|
-
const Blueprint = require("./Blueprint-
|
|
52
|
+
const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
|
|
53
|
+
const sweepFns = require("./sweepFns-COqeYIUp.cjs");
|
|
54
|
+
const curveFns = require("./curveFns-CWZRuXQ3.cjs");
|
|
55
|
+
const surfaceBuilders = require("./surfaceBuilders-DYS8AMSS.cjs");
|
|
56
|
+
const helpers = require("./helpers-mipaxDTy.cjs");
|
|
57
|
+
const Blueprint = require("./Blueprint-BoC0DsDm.cjs");
|
|
58
58
|
const intersectCurves = (first, second, precision = 1e-9) => {
|
|
59
59
|
if (first.boundingBox.isOut(second.boundingBox))
|
|
60
60
|
return result.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
@@ -567,33 +567,29 @@ function upperBound(value, arr) {
|
|
|
567
567
|
return arr[i];
|
|
568
568
|
}
|
|
569
569
|
function sort(values, boxes, indices, left, right, nodeSize) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
swap(values, boxes, indices, i, j);
|
|
594
|
-
}
|
|
595
|
-
sort(values, boxes, indices, left, j, nodeSize);
|
|
596
|
-
sort(values, boxes, indices, j + 1, right, nodeSize);
|
|
570
|
+
const stack = [left, right];
|
|
571
|
+
while (stack.length) {
|
|
572
|
+
const r = stack.pop() || 0;
|
|
573
|
+
const l = stack.pop() || 0;
|
|
574
|
+
if (r - l <= nodeSize && Math.floor(l / nodeSize) >= Math.floor(r / nodeSize)) continue;
|
|
575
|
+
const a = values[l];
|
|
576
|
+
const b = values[l + r >> 1];
|
|
577
|
+
const c = values[r];
|
|
578
|
+
const pivot = a > b !== a > c ? a : b < a !== b < c ? b : c;
|
|
579
|
+
let i = l - 1;
|
|
580
|
+
let j = r + 1;
|
|
581
|
+
while (true) {
|
|
582
|
+
do
|
|
583
|
+
i++;
|
|
584
|
+
while (values[i] < pivot);
|
|
585
|
+
do
|
|
586
|
+
j--;
|
|
587
|
+
while (values[j] > pivot);
|
|
588
|
+
if (i >= j) break;
|
|
589
|
+
swap(values, boxes, indices, i, j);
|
|
590
|
+
}
|
|
591
|
+
stack.push(l, j, j + 1, r);
|
|
592
|
+
}
|
|
597
593
|
}
|
|
598
594
|
function swap(values, boxes, indices, i, j) {
|
|
599
595
|
const temp = values[i];
|
|
@@ -948,6 +944,69 @@ const organiseBlueprints = (blueprints) => {
|
|
|
948
944
|
})
|
|
949
945
|
);
|
|
950
946
|
};
|
|
947
|
+
function extrude(face, extrusionVec) {
|
|
948
|
+
if (shapeTypes.getKernel().isNull(face.wrapped)) {
|
|
949
|
+
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "extrude: face is a null shape"));
|
|
950
|
+
}
|
|
951
|
+
if (vecOps.vecLength(extrusionVec) === 0) {
|
|
952
|
+
return result.err(result.validationError("EXTRUDE_ZERO_VECTOR", "extrude: extrusion vector has zero length"));
|
|
953
|
+
}
|
|
954
|
+
try {
|
|
955
|
+
const kernel = shapeTypes.getKernel();
|
|
956
|
+
const len = vecOps.vecLength(extrusionVec);
|
|
957
|
+
const dir = vecOps.vecNormalize(extrusionVec);
|
|
958
|
+
const shape = kernel.extrude(face.wrapped, [...dir], len);
|
|
959
|
+
const downcastShape = kernel.downcast(shape, "solid");
|
|
960
|
+
const solid = shapeTypes.createSolid(downcastShape);
|
|
961
|
+
return result.ok(solid);
|
|
962
|
+
} catch (e) {
|
|
963
|
+
return result.err(
|
|
964
|
+
result.kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
|
|
965
|
+
operation: "extrude",
|
|
966
|
+
vectorLength: vecOps.vecLength(extrusionVec)
|
|
967
|
+
})
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
|
|
972
|
+
if (shapeTypes.getKernel().isNull(face.wrapped)) {
|
|
973
|
+
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
|
|
974
|
+
}
|
|
975
|
+
const kernel = shapeTypes.getKernel();
|
|
976
|
+
const shape = kernel.revolveVec(face.wrapped, [...center], [...direction], angle);
|
|
977
|
+
const result$1 = shapeTypes.castShape(shape);
|
|
978
|
+
if (!shapeTypes.isShape3D(result$1)) {
|
|
979
|
+
return result.err(result.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
980
|
+
}
|
|
981
|
+
return result.ok(result$1);
|
|
982
|
+
}
|
|
983
|
+
function loft(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
|
|
984
|
+
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
985
|
+
return result.err(result.validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
986
|
+
}
|
|
987
|
+
const kernel = shapeTypes.getKernel();
|
|
988
|
+
const startVertex = startPoint ? kernel.makeVertex(...types.toVec3(startPoint)) : void 0;
|
|
989
|
+
const endVertex = endPoint ? kernel.makeVertex(...types.toVec3(endPoint)) : void 0;
|
|
990
|
+
try {
|
|
991
|
+
const shape = kernel.loftAdvanced(
|
|
992
|
+
wires.map((w) => w.wrapped),
|
|
993
|
+
{
|
|
994
|
+
solid: !returnShell,
|
|
995
|
+
ruled,
|
|
996
|
+
tolerance,
|
|
997
|
+
...startVertex ? { startVertex } : {},
|
|
998
|
+
...endVertex ? { endVertex } : {}
|
|
999
|
+
}
|
|
1000
|
+
);
|
|
1001
|
+
const result$1 = shapeTypes.castShape(shape);
|
|
1002
|
+
if (!shapeTypes.isShape3D(result$1)) {
|
|
1003
|
+
return result.err(result.typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
1004
|
+
}
|
|
1005
|
+
return result.ok(result$1);
|
|
1006
|
+
} catch {
|
|
1007
|
+
return result.err(result.kernelError("LOFT_FAILED", "Loft operation failed"));
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
951
1010
|
class Sketch {
|
|
952
1011
|
wire;
|
|
953
1012
|
/**
|
|
@@ -1032,7 +1091,9 @@ class Sketch {
|
|
|
1032
1091
|
*/
|
|
1033
1092
|
revolve(revolutionAxis, { origin } = {}) {
|
|
1034
1093
|
const face = result.unwrap(surfaceBuilders.makeFace(this.wire));
|
|
1035
|
-
const
|
|
1094
|
+
const center = origin ? types.toVec3(origin) : this.defaultOrigin;
|
|
1095
|
+
const dir = revolutionAxis ? types.toVec3(revolutionAxis) : [0, 0, 1];
|
|
1096
|
+
const solid = result.unwrap(revolve(face, center, dir));
|
|
1036
1097
|
face.delete();
|
|
1037
1098
|
this.delete();
|
|
1038
1099
|
return solid;
|
|
@@ -1058,20 +1119,26 @@ class Sketch {
|
|
|
1058
1119
|
const originVec = origin ? types.toVec3(origin) : this.defaultOrigin;
|
|
1059
1120
|
if (extrusionProfile && !twistAngle) {
|
|
1060
1121
|
const solid2 = result.unwrap(
|
|
1061
|
-
|
|
1122
|
+
sweepFns.complexExtrude(this.wire, [...originVec], [...extrusionVec], extrusionProfile)
|
|
1062
1123
|
);
|
|
1063
1124
|
this.delete();
|
|
1064
1125
|
return solid2;
|
|
1065
1126
|
}
|
|
1066
1127
|
if (twistAngle) {
|
|
1067
1128
|
const solid2 = result.unwrap(
|
|
1068
|
-
|
|
1129
|
+
sweepFns.twistExtrude(
|
|
1130
|
+
this.wire,
|
|
1131
|
+
twistAngle,
|
|
1132
|
+
[...originVec],
|
|
1133
|
+
[...extrusionVec],
|
|
1134
|
+
extrusionProfile
|
|
1135
|
+
)
|
|
1069
1136
|
);
|
|
1070
1137
|
this.delete();
|
|
1071
1138
|
return solid2;
|
|
1072
1139
|
}
|
|
1073
1140
|
const face = result.unwrap(surfaceBuilders.makeFace(this.wire));
|
|
1074
|
-
const solid =
|
|
1141
|
+
const solid = result.unwrap(extrude(face, [...extrusionVec]));
|
|
1075
1142
|
this.delete();
|
|
1076
1143
|
return solid;
|
|
1077
1144
|
}
|
|
@@ -1095,7 +1162,7 @@ class Sketch {
|
|
|
1095
1162
|
if (this.baseFace) {
|
|
1096
1163
|
config.support = this.baseFace.wrapped;
|
|
1097
1164
|
}
|
|
1098
|
-
const shape = result.unwrap(
|
|
1165
|
+
const shape = result.unwrap(sweepFns.sweep(sketch.wire, this.wire, config));
|
|
1099
1166
|
this.delete();
|
|
1100
1167
|
return shape;
|
|
1101
1168
|
}
|
|
@@ -1111,7 +1178,7 @@ class Sketch {
|
|
|
1111
1178
|
loftWith(otherSketches, loftConfig = {}, returnShell = false) {
|
|
1112
1179
|
const sketchArray = Array.isArray(otherSketches) ? [this, ...otherSketches] : [this, otherSketches];
|
|
1113
1180
|
const shape = result.unwrap(
|
|
1114
|
-
loft
|
|
1181
|
+
loft(
|
|
1115
1182
|
sketchArray.map((s) => s.wire),
|
|
1116
1183
|
loftConfig,
|
|
1117
1184
|
returnShell
|
|
@@ -2478,13 +2545,16 @@ exports.Sketch = Sketch;
|
|
|
2478
2545
|
exports.chamferCurves = chamferCurves;
|
|
2479
2546
|
exports.cut2D = cut2D;
|
|
2480
2547
|
exports.cutBlueprints = cutBlueprints;
|
|
2548
|
+
exports.extrude = extrude;
|
|
2481
2549
|
exports.filletCurves = filletCurves;
|
|
2482
2550
|
exports.fuse2D = fuse2D;
|
|
2483
2551
|
exports.fuseBlueprints = fuseBlueprints;
|
|
2484
2552
|
exports.intersect2D = intersect2D;
|
|
2485
2553
|
exports.intersectBlueprints = intersectBlueprints;
|
|
2486
2554
|
exports.intersectCurves = intersectCurves;
|
|
2555
|
+
exports.loft = loft;
|
|
2487
2556
|
exports.make2dOffset = make2dOffset;
|
|
2488
2557
|
exports.organiseBlueprints = organiseBlueprints;
|
|
2489
2558
|
exports.polysidesBlueprint = polysidesBlueprint;
|
|
2559
|
+
exports.revolve = revolve;
|
|
2490
2560
|
exports.roundedRectangleBlueprint = roundedRectangleBlueprint;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as ok,
|
|
3
|
-
import { r as resolvePlane } from "./vectors-
|
|
4
|
-
import { H as HASH_CODE_MAX,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { g as getKernel, c as castShape, h as isShape3D } from "./shapeTypes-dhhm-T5A.js";
|
|
2
|
+
import { o as ok, b as isErr, e as err, v as validationError, B as BrepErrorCode, t as typeCastError, k as kernelError } from "./result-CoDaWsvc.js";
|
|
3
|
+
import { r as resolvePlane } from "./vectors-B8juLsQB.js";
|
|
4
|
+
import { H as HASH_CODE_MAX, b as vecScale, a as vecAdd } from "./vecOps-LTN--A58.js";
|
|
5
|
+
import { p as propagateOriginsByHash, g as getFaceOrigins, a as propagateOriginsFromEvolution } from "./originTrackingFns-BOCAMfd0.js";
|
|
6
|
+
import { b as getFaces, c as getWires, d as getEdges, e as getVertices } from "./topologyQueryFns-Dj4Xd5kx.js";
|
|
7
|
+
import { m as makeFace } from "./surfaceBuilders-Dl0ATFbO.js";
|
|
7
8
|
const shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
8
9
|
const tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
9
10
|
function hasFaceTags(shape) {
|
|
@@ -195,6 +196,29 @@ function propagateColorsFromEvolution(evolution, inputs, result) {
|
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
}
|
|
199
|
+
function collectInputFaceHashes(inputs) {
|
|
200
|
+
const hasMetadata = inputs.some(
|
|
201
|
+
(s) => getFaceOrigins(s) !== void 0 || hasFaceTags(s) || hasColorMetadata(s)
|
|
202
|
+
);
|
|
203
|
+
if (!hasMetadata) return [];
|
|
204
|
+
const kernel = getKernel();
|
|
205
|
+
const hashes = [];
|
|
206
|
+
for (const input of inputs) {
|
|
207
|
+
const faces = kernel.iterShapes(input.wrapped, "face");
|
|
208
|
+
for (const face of faces) {
|
|
209
|
+
hashes.push(kernel.hashCode(face, HASH_CODE_MAX));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return hashes;
|
|
213
|
+
}
|
|
214
|
+
function propagateAllMetadata(evolution, inputs, result) {
|
|
215
|
+
propagateOriginsFromEvolution(evolution, inputs, result);
|
|
216
|
+
propagateFaceTagsFromEvolution(evolution, inputs, result);
|
|
217
|
+
propagateColorsFromEvolution(evolution, inputs, result);
|
|
218
|
+
}
|
|
219
|
+
function propagateMetadataByHash(inputs, result) {
|
|
220
|
+
propagateOriginsByHash(inputs, result);
|
|
221
|
+
}
|
|
198
222
|
function validateShape3D(shape, label) {
|
|
199
223
|
if (getKernel().isNull(shape.wrapped)) {
|
|
200
224
|
return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
|
|
@@ -222,20 +246,6 @@ function castToShape3D(shape, errorCode, errorMsg) {
|
|
|
222
246
|
}
|
|
223
247
|
return ok(wrapped);
|
|
224
248
|
}
|
|
225
|
-
function collectInputFaceHashes(inputs) {
|
|
226
|
-
const hasMetadata = inputs.some(
|
|
227
|
-
(s) => getFaceOrigins(s) !== void 0 || hasFaceTags(s) || hasColorMetadata(s)
|
|
228
|
-
);
|
|
229
|
-
if (!hasMetadata) return [];
|
|
230
|
-
const hashes = [];
|
|
231
|
-
for (const input of inputs) {
|
|
232
|
-
const faces = getKernel().iterShapes(input.wrapped, "face");
|
|
233
|
-
for (const face of faces) {
|
|
234
|
-
hashes.push(face.HashCode(HASH_CODE_MAX));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return hashes;
|
|
238
|
-
}
|
|
239
249
|
function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
|
|
240
250
|
if (signal?.aborted) throw signal.reason;
|
|
241
251
|
const checkA = validateShape3D(a, "fuse: first operand");
|
|
@@ -252,9 +262,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
|
|
|
252
262
|
);
|
|
253
263
|
const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
|
|
254
264
|
if (fuseResult.ok) {
|
|
255
|
-
|
|
256
|
-
propagateFaceTagsFromEvolution(evolution, [a, b], fuseResult.value);
|
|
257
|
-
propagateColorsFromEvolution(evolution, [a, b], fuseResult.value);
|
|
265
|
+
propagateAllMetadata(evolution, [a, b], fuseResult.value);
|
|
258
266
|
}
|
|
259
267
|
return fuseResult;
|
|
260
268
|
}
|
|
@@ -274,9 +282,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
|
|
|
274
282
|
);
|
|
275
283
|
const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape");
|
|
276
284
|
if (cutResult.ok) {
|
|
277
|
-
|
|
278
|
-
propagateFaceTagsFromEvolution(evolution, [base, tool], cutResult.value);
|
|
279
|
-
propagateColorsFromEvolution(evolution, [base, tool], cutResult.value);
|
|
285
|
+
propagateAllMetadata(evolution, [base, tool], cutResult.value);
|
|
280
286
|
}
|
|
281
287
|
return cutResult;
|
|
282
288
|
}
|
|
@@ -300,9 +306,7 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue } = {}) {
|
|
|
300
306
|
"Intersect did not produce a 3D shape"
|
|
301
307
|
);
|
|
302
308
|
if (intResult.ok) {
|
|
303
|
-
|
|
304
|
-
propagateFaceTagsFromEvolution(evolution, [a, b], intResult.value);
|
|
305
|
-
propagateColorsFromEvolution(evolution, [a, b], intResult.value);
|
|
309
|
+
propagateAllMetadata(evolution, [a, b], intResult.value);
|
|
306
310
|
}
|
|
307
311
|
return intResult;
|
|
308
312
|
}
|
|
@@ -374,7 +378,7 @@ function fuseAll(shapes, {
|
|
|
374
378
|
"fuseAll did not produce a 3D shape"
|
|
375
379
|
);
|
|
376
380
|
if (fuseAllResult.ok) {
|
|
377
|
-
|
|
381
|
+
propagateMetadataByHash(shapes, fuseAllResult.value);
|
|
378
382
|
}
|
|
379
383
|
return fuseAllResult;
|
|
380
384
|
}
|
|
@@ -406,7 +410,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal,
|
|
|
406
410
|
);
|
|
407
411
|
const cutAllResult = castToShape3D(result, "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
|
|
408
412
|
if (cutAllResult.ok) {
|
|
409
|
-
|
|
413
|
+
propagateMetadataByHash(allInputs, cutAllResult.value);
|
|
410
414
|
}
|
|
411
415
|
return cutAllResult;
|
|
412
416
|
}
|
|
@@ -582,26 +586,25 @@ function slice(shape, planes, options = {}) {
|
|
|
582
586
|
return ok(results);
|
|
583
587
|
}
|
|
584
588
|
export {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
589
|
+
cut as a,
|
|
590
|
+
sectionToFace as b,
|
|
591
|
+
collectInputFaceHashes as c,
|
|
592
|
+
slice as d,
|
|
593
|
+
split as e,
|
|
590
594
|
fuse as f,
|
|
591
|
-
|
|
592
|
-
|
|
595
|
+
fuseAll as g,
|
|
596
|
+
cutAll as h,
|
|
593
597
|
intersect as i,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
598
|
+
colorFaces as j,
|
|
599
|
+
colorShape as k,
|
|
600
|
+
findFacesByTag as l,
|
|
601
|
+
getFaceColor as m,
|
|
602
|
+
getFaceTags as n,
|
|
603
|
+
getShapeColor as o,
|
|
604
|
+
propagateAllMetadata as p,
|
|
605
|
+
getTagMetadata as q,
|
|
606
|
+
setTagMetadata as r,
|
|
603
607
|
section as s,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
tagFaces as v
|
|
608
|
+
tagFaces as t,
|
|
609
|
+
propagateMetadataByHash as u
|
|
607
610
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
-
const result = require("./result-
|
|
4
|
-
const vectors = require("./vectors-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
|
|
3
|
+
const result = require("./result-DULetAht.cjs");
|
|
4
|
+
const vectors = require("./vectors-I_0zdD3O.cjs");
|
|
5
5
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const originTrackingFns = require("./originTrackingFns-SPU7ly3_.cjs");
|
|
7
|
+
const topologyQueryFns = require("./topologyQueryFns-0IptTUCo.cjs");
|
|
8
|
+
const surfaceBuilders = require("./surfaceBuilders-DYS8AMSS.cjs");
|
|
8
9
|
const shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
9
10
|
const tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
10
11
|
function hasFaceTags(shape) {
|
|
@@ -27,7 +28,7 @@ function getMetaMap(shape) {
|
|
|
27
28
|
return map;
|
|
28
29
|
}
|
|
29
30
|
function tagFaces(shape, selector, tag) {
|
|
30
|
-
const faces = Array.isArray(selector) ? selector :
|
|
31
|
+
const faces = Array.isArray(selector) ? selector : topologyQueryFns.getFaces(shape).filter(selector);
|
|
31
32
|
const tagMap = getTagMap(shape);
|
|
32
33
|
const existing = tagMap.get(tag) ?? /* @__PURE__ */ new Set();
|
|
33
34
|
for (const face of faces) {
|
|
@@ -42,7 +43,7 @@ function findFacesByTag(shape, tag) {
|
|
|
42
43
|
const hashes = tagMap.get(tag);
|
|
43
44
|
if (!hashes || hashes.size === 0) return [];
|
|
44
45
|
const result2 = [];
|
|
45
|
-
for (const face of
|
|
46
|
+
for (const face of topologyQueryFns.getFaces(shape)) {
|
|
46
47
|
const hash = shapeTypes.getKernel().hashCode(face.wrapped, vecOps.HASH_CODE_MAX);
|
|
47
48
|
if (hashes.has(hash)) {
|
|
48
49
|
result2.push(face);
|
|
@@ -54,7 +55,7 @@ function getFaceTags(shape) {
|
|
|
54
55
|
const result2 = /* @__PURE__ */ new Map();
|
|
55
56
|
const tagMap = shapeTagStore.get(shape.wrapped);
|
|
56
57
|
if (!tagMap) return result2;
|
|
57
|
-
const faces =
|
|
58
|
+
const faces = topologyQueryFns.getFaces(shape);
|
|
58
59
|
const faceByHash = /* @__PURE__ */ new Map();
|
|
59
60
|
for (const face of faces) {
|
|
60
61
|
faceByHash.set(shapeTypes.getKernel().hashCode(face.wrapped, vecOps.HASH_CODE_MAX), face);
|
|
@@ -196,6 +197,29 @@ function propagateColorsFromEvolution(evolution, inputs, result2) {
|
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
}
|
|
200
|
+
function collectInputFaceHashes(inputs) {
|
|
201
|
+
const hasMetadata = inputs.some(
|
|
202
|
+
(s) => originTrackingFns.getFaceOrigins(s) !== void 0 || hasFaceTags(s) || hasColorMetadata(s)
|
|
203
|
+
);
|
|
204
|
+
if (!hasMetadata) return [];
|
|
205
|
+
const kernel = shapeTypes.getKernel();
|
|
206
|
+
const hashes = [];
|
|
207
|
+
for (const input of inputs) {
|
|
208
|
+
const faces = kernel.iterShapes(input.wrapped, "face");
|
|
209
|
+
for (const face of faces) {
|
|
210
|
+
hashes.push(kernel.hashCode(face, vecOps.HASH_CODE_MAX));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return hashes;
|
|
214
|
+
}
|
|
215
|
+
function propagateAllMetadata(evolution, inputs, result2) {
|
|
216
|
+
originTrackingFns.propagateOriginsFromEvolution(evolution, inputs, result2);
|
|
217
|
+
propagateFaceTagsFromEvolution(evolution, inputs, result2);
|
|
218
|
+
propagateColorsFromEvolution(evolution, inputs, result2);
|
|
219
|
+
}
|
|
220
|
+
function propagateMetadataByHash(inputs, result2) {
|
|
221
|
+
originTrackingFns.propagateOriginsByHash(inputs, result2);
|
|
222
|
+
}
|
|
199
223
|
function validateShape3D(shape, label) {
|
|
200
224
|
if (shapeTypes.getKernel().isNull(shape.wrapped)) {
|
|
201
225
|
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
|
|
@@ -223,20 +247,6 @@ function castToShape3D(shape, errorCode, errorMsg) {
|
|
|
223
247
|
}
|
|
224
248
|
return result.ok(wrapped);
|
|
225
249
|
}
|
|
226
|
-
function collectInputFaceHashes(inputs) {
|
|
227
|
-
const hasMetadata = inputs.some(
|
|
228
|
-
(s) => shapeFns.getFaceOrigins(s) !== void 0 || hasFaceTags(s) || hasColorMetadata(s)
|
|
229
|
-
);
|
|
230
|
-
if (!hasMetadata) return [];
|
|
231
|
-
const hashes = [];
|
|
232
|
-
for (const input of inputs) {
|
|
233
|
-
const faces = shapeTypes.getKernel().iterShapes(input.wrapped, "face");
|
|
234
|
-
for (const face of faces) {
|
|
235
|
-
hashes.push(face.HashCode(vecOps.HASH_CODE_MAX));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return hashes;
|
|
239
|
-
}
|
|
240
250
|
function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
|
|
241
251
|
if (signal?.aborted) throw signal.reason;
|
|
242
252
|
const checkA = validateShape3D(a, "fuse: first operand");
|
|
@@ -253,9 +263,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
|
|
|
253
263
|
);
|
|
254
264
|
const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
|
|
255
265
|
if (fuseResult.ok) {
|
|
256
|
-
|
|
257
|
-
propagateFaceTagsFromEvolution(evolution, [a, b], fuseResult.value);
|
|
258
|
-
propagateColorsFromEvolution(evolution, [a, b], fuseResult.value);
|
|
266
|
+
propagateAllMetadata(evolution, [a, b], fuseResult.value);
|
|
259
267
|
}
|
|
260
268
|
return fuseResult;
|
|
261
269
|
}
|
|
@@ -275,9 +283,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
|
|
|
275
283
|
);
|
|
276
284
|
const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape");
|
|
277
285
|
if (cutResult.ok) {
|
|
278
|
-
|
|
279
|
-
propagateFaceTagsFromEvolution(evolution, [base, tool], cutResult.value);
|
|
280
|
-
propagateColorsFromEvolution(evolution, [base, tool], cutResult.value);
|
|
286
|
+
propagateAllMetadata(evolution, [base, tool], cutResult.value);
|
|
281
287
|
}
|
|
282
288
|
return cutResult;
|
|
283
289
|
}
|
|
@@ -301,9 +307,7 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue } = {}) {
|
|
|
301
307
|
"Intersect did not produce a 3D shape"
|
|
302
308
|
);
|
|
303
309
|
if (intResult.ok) {
|
|
304
|
-
|
|
305
|
-
propagateFaceTagsFromEvolution(evolution, [a, b], intResult.value);
|
|
306
|
-
propagateColorsFromEvolution(evolution, [a, b], intResult.value);
|
|
310
|
+
propagateAllMetadata(evolution, [a, b], intResult.value);
|
|
307
311
|
}
|
|
308
312
|
return intResult;
|
|
309
313
|
}
|
|
@@ -375,7 +379,7 @@ function fuseAll(shapes, {
|
|
|
375
379
|
"fuseAll did not produce a 3D shape"
|
|
376
380
|
);
|
|
377
381
|
if (fuseAllResult.ok) {
|
|
378
|
-
|
|
382
|
+
propagateMetadataByHash(shapes, fuseAllResult.value);
|
|
379
383
|
}
|
|
380
384
|
return fuseAllResult;
|
|
381
385
|
}
|
|
@@ -407,7 +411,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal,
|
|
|
407
411
|
);
|
|
408
412
|
const cutAllResult = castToShape3D(result$1, "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
|
|
409
413
|
if (cutAllResult.ok) {
|
|
410
|
-
|
|
414
|
+
propagateMetadataByHash(allInputs, cutAllResult.value);
|
|
411
415
|
}
|
|
412
416
|
return cutAllResult;
|
|
413
417
|
}
|
|
@@ -461,9 +465,9 @@ function section(shape, plane, { approximation = true, planeSize = 1e4 } = {}) {
|
|
|
461
465
|
function sectionToFace(shape, plane, options = {}) {
|
|
462
466
|
const sectionResult = section(shape, plane, options);
|
|
463
467
|
if (!sectionResult.ok) return sectionResult;
|
|
464
|
-
const wires =
|
|
468
|
+
const wires = topologyQueryFns.getWires(sectionResult.value);
|
|
465
469
|
if (wires.length === 0) {
|
|
466
|
-
const edges =
|
|
470
|
+
const edges = topologyQueryFns.getEdges(sectionResult.value);
|
|
467
471
|
if (edges.length === 0) {
|
|
468
472
|
return result.err(result.kernelError("SECTION_FAILED", "sectionToFace: section produced no geometry"));
|
|
469
473
|
}
|
|
@@ -471,7 +475,7 @@ function sectionToFace(shape, plane, options = {}) {
|
|
|
471
475
|
const vertexToEdges = /* @__PURE__ */ new Map();
|
|
472
476
|
const edgeVertexHashes = /* @__PURE__ */ new Map();
|
|
473
477
|
for (const edge of edges) {
|
|
474
|
-
const verts =
|
|
478
|
+
const verts = topologyQueryFns.getVertices(edge);
|
|
475
479
|
const h0 = verts[0] ? shapeTypes.getKernel().hashCode(verts[0].wrapped, vecOps.HASH_CODE_MAX) : -1;
|
|
476
480
|
const h1 = verts.length > 1 && verts[1] ? shapeTypes.getKernel().hashCode(verts[1].wrapped, vecOps.HASH_CODE_MAX) : h0;
|
|
477
481
|
edgeVertexHashes.set(edge, [h0, h1]);
|
|
@@ -582,6 +586,7 @@ function slice(shape, planes, options = {}) {
|
|
|
582
586
|
}
|
|
583
587
|
return result.ok(results);
|
|
584
588
|
}
|
|
589
|
+
exports.collectInputFaceHashes = collectInputFaceHashes;
|
|
585
590
|
exports.colorFaces = colorFaces;
|
|
586
591
|
exports.colorShape = colorShape;
|
|
587
592
|
exports.cut = cut;
|
|
@@ -593,11 +598,9 @@ exports.getFaceColor = getFaceColor;
|
|
|
593
598
|
exports.getFaceTags = getFaceTags;
|
|
594
599
|
exports.getShapeColor = getShapeColor;
|
|
595
600
|
exports.getTagMetadata = getTagMetadata;
|
|
596
|
-
exports.hasColorMetadata = hasColorMetadata;
|
|
597
|
-
exports.hasFaceTags = hasFaceTags;
|
|
598
601
|
exports.intersect = intersect;
|
|
599
|
-
exports.
|
|
600
|
-
exports.
|
|
602
|
+
exports.propagateAllMetadata = propagateAllMetadata;
|
|
603
|
+
exports.propagateMetadataByHash = propagateMetadataByHash;
|
|
601
604
|
exports.section = section;
|
|
602
605
|
exports.sectionToFace = sectionToFace;
|
|
603
606
|
exports.setTagMetadata = setTagMetadata;
|