brepjs 18.61.0 → 18.62.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/README.md +30 -0
- package/dist/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{blueprint-U7q8mCkd.js → blueprint-C6RmibWk.js} +5 -5
- package/dist/{blueprint-oAHtiBNZ.cjs → blueprint-DLu8ye65.cjs} +5 -5
- package/dist/{blueprintFns-BXIg6yIJ.cjs → blueprintFns-DV-H9feq.cjs} +2 -2
- package/dist/{blueprintFns-B430IS5G.js → blueprintFns-Dq_Pd0wn.js} +2 -2
- package/dist/{blueprintSketcher-BMy4GYLb.cjs → blueprintSketcher-CHXFt247.cjs} +3 -3
- package/dist/{blueprintSketcher-CpYK3eMF.js → blueprintSketcher-LjvOXfG9.js} +3 -3
- package/dist/{boolean2D-BVGfOj7k.js → boolean2D-CXgu27uZ.js} +4 -4
- package/dist/{boolean2D-CalRrd7P.cjs → boolean2D-Yi64P8Lm.cjs} +4 -4
- package/dist/{booleanFns-BF1OlY3H.js → booleanFns-BDQnkWFg.js} +4 -4
- package/dist/{booleanFns-CejWQwHg.cjs → booleanFns-Dc6okcNf.cjs} +4 -4
- package/dist/brepjs.cjs +24 -24
- package/dist/brepjs.js +24 -24
- package/dist/{cameraFns-CDmeZqa_.js → cameraFns-0-J1bY6t.js} +2 -2
- package/dist/{cameraFns-DkasWoY3.cjs → cameraFns-DomX3Plu.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-mUvhWdNG.js → cornerFinder-CegWolhx.js} +1 -1
- package/dist/{cornerFinder-mHD8eDmo.cjs → cornerFinder-ClMOrRzh.cjs} +1 -1
- package/dist/{curveFns-Ba1IEqn_.cjs → curveFns-DbKwrIkB.cjs} +1 -1
- package/dist/{curveFns-C_va_3Js.js → curveFns-Sd40KJvV.js} +1 -1
- package/dist/{drawFns-DGENZIVf.cjs → drawFns-C8SC0CG1.cjs} +12 -12
- package/dist/{drawFns-zcgjasyw.js → drawFns-DQqbUdj_.js} +12 -12
- package/dist/{extrudeFns-DiIGGA5r.cjs → extrudeFns-BE5tD51l.cjs} +1 -1
- package/dist/{extrudeFns-BkOhPexa.js → extrudeFns-g_5oi_Z7.js} +1 -1
- package/dist/{faceFns-eCr0tWic.cjs → faceFns-BQTKMhAC.cjs} +2 -2
- package/dist/{faceFns-DUmTMdax.js → faceFns-Bbix8B9u.js} +2 -2
- package/dist/{helpers-Cpw0iU4L.cjs → helpers-BfHmMhUR.cjs} +6 -6
- package/dist/{helpers-C7WpHbhO.js → helpers-Dd-L1roG.js} +6 -6
- package/dist/{historyFns-BVNMHteL.js → historyFns-B9o7aDyd.js} +4 -4
- package/dist/{historyFns-B5zXm33l.cjs → historyFns-BarNZqzL.cjs} +4 -4
- package/dist/{importFns-BQEVbZwt.cjs → importFns-B5lQLt1L.cjs} +2 -2
- package/dist/{importFns-DcUisQj3.js → importFns-lLr9YlOX.js} +2 -2
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/{measureFns-BdYuCuf9.js → measureFns-Bd4JAmjS.js} +3 -3
- package/dist/{measureFns-Bve7WG1g.cjs → measureFns-C4vQUvbq.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-Hxj3Vngd.cjs → meshFns-Dpfjcbrg.cjs} +3 -3
- package/dist/{meshFns-BtjQFcwe.js → meshFns-DykZRUnb.js} +3 -3
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-n-OA8SFM.cjs → primitiveFns-CW8_7RPe.cjs} +7 -7
- package/dist/{primitiveFns-ODt9feUB.js → primitiveFns-vOwZZo8w.js} +7 -7
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{shapeFns-Dl7cAveQ.cjs → shapeFns-B7G5VsUD.cjs} +2 -2
- package/dist/{shapeFns-CGiJTWpD.js → shapeFns-xQvCdTPe.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-CqLB7rA2.js → shapeRefFns-CAdRRwOu.js} +4 -4
- package/dist/{shapeRefFns-DppFONN_.cjs → shapeRefFns-DNMvu2Nc.cjs} +4 -4
- package/dist/{shapeTypes-DgN4lV-c.cjs → shapeTypes-DVlIrfVF.cjs} +103 -117
- package/dist/{shapeTypes-BGeihZZ2.js → shapeTypes-DsbDmdSa.js} +103 -117
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-C8x5hl-i.cjs → solidBuilders-BPfkZU5h.cjs} +2 -2
- package/dist/{solidBuilders-C_i7lfl1.js → solidBuilders-vD_StQ_i.js} +2 -2
- package/dist/{surfaceBuilders-OuKORf6n.js → surfaceBuilders-2qnBuaeF.js} +2 -2
- package/dist/{surfaceBuilders-8Q5NVxkT.cjs → surfaceBuilders-Bj6wi_Vf.cjs} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-CMszuH5i.cjs → textBlueprints-CrXC83B_.cjs} +7 -7
- package/dist/{textBlueprints-CjWzCUDy.js → textBlueprints-WI8cd6vk.js} +7 -7
- package/dist/{textMetrics-ogNOndAW.cjs → textMetrics-BkLQQDnZ.cjs} +1 -1
- package/dist/{textMetrics-nDL3MTCV.js → textMetrics-C4zPIVKl.js} +1 -1
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +7 -7
- package/dist/{topologyQueryFns-CTq8qOKc.cjs → topologyQueryFns-C1iv5CpR.cjs} +1 -1
- package/dist/{topologyQueryFns-B_zXrMDh.js → topologyQueryFns-CCLGa2wQ.js} +1 -1
- package/package.json +1 -1
|
@@ -387,7 +387,7 @@ function iterShapesJS(oc, shape, type) {
|
|
|
387
387
|
/**
|
|
388
388
|
* Iterates sub-shapes of a given type, using C++ bulk extraction when available.
|
|
389
389
|
*/
|
|
390
|
-
function iterShapes$
|
|
390
|
+
function iterShapes$2(oc, shape, type) {
|
|
391
391
|
if (oc.TopologyExtractor) return iterShapesBulk(oc, shape, type);
|
|
392
392
|
return iterShapesJS(oc, shape, type);
|
|
393
393
|
}
|
|
@@ -416,7 +416,7 @@ function getShapeTypeMap(oc) {
|
|
|
416
416
|
/**
|
|
417
417
|
* Returns the shape type string for a given shape.
|
|
418
418
|
*/
|
|
419
|
-
function shapeType$
|
|
419
|
+
function shapeType$2(oc, shape) {
|
|
420
420
|
if (shape.IsNull()) throw new Error("Cannot determine shape type: shape is null");
|
|
421
421
|
const result = getShapeTypeMap(oc).get(shape.ShapeType());
|
|
422
422
|
if (!result) throw new Error("Unknown shape type enum value");
|
|
@@ -468,7 +468,7 @@ function iterShapeList$1(oc, list, callback) {
|
|
|
468
468
|
/**
|
|
469
469
|
* Checks if two shapes are the same (same TShape, location, and orientation).
|
|
470
470
|
*/
|
|
471
|
-
function isSame$
|
|
471
|
+
function isSame$2(a, b) {
|
|
472
472
|
return a.IsSame(b);
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
@@ -480,12 +480,12 @@ function isEqual$1(a, b) {
|
|
|
480
480
|
/** Co-located factory: returns the topology-iteration slice of {@link KernelAdapter} bound to `oc`. */
|
|
481
481
|
function makeTopologyOps$2(oc) {
|
|
482
482
|
return {
|
|
483
|
-
iterShapes: (shape, type) => iterShapes$
|
|
483
|
+
iterShapes: (shape, type) => iterShapes$2(oc, shape, type),
|
|
484
484
|
iterShapeList: (list, callback) => {
|
|
485
485
|
iterShapeList$1(oc, list, callback);
|
|
486
486
|
},
|
|
487
|
-
shapeType: (shape) => shapeType$
|
|
488
|
-
isSame: (a, b) => isSame$
|
|
487
|
+
shapeType: (shape) => shapeType$2(oc, shape),
|
|
488
|
+
isSame: (a, b) => isSame$2(a, b),
|
|
489
489
|
isEqual: (a, b) => isEqual$1(a, b),
|
|
490
490
|
isValid: (shape) => isValid$1(oc, shape),
|
|
491
491
|
sew: (shapes, tolerance) => sew$1(oc, shapes, tolerance)
|
|
@@ -874,7 +874,7 @@ function makeFace$1(oc, wire, planar = true) {
|
|
|
874
874
|
return face;
|
|
875
875
|
}
|
|
876
876
|
const builder = new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, .01, .1, 8, 9);
|
|
877
|
-
const edges = iterShapes$
|
|
877
|
+
const edges = iterShapes$2(oc, wire, "edge");
|
|
878
878
|
for (const edge of edges) builder.Add_1(edge, oc.GeomAbs_Shape.GeomAbs_C0, true);
|
|
879
879
|
const progress = new oc.Message_ProgressRange_1();
|
|
880
880
|
builder.Build(progress);
|
|
@@ -2772,11 +2772,11 @@ function shapeTypeStr(oc, shape) {
|
|
|
2772
2772
|
return "compound";
|
|
2773
2773
|
}
|
|
2774
2774
|
/** Get the hash code of a shape. */
|
|
2775
|
-
function hashCode$
|
|
2775
|
+
function hashCode$2(oc, shape, upperBound) {
|
|
2776
2776
|
return oc.shapeHashCode(shape, upperBound);
|
|
2777
2777
|
}
|
|
2778
2778
|
/** Check if a shape is null. */
|
|
2779
|
-
function isNull$
|
|
2779
|
+
function isNull$2(_oc, shape) {
|
|
2780
2780
|
return shape.IsNull();
|
|
2781
2781
|
}
|
|
2782
2782
|
/** Return a copy of the shape with reversed orientation. */
|
|
@@ -2871,8 +2871,8 @@ function makeGeometryQueryOps(oc) {
|
|
|
2871
2871
|
curveParameters: (shape) => curveParameters$1(oc, shape),
|
|
2872
2872
|
shapeOrientation: (shape) => shapeOrientation$1(oc, shape),
|
|
2873
2873
|
downcast: (shape, type) => downcast$1(oc, shape, type),
|
|
2874
|
-
hashCode: (shape, upperBound) => hashCode$
|
|
2875
|
-
isNull: (shape) => isNull$
|
|
2874
|
+
hashCode: (shape, upperBound) => hashCode$2(oc, shape, upperBound),
|
|
2875
|
+
isNull: (shape) => isNull$2(oc, shape),
|
|
2876
2876
|
hasTriangulation: (shape) => hasTriangulation$2(oc, shape),
|
|
2877
2877
|
meshShape: (shape, tolerance, angularTolerance) => {
|
|
2878
2878
|
meshShape$2(oc, shape, tolerance, angularTolerance);
|
|
@@ -5134,7 +5134,7 @@ function fillSurface$1(oc, wires, options = {}) {
|
|
|
5134
5134
|
const { order = 3, nbPtsOnCur = 15, nbIter = 2, tol3d = 1e-5, tol2d = 1e-4, maxDeg = 8, maxSeg = 9 } = options;
|
|
5135
5135
|
const builder = new oc.BRepOffsetAPI_MakeFilling(order, nbPtsOnCur, nbIter, false, tol3d, tol2d, .01, .1, maxDeg, maxSeg);
|
|
5136
5136
|
for (let wi = 0; wi < wires.length; wi++) {
|
|
5137
|
-
const edges = iterShapes$
|
|
5137
|
+
const edges = iterShapes$2(oc, wires[wi], "edge");
|
|
5138
5138
|
for (const edge of edges) builder.Add_1(edge, oc.GeomAbs_Shape.GeomAbs_C0, wi === 0);
|
|
5139
5139
|
}
|
|
5140
5140
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -5594,9 +5594,9 @@ function resolveUniformAngle(faces, angleDeg) {
|
|
|
5594
5594
|
//#region src/kernel/brepkit/topologyOps.ts
|
|
5595
5595
|
function iterCompound(bk, h, type) {
|
|
5596
5596
|
const children = syntheticCompounds.get(h);
|
|
5597
|
-
if (children) return children.flatMap((child) => child.type === type ? [child] : iterShapes(bk, child, type));
|
|
5597
|
+
if (children) return children.flatMap((child) => child.type === type ? [child] : iterShapes$1(bk, child, type));
|
|
5598
5598
|
if (type === "solid") return toArray(bk.getCompoundSolids(h)).map(solidHandle);
|
|
5599
|
-
if (type === "face" || type === "edge" || type === "vertex" || type === "wire") return toArray(bk.getCompoundSolids(h)).map(solidHandle).flatMap((s) => iterShapes(bk, s, type));
|
|
5599
|
+
if (type === "face" || type === "edge" || type === "vertex" || type === "wire") return toArray(bk.getCompoundSolids(h)).map(solidHandle).flatMap((s) => iterShapes$1(bk, s, type));
|
|
5600
5600
|
return [];
|
|
5601
5601
|
}
|
|
5602
5602
|
function iterSolid(bk, h, type) {
|
|
@@ -5612,7 +5612,7 @@ function iterShellChildren(bk, h, type) {
|
|
|
5612
5612
|
const faces = toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5613
5613
|
const seen = /* @__PURE__ */ new Set();
|
|
5614
5614
|
const results = [];
|
|
5615
|
-
for (const face of faces) for (const child of iterShapes(bk, face, type)) {
|
|
5615
|
+
for (const face of faces) for (const child of iterShapes$1(bk, face, type)) {
|
|
5616
5616
|
const childId = unwrap$1(child);
|
|
5617
5617
|
if (seen.has(childId)) continue;
|
|
5618
5618
|
seen.add(childId);
|
|
@@ -5672,7 +5672,7 @@ function iterEdge(bk, shape, h, type) {
|
|
|
5672
5672
|
}
|
|
5673
5673
|
return [];
|
|
5674
5674
|
}
|
|
5675
|
-
function iterShapes(bk, shape, type) {
|
|
5675
|
+
function iterShapes$1(bk, shape, type) {
|
|
5676
5676
|
const h = unwrap$1(shape);
|
|
5677
5677
|
switch (shape.type) {
|
|
5678
5678
|
case "compound": return iterCompound(bk, h, type);
|
|
@@ -5687,31 +5687,31 @@ function iterShapes(bk, shape, type) {
|
|
|
5687
5687
|
function iterShapeList(_bk, list, callback) {
|
|
5688
5688
|
if (Array.isArray(list)) for (const item of list) callback(item);
|
|
5689
5689
|
}
|
|
5690
|
-
function shapeType(_bk, shape) {
|
|
5690
|
+
function shapeType$1(_bk, shape) {
|
|
5691
5691
|
if (isBrepkitHandle(shape)) return shape.type;
|
|
5692
5692
|
throw new Error("brepkit: cannot determine shape type of non-brepkit handle");
|
|
5693
5693
|
}
|
|
5694
|
-
function isSame(_bk, a, b) {
|
|
5694
|
+
function isSame$1(_bk, a, b) {
|
|
5695
5695
|
return isBrepkitHandle(a) && isBrepkitHandle(b) && a.id === b.id && a.type === b.type;
|
|
5696
5696
|
}
|
|
5697
5697
|
function isEqual(_bk, a, b) {
|
|
5698
|
-
return isSame(_bk, a, b);
|
|
5698
|
+
return isSame$1(_bk, a, b);
|
|
5699
5699
|
}
|
|
5700
5700
|
function downcast(_bk, shape, _type) {
|
|
5701
5701
|
return shape;
|
|
5702
5702
|
}
|
|
5703
|
-
function hashCode(_bk, shape, upperBound) {
|
|
5703
|
+
function hashCode$1(_bk, shape, upperBound) {
|
|
5704
5704
|
if (!isBrepkitHandle(shape)) return 0;
|
|
5705
5705
|
return shape.id % upperBound;
|
|
5706
5706
|
}
|
|
5707
|
-
function isNull(_bk, shape) {
|
|
5707
|
+
function isNull$1(_bk, shape) {
|
|
5708
5708
|
return !shape || !isBrepkitHandle(shape);
|
|
5709
5709
|
}
|
|
5710
5710
|
function shapeOrientation(bk, shape) {
|
|
5711
5711
|
const h = unwrap$1(shape);
|
|
5712
5712
|
return bk.getShapeOrientation(h);
|
|
5713
5713
|
}
|
|
5714
|
-
function edgeToFaceMap(bk, shape) {
|
|
5714
|
+
function edgeToFaceMap$1(bk, shape) {
|
|
5715
5715
|
const solidId = unwrapSolidOrThrow(shape, "edgeToFaceMap");
|
|
5716
5716
|
return bk.edgeToFaceMap(solidId);
|
|
5717
5717
|
}
|
|
@@ -5720,7 +5720,7 @@ function sharedEdges(bk, faceA, faceB) {
|
|
|
5720
5720
|
const bId = unwrap$1(faceB, "face");
|
|
5721
5721
|
return Array.from(bk.sharedEdges(aId, bId)).map((id) => edgeHandle(id));
|
|
5722
5722
|
}
|
|
5723
|
-
function adjacentFaces(bk, shape, face) {
|
|
5723
|
+
function adjacentFaces$1(bk, shape, face) {
|
|
5724
5724
|
const solidId = unwrapSolidOrThrow(shape, "adjacentFaces");
|
|
5725
5725
|
const faceId = unwrap$1(face, "face");
|
|
5726
5726
|
return Array.from(bk.adjacentFaces(solidId, faceId)).map((id) => faceHandle(id));
|
|
@@ -5745,20 +5745,20 @@ function sew(bk, shapes, tolerance) {
|
|
|
5745
5745
|
/** Co-located factory: returns the topology-iteration slice of {@link KernelAdapter} bound to `bk`. */
|
|
5746
5746
|
function makeTopologyOps$1(bk) {
|
|
5747
5747
|
return {
|
|
5748
|
-
iterShapes: (shape, type) => iterShapes(bk, shape, type),
|
|
5748
|
+
iterShapes: (shape, type) => iterShapes$1(bk, shape, type),
|
|
5749
5749
|
iterShapeList: (list, callback) => {
|
|
5750
5750
|
iterShapeList(bk, list, callback);
|
|
5751
5751
|
},
|
|
5752
|
-
shapeType: (shape) => shapeType(bk, shape),
|
|
5753
|
-
isSame: (a, b) => isSame(bk, a, b),
|
|
5752
|
+
shapeType: (shape) => shapeType$1(bk, shape),
|
|
5753
|
+
isSame: (a, b) => isSame$1(bk, a, b),
|
|
5754
5754
|
isEqual: (a, b) => isEqual(bk, a, b),
|
|
5755
5755
|
downcast: (shape, type) => downcast(bk, shape, type),
|
|
5756
|
-
hashCode: (shape, upperBound) => hashCode(bk, shape, upperBound),
|
|
5757
|
-
isNull: (shape) => isNull(bk, shape),
|
|
5756
|
+
hashCode: (shape, upperBound) => hashCode$1(bk, shape, upperBound),
|
|
5757
|
+
isNull: (shape) => isNull$1(bk, shape),
|
|
5758
5758
|
shapeOrientation: (shape) => shapeOrientation(bk, shape),
|
|
5759
|
-
edgeToFaceMap: (shape) => edgeToFaceMap(bk, shape),
|
|
5759
|
+
edgeToFaceMap: (shape) => edgeToFaceMap$1(bk, shape),
|
|
5760
5760
|
sharedEdges: (faceA, faceB) => sharedEdges(bk, faceA, faceB),
|
|
5761
|
-
adjacentFaces: (shape, face) => adjacentFaces(bk, shape, face),
|
|
5761
|
+
adjacentFaces: (shape, face) => adjacentFaces$1(bk, shape, face),
|
|
5762
5762
|
sew: (shapes, tolerance) => sew(bk, shapes, tolerance)
|
|
5763
5763
|
};
|
|
5764
5764
|
}
|
|
@@ -5904,7 +5904,7 @@ function curvePeriod(bk, shape) {
|
|
|
5904
5904
|
}
|
|
5905
5905
|
function curveType(bk, shape) {
|
|
5906
5906
|
if (shape.type === "wire") {
|
|
5907
|
-
const first = iterShapes(bk, shape, "edge")[0];
|
|
5907
|
+
const first = iterShapes$1(bk, shape, "edge")[0];
|
|
5908
5908
|
if (first) return bk.getEdgeCurveType(unwrap$1(first, "edge"));
|
|
5909
5909
|
return "LINE";
|
|
5910
5910
|
}
|
|
@@ -5980,7 +5980,7 @@ function recognizeFeatures(bk, shape, tolerance) {
|
|
|
5980
5980
|
return bk.recognizeFeatures(solidId, tolerance);
|
|
5981
5981
|
}
|
|
5982
5982
|
function projectEdges(bk, shape, _cameraOrigin, _cameraDirection, _cameraXAxis) {
|
|
5983
|
-
const edges = iterShapes(bk, shape, "edge");
|
|
5983
|
+
const edges = iterShapes$1(bk, shape, "edge");
|
|
5984
5984
|
const emptyCompound = edges.length > 0 ? edges[0] : shape;
|
|
5985
5985
|
return {
|
|
5986
5986
|
visible: {
|
|
@@ -6235,7 +6235,7 @@ function extractPlaneFromFace(bk, faceShape) {
|
|
|
6235
6235
|
let faceId;
|
|
6236
6236
|
const h = faceShape;
|
|
6237
6237
|
if (h.type === "solid" || h.type === "compound") {
|
|
6238
|
-
const faces = iterShapes(bk, faceShape, "face");
|
|
6238
|
+
const faces = iterShapes$1(bk, faceShape, "face");
|
|
6239
6239
|
if (faces.length === 0) throw new Error("brepkit: extractPlaneFromFace: no faces found");
|
|
6240
6240
|
const firstFace = faces[0];
|
|
6241
6241
|
if (!firstFace) throw new Error("brepkit: extractPlaneFromFace: no faces found");
|
|
@@ -7381,7 +7381,7 @@ function brepkitJoinType(joinType) {
|
|
|
7381
7381
|
}
|
|
7382
7382
|
function offsetWire2D(bk, wire, offsetVal, joinType) {
|
|
7383
7383
|
if (typeof bk.offsetWire2DWithJoin === "function") return wireHandle(bk.offsetWire2DWithJoin(unwrap$1(wire, "wire"), offsetVal, brepkitJoinType(joinType)));
|
|
7384
|
-
const edges = iterShapes(bk, wire, "edge");
|
|
7384
|
+
const edges = iterShapes$1(bk, wire, "edge");
|
|
7385
7385
|
if (edges.length === 0) return wire;
|
|
7386
7386
|
const coords2d = [];
|
|
7387
7387
|
for (const edge of edges) {
|
|
@@ -8788,7 +8788,7 @@ function fixWireOnFace(wire, _face, _tolerance) {
|
|
|
8788
8788
|
}
|
|
8789
8789
|
function fillSurface(bk, wires, _options) {
|
|
8790
8790
|
if (wires.length >= 1) {
|
|
8791
|
-
const wireEdges = iterShapes(bk, wires[0], "edge");
|
|
8791
|
+
const wireEdges = iterShapes$1(bk, wires[0], "edge");
|
|
8792
8792
|
if (wireEdges.length === 4) {
|
|
8793
8793
|
const allCoords = [];
|
|
8794
8794
|
const curveLengths = [];
|
|
@@ -8900,7 +8900,7 @@ function volume$1(bk, shape) {
|
|
|
8900
8900
|
const h = shape;
|
|
8901
8901
|
if (h.type === "solid") return bk.volume(unwrap$1(shape), DEFAULT_DEFLECTION);
|
|
8902
8902
|
if (h.type === "compound") {
|
|
8903
|
-
const solids = iterShapes(bk, shape, "solid");
|
|
8903
|
+
const solids = iterShapes$1(bk, shape, "solid");
|
|
8904
8904
|
let total = 0;
|
|
8905
8905
|
for (const s of solids) total += bk.volume(unwrap$1(s), DEFAULT_DEFLECTION);
|
|
8906
8906
|
return total;
|
|
@@ -8912,7 +8912,7 @@ function area$1(bk, shape) {
|
|
|
8912
8912
|
if (h.type === "face") return bk.faceArea(unwrap$1(shape), DEFAULT_DEFLECTION);
|
|
8913
8913
|
if (h.type === "solid") return bk.surfaceArea(unwrap$1(shape), DEFAULT_DEFLECTION);
|
|
8914
8914
|
if (h.type === "compound") {
|
|
8915
|
-
const faces = iterShapes(bk, shape, "face");
|
|
8915
|
+
const faces = iterShapes$1(bk, shape, "face");
|
|
8916
8916
|
let total = 0;
|
|
8917
8917
|
for (const face of faces) total += bk.faceArea(unwrap$1(face), DEFAULT_DEFLECTION);
|
|
8918
8918
|
return total;
|
|
@@ -8943,7 +8943,7 @@ function centerOfMass$1(bk, shape) {
|
|
|
8943
8943
|
}
|
|
8944
8944
|
if (h.type === "edge") return edgeMidpoint(bk, h.id);
|
|
8945
8945
|
if (h.type === "vertex") return vertexPosition(bk, shape);
|
|
8946
|
-
const vertices = iterShapes(bk, shape, "vertex");
|
|
8946
|
+
const vertices = iterShapes$1(bk, shape, "vertex");
|
|
8947
8947
|
if (vertices.length > 0) {
|
|
8948
8948
|
let sx = 0, sy = 0, sz = 0;
|
|
8949
8949
|
for (const v of vertices) {
|
|
@@ -8985,7 +8985,7 @@ function boundingBox$1(bk, shape) {
|
|
|
8985
8985
|
max: [...pos]
|
|
8986
8986
|
};
|
|
8987
8987
|
}
|
|
8988
|
-
const vertices = iterShapes(bk, shape, "vertex");
|
|
8988
|
+
const vertices = iterShapes$1(bk, shape, "vertex");
|
|
8989
8989
|
if (vertices.length === 0) return {
|
|
8990
8990
|
min: [
|
|
8991
8991
|
0,
|
|
@@ -9417,7 +9417,7 @@ function sweep(bk, wire, spine, options) {
|
|
|
9417
9417
|
const profileHandle = wire;
|
|
9418
9418
|
const faceId = profileHandle.type === "wire" ? bk.makeFaceFromWire(profileHandle.id) : unwrap$1(wire, "face");
|
|
9419
9419
|
if (spine.type === "wire") {
|
|
9420
|
-
const edgeIds = iterShapes(bk, spine, "edge").map((e) => unwrap$1(e, "edge"));
|
|
9420
|
+
const edgeIds = iterShapes$1(bk, spine, "edge").map((e) => unwrap$1(e, "edge"));
|
|
9421
9421
|
if (contactMode && edgeIds.length === 1) {
|
|
9422
9422
|
const edgeId = edgeIds[0];
|
|
9423
9423
|
if (edgeId !== void 0) return solidHandle(bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0, "transformed"));
|
|
@@ -9437,7 +9437,7 @@ function simplePipe(bk, profile, spine) {
|
|
|
9437
9437
|
const profileHandle = profile;
|
|
9438
9438
|
const faceId = profileHandle.type === "wire" ? bk.makeFaceFromWire(profileHandle.id) : unwrap$1(profile, "face");
|
|
9439
9439
|
if (spine.type === "wire") {
|
|
9440
|
-
const edgeIds = iterShapes(bk, spine, "edge").map((e) => unwrap$1(e, "edge"));
|
|
9440
|
+
const edgeIds = iterShapes$1(bk, spine, "edge").map((e) => unwrap$1(e, "edge"));
|
|
9441
9441
|
return solidHandle(bk.sweepAlongEdges(faceId, edgeIds));
|
|
9442
9442
|
}
|
|
9443
9443
|
const nurbsData = extractNurbsFromEdge(bk, spine);
|
|
@@ -9480,7 +9480,7 @@ function tryContactModeSweep(bk, faceId, edgeId, contactMode) {
|
|
|
9480
9480
|
function resolveContactModeEdge(bk, spine) {
|
|
9481
9481
|
try {
|
|
9482
9482
|
if (spine.type !== "wire") return { edgeId: unwrap$1(spine, "edge") };
|
|
9483
|
-
const edges = iterShapes(bk, spine, "edge");
|
|
9483
|
+
const edges = iterShapes$1(bk, spine, "edge");
|
|
9484
9484
|
if (edges.length === 1) {
|
|
9485
9485
|
const first = edges[0];
|
|
9486
9486
|
if (first) return { edgeId: unwrap$1(first, "edge") };
|
|
@@ -9746,12 +9746,11 @@ function nodeOf(shape) {
|
|
|
9746
9746
|
function asManifoldShape(shape) {
|
|
9747
9747
|
if (shape && typeof shape === "object" && "manifold" in shape && "node" in shape) return shape;
|
|
9748
9748
|
}
|
|
9749
|
+
var OCCT_FAMILY_IDS = ["occt", "occt-wasm"];
|
|
9749
9750
|
function resolveOcct() {
|
|
9750
|
-
try {
|
|
9751
|
-
return getKernel(
|
|
9752
|
-
} catch {
|
|
9753
|
-
return;
|
|
9754
|
-
}
|
|
9751
|
+
for (const id of OCCT_FAMILY_IDS) try {
|
|
9752
|
+
return getKernel(id);
|
|
9753
|
+
} catch {}
|
|
9755
9754
|
}
|
|
9756
9755
|
function occtOrThrow(method) {
|
|
9757
9756
|
const occt = resolveOcct();
|
|
@@ -12076,79 +12075,70 @@ function brepOf(shape, method) {
|
|
|
12076
12075
|
brep
|
|
12077
12076
|
};
|
|
12078
12077
|
}
|
|
12078
|
+
function shapeType(shape) {
|
|
12079
|
+
if (asManifoldShape(shape)) return "solid";
|
|
12080
|
+
const { occt, brep } = brepOf(shape, "shapeType");
|
|
12081
|
+
return occt.shapeType(brep);
|
|
12082
|
+
}
|
|
12083
|
+
function isSame(a, b) {
|
|
12084
|
+
const sa = asManifoldShape(a);
|
|
12085
|
+
const sb = asManifoldShape(b);
|
|
12086
|
+
if (!sa || !sb) return false;
|
|
12087
|
+
return sa.manifold === sb.manifold;
|
|
12088
|
+
}
|
|
12089
|
+
function hashCode(shape, upperBound) {
|
|
12090
|
+
if (!asManifoldShape(shape)) return 0;
|
|
12091
|
+
const { occt, brep } = brepOf(shape, "hashCode");
|
|
12092
|
+
return occt.hashCode(brep, upperBound);
|
|
12093
|
+
}
|
|
12094
|
+
function isNull(shape) {
|
|
12095
|
+
const s = asManifoldShape(shape);
|
|
12096
|
+
if (!s) return true;
|
|
12097
|
+
const solid = unwrap(s);
|
|
12098
|
+
return !solid || typeof solid.isEmpty === "function" && solid.isEmpty();
|
|
12099
|
+
}
|
|
12100
|
+
function iterShapes(shape, type) {
|
|
12101
|
+
const s = asManifoldShape(shape);
|
|
12102
|
+
if (!s) return [];
|
|
12103
|
+
if (type === "solid") return [shape];
|
|
12104
|
+
if (type !== "edge" && type !== "face") return [];
|
|
12105
|
+
if (!s.node.replayable) return [];
|
|
12106
|
+
const occt = resolveOcct();
|
|
12107
|
+
if (!occt) return [];
|
|
12108
|
+
const brep = brepCache.get(s.node) ?? (() => {
|
|
12109
|
+
const b = replay(s.node, occt);
|
|
12110
|
+
brepCache.set(s.node, b);
|
|
12111
|
+
return b;
|
|
12112
|
+
})();
|
|
12113
|
+
return occt.iterShapes(brep, type).map((sub, index) => ({
|
|
12114
|
+
__manifoldSub: true,
|
|
12115
|
+
index,
|
|
12116
|
+
box: occt.boundingBox(sub)
|
|
12117
|
+
}));
|
|
12118
|
+
}
|
|
12119
|
+
function edgeToFaceMap(shape) {
|
|
12120
|
+
const { occt, brep } = brepOf(shape, "edgeToFaceMap");
|
|
12121
|
+
return occt.edgeToFaceMap(brep);
|
|
12122
|
+
}
|
|
12123
|
+
function adjacentFaces(shape, face) {
|
|
12124
|
+
const { occt, brep } = brepOf(shape, "adjacentFaces");
|
|
12125
|
+
return occt.adjacentFaces(brep, face);
|
|
12126
|
+
}
|
|
12079
12127
|
function makeTopologyOps(_module) {
|
|
12080
|
-
function shapeType(shape) {
|
|
12081
|
-
const { occt, brep } = brepOf(shape, "shapeType");
|
|
12082
|
-
return occt.shapeType(brep);
|
|
12083
|
-
}
|
|
12084
|
-
function isSame(a, b) {
|
|
12085
|
-
const sa = asManifoldShape(a);
|
|
12086
|
-
const sb = asManifoldShape(b);
|
|
12087
|
-
if (!sa || !sb) return false;
|
|
12088
|
-
return sa.manifold === sb.manifold;
|
|
12089
|
-
}
|
|
12090
|
-
function isEqual(a, b) {
|
|
12091
|
-
return isSame(a, b);
|
|
12092
|
-
}
|
|
12093
|
-
function hashCode(shape, upperBound) {
|
|
12094
|
-
if (!asManifoldShape(shape)) return 0;
|
|
12095
|
-
const { occt, brep } = brepOf(shape, "hashCode");
|
|
12096
|
-
return occt.hashCode(brep, upperBound);
|
|
12097
|
-
}
|
|
12098
|
-
function isNull(shape) {
|
|
12099
|
-
const s = asManifoldShape(shape);
|
|
12100
|
-
if (!s) return true;
|
|
12101
|
-
const solid = unwrap(s);
|
|
12102
|
-
return !solid || typeof solid.isEmpty === "function" && solid.isEmpty();
|
|
12103
|
-
}
|
|
12104
|
-
function shapeOrientation(_shape) {
|
|
12105
|
-
return "forward";
|
|
12106
|
-
}
|
|
12107
|
-
function iterShapes(shape, type) {
|
|
12108
|
-
const s = asManifoldShape(shape);
|
|
12109
|
-
if (!s) return [];
|
|
12110
|
-
if (type === "solid") return [shape];
|
|
12111
|
-
if (type !== "edge" && type !== "face") return [];
|
|
12112
|
-
if (!s.node.replayable) return [];
|
|
12113
|
-
const occt = resolveOcct();
|
|
12114
|
-
if (!occt) return [];
|
|
12115
|
-
const brep = brepCache.get(s.node) ?? (() => {
|
|
12116
|
-
const b = replay(s.node, occt);
|
|
12117
|
-
brepCache.set(s.node, b);
|
|
12118
|
-
return b;
|
|
12119
|
-
})();
|
|
12120
|
-
return occt.iterShapes(brep, type).map((sub, index) => ({
|
|
12121
|
-
__manifoldSub: true,
|
|
12122
|
-
index,
|
|
12123
|
-
box: occt.boundingBox(sub)
|
|
12124
|
-
}));
|
|
12125
|
-
}
|
|
12126
|
-
function iterShapeList(list, callback) {
|
|
12127
|
-
occtOrThrow("iterShapeList").iterShapeList(list, callback);
|
|
12128
|
-
}
|
|
12129
|
-
function edgeToFaceMap(shape) {
|
|
12130
|
-
const { occt, brep } = brepOf(shape, "edgeToFaceMap");
|
|
12131
|
-
return occt.edgeToFaceMap(brep);
|
|
12132
|
-
}
|
|
12133
|
-
function sharedEdges(faceA, faceB) {
|
|
12134
|
-
return occtOrThrow("sharedEdges").sharedEdges(faceA, faceB);
|
|
12135
|
-
}
|
|
12136
|
-
function adjacentFaces(shape, face) {
|
|
12137
|
-
const { occt, brep } = brepOf(shape, "adjacentFaces");
|
|
12138
|
-
return occt.adjacentFaces(brep, face);
|
|
12139
|
-
}
|
|
12140
12128
|
return {
|
|
12141
12129
|
iterShapes,
|
|
12142
|
-
iterShapeList,
|
|
12130
|
+
iterShapeList: (list, callback) => {
|
|
12131
|
+
occtOrThrow("iterShapeList").iterShapeList(list, callback);
|
|
12132
|
+
},
|
|
12143
12133
|
shapeType,
|
|
12144
12134
|
isSame,
|
|
12145
|
-
isEqual,
|
|
12135
|
+
isEqual: isSame,
|
|
12146
12136
|
downcast: (shape) => shape,
|
|
12147
12137
|
hashCode,
|
|
12148
12138
|
isNull,
|
|
12149
|
-
shapeOrientation,
|
|
12139
|
+
shapeOrientation: (_shape) => "forward",
|
|
12150
12140
|
edgeToFaceMap,
|
|
12151
|
-
sharedEdges,
|
|
12141
|
+
sharedEdges: (faceA, faceB) => occtOrThrow("sharedEdges").sharedEdges(faceA, faceB),
|
|
12152
12142
|
adjacentFaces,
|
|
12153
12143
|
sew: () => {
|
|
12154
12144
|
throw new Error("manifold: sew is unsupported on the mesh kernel; use a B-rep kernel");
|
|
@@ -12896,12 +12886,8 @@ var KERNEL_2D_METHODS = [
|
|
|
12896
12886
|
"fillSurface"
|
|
12897
12887
|
];
|
|
12898
12888
|
function resolveOcct2D(method) {
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
occt = getKernel("occt");
|
|
12902
|
-
} catch {
|
|
12903
|
-
throw new Error(`manifold: ${method} unsupported on manifold kernel; no B-rep kernel registered`);
|
|
12904
|
-
}
|
|
12889
|
+
const occt = resolveOcct();
|
|
12890
|
+
if (!occt) throw new Error(`manifold: ${method} unsupported on manifold kernel; no B-rep kernel registered`);
|
|
12905
12891
|
return occt;
|
|
12906
12892
|
}
|
|
12907
12893
|
function makeKernel2DOps(_module) {
|