brepjs 20.12.2 → 20.12.5

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.
Files changed (100) hide show
  1. package/dist/2d.cjs +6 -6
  2. package/dist/2d.js +6 -6
  3. package/dist/{adjacencyFns-C0YD3Zrp.js → adjacencyFns-B2Po1gPs.js} +3 -3
  4. package/dist/{adjacencyFns-Cibtcqdl.cjs → adjacencyFns-Cho9v3Q3.cjs} +3 -3
  5. package/dist/{blueprint-p1SmFAfl.cjs → blueprint-ERmwk6zG.cjs} +5 -5
  6. package/dist/{blueprint-CLgJoNt5.js → blueprint-Zmt5-07y.js} +5 -5
  7. package/dist/{blueprintFns-DU8_o9zy.cjs → blueprintFns-B_sxtIo7.cjs} +2 -2
  8. package/dist/{blueprintFns-D4wl5Fft.js → blueprintFns-Dtm-XukP.js} +2 -2
  9. package/dist/{blueprintSketcher-BTJqAd7E.cjs → blueprintSketcher-CZyokLGJ.cjs} +3 -3
  10. package/dist/{blueprintSketcher-CmR6Mi91.js → blueprintSketcher-CwTAtrkY.js} +3 -3
  11. package/dist/{boolean2D-CEPQF4LP.cjs → boolean2D-CRuNKgXs.cjs} +4 -4
  12. package/dist/{boolean2D-C3bLz5i0.js → boolean2D-yUpS8onH.js} +4 -4
  13. package/dist/brepjs.cjs +128 -100
  14. package/dist/brepjs.js +128 -100
  15. package/dist/{cameraFns-CUX8VNKT.cjs → cameraFns-DB1IyMmS.cjs} +3 -3
  16. package/dist/{cameraFns-xUCRxpsa.js → cameraFns-DRok4UxZ.js} +3 -3
  17. package/dist/core.cjs +2 -2
  18. package/dist/core.js +2 -2
  19. package/dist/{cornerFinder-CBjvTijF.js → cornerFinder-D5qnDbtZ.js} +1 -1
  20. package/dist/{cornerFinder-BToeCt6c.cjs → cornerFinder-DfYBHHZG.cjs} +1 -1
  21. package/dist/{curveFns-AMqd_WaO.js → curveFns-BGPSFUWB.js} +1 -1
  22. package/dist/{curveFns-CMiP40Ko.cjs → curveFns-BKT4Sg8q.cjs} +1 -1
  23. package/dist/{drawFns-BOyA7iOt.cjs → drawFns-D8e5RiRe.cjs} +23 -15
  24. package/dist/{drawFns-DzqPMBHE.js → drawFns-aGufr-pr.js} +23 -15
  25. package/dist/{faceFns-C6fYNgZl.cjs → faceFns-Cx7cwUMx.cjs} +2 -2
  26. package/dist/{faceFns-DEDlLMcn.js → faceFns-lE2OvBfq.js} +2 -2
  27. package/dist/{healingFns-CJIIjQKh.js → healingFns-B94zSk1-.js} +5 -5
  28. package/dist/{healingFns-383ByJpH.cjs → healingFns-CcgyrL6h.cjs} +5 -5
  29. package/dist/{helpers-DxoCOnD_.cjs → helpers-C4f2MV-r.cjs} +14 -10
  30. package/dist/{helpers-i26hsY3T.js → helpers-CNgipe6l.js} +14 -10
  31. package/dist/{importFns-Fr6WPpl2.cjs → importFns-fIdcaMqt.cjs} +2 -2
  32. package/dist/{importFns-Bz4sXl93.js → importFns-gB1X3ti2.js} +2 -2
  33. package/dist/index.d.ts +2 -2
  34. package/dist/io.cjs +2 -2
  35. package/dist/io.js +2 -2
  36. package/dist/kernel/geometry2d.d.ts +7 -0
  37. package/dist/kernel/occtWasm/constructionOps.d.ts +1 -1
  38. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  39. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +1 -1
  40. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  41. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +5 -0
  42. package/dist/{loftFns-BsFinbgs.cjs → loftFns-AHaYxJyS.cjs} +17 -2
  43. package/dist/{loftFns-pMh0ET-J.js → loftFns-mbyBvJ8Y.js} +17 -2
  44. package/dist/{measureFns-BuxKO1GV.js → measureFns-C94G0fH8.js} +102 -35
  45. package/dist/{measureFns-Ed7LXAhG.cjs → measureFns-CuabRDRL.cjs} +102 -35
  46. package/dist/measurement/measureFns.d.ts +3 -2
  47. package/dist/measurement.cjs +2 -2
  48. package/dist/measurement.js +2 -2
  49. package/dist/{meshFns-BNrdUhgG.cjs → meshFns-GXF5gPZL.cjs} +3 -3
  50. package/dist/{meshFns-LytwBtBQ.js → meshFns-jarDZKw1.js} +3 -3
  51. package/dist/{occtWasmAdapter-D1EXktNq.cjs → occtWasmAdapter-DeoeK2iJ.cjs} +39 -7
  52. package/dist/{occtWasmAdapter-RBm-JLoN.js → occtWasmAdapter-DlNmVNUn.js} +39 -7
  53. package/dist/operations/patternFns.d.ts +6 -1
  54. package/dist/operations.cjs +2 -2
  55. package/dist/operations.js +2 -2
  56. package/dist/{originTrackingFns-BqlxFeWq.js → originTrackingFns-BxeUD2NM.js} +2 -2
  57. package/dist/{originTrackingFns-BRJ2PZ8J.cjs → originTrackingFns-C-yuMV3m.cjs} +2 -2
  58. package/dist/{primitiveFns-wOdKnYBs.cjs → primitiveFns-BVAkYHVf.cjs} +7 -14
  59. package/dist/{primitiveFns-DrEUKZvX.js → primitiveFns-CualoFAk.js} +7 -14
  60. package/dist/{principalBoxFns-D8rqqCl2.cjs → principalBoxFns-DHh5_HCw.cjs} +3 -3
  61. package/dist/{principalBoxFns-C0UzVmfC.js → principalBoxFns-DtI7tVuS.js} +3 -3
  62. package/dist/projection.cjs +1 -1
  63. package/dist/projection.js +1 -1
  64. package/dist/query/finderCore.d.ts +7 -7
  65. package/dist/query.cjs +2 -2
  66. package/dist/query.js +2 -2
  67. package/dist/{refResolveFns-BqcjC50D.js → refResolveFns--SRyN2qa.js} +6 -6
  68. package/dist/{refResolveFns-C23E6pcj.cjs → refResolveFns-CaAw-ya3.cjs} +6 -6
  69. package/dist/{shapeFns-D7DcPxfx.js → shapeFns-CdrDroOM.js} +2 -2
  70. package/dist/{shapeFns-CHFmX5HQ.cjs → shapeFns-CwjjUOr0.cjs} +2 -2
  71. package/dist/shapeRef.cjs +1 -1
  72. package/dist/shapeRef.js +1 -1
  73. package/dist/{shapeTypes-HDVHzNk1.cjs → shapeTypes-D938X2mg.cjs} +1 -1
  74. package/dist/{shapeTypes-Db3yAgTO.js → shapeTypes-PNVEv6ga.js} +1 -1
  75. package/dist/sketching/sketchFns.d.ts +8 -3
  76. package/dist/sketching/sketches.d.ts +8 -0
  77. package/dist/sketching.cjs +3 -3
  78. package/dist/sketching.js +3 -3
  79. package/dist/{solidBuilders-DYumkmVa.cjs → solidBuilders-CAkBQKWb.cjs} +5 -5
  80. package/dist/{solidBuilders-CAiqZrAE.js → solidBuilders-Hft8Cr6a.js} +5 -5
  81. package/dist/{surfaceBuilders-o3H-x6Ca.cjs → surfaceBuilders-BKCiVf7T.cjs} +3 -3
  82. package/dist/{surfaceBuilders-CW6cUdk9.js → surfaceBuilders-CrO_BBKM.js} +3 -3
  83. package/dist/text.cjs +2 -2
  84. package/dist/text.js +2 -2
  85. package/dist/{textBlueprints-BE9fvro-.js → textBlueprints-B8q2a-nN.js} +52 -16
  86. package/dist/{textBlueprints-BSU9_W8u.cjs → textBlueprints-C9HeYc5a.cjs} +52 -16
  87. package/dist/{textMetrics-BHunx03s.cjs → textMetrics-1fhCSAGF.cjs} +1 -1
  88. package/dist/{textMetrics-DBqFVzjh.js → textMetrics-DJfTSy6w.js} +1 -1
  89. package/dist/{threadFns-DckgA8OY.cjs → threadFns-CVIEbOW3.cjs} +37 -29
  90. package/dist/{threadFns-DViBlfHh.js → threadFns-f2KwibLR.js} +36 -28
  91. package/dist/topology/apiTypes.d.ts +13 -7
  92. package/dist/topology/topologyQueryFns.d.ts +9 -1
  93. package/dist/topology.cjs +9 -9
  94. package/dist/topology.d.ts +1 -1
  95. package/dist/topology.js +9 -9
  96. package/dist/{topologyQueryFns-gyva7bvF.cjs → topologyQueryFns-4WYqtSFF.cjs} +1 -14
  97. package/dist/{topologyQueryFns-DKNVBMuN.js → topologyQueryFns-BZUY10TD.js} +1 -14
  98. package/dist/{validityTypes-BmqE7KfX.js → validityTypes-DAXIqwZM.js} +1 -1
  99. package/dist/{validityTypes-CwMwVFdY.cjs → validityTypes-tWSx_zAH.cjs} +1 -1
  100. package/package.json +2 -1
@@ -1,12 +1,12 @@
1
- const require_shapeTypes = require("./shapeTypes-HDVHzNk1.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D938X2mg.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-gyva7bvF.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-4WYqtSFF.cjs");
4
4
  const require_constants = require("./constants-oee0S_x6.cjs");
5
5
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
6
- const require_faceFns = require("./faceFns-C6fYNgZl.cjs");
7
- const require_shapeFns = require("./shapeFns-CHFmX5HQ.cjs");
8
- const require_curveFns = require("./curveFns-CMiP40Ko.cjs");
9
- const require_measureFns = require("./measureFns-Ed7LXAhG.cjs");
6
+ const require_faceFns = require("./faceFns-Cx7cwUMx.cjs");
7
+ const require_shapeFns = require("./shapeFns-CwjjUOr0.cjs");
8
+ const require_curveFns = require("./curveFns-BKT4Sg8q.cjs");
9
+ const require_measureFns = require("./measureFns-CuabRDRL.cjs");
10
10
  // src/utils/vec2d.ts
11
11
  /** Precision for curve intersection and parameter operations. */
12
12
  var PRECISION_INTERSECTION = 1e-9;
@@ -216,11 +216,15 @@ function resolveDir(dir) {
216
216
  * with a vertex constructed at the reference point.
217
217
  */
218
218
  function distanceFromPointFilter(distance, point, tolerance) {
219
- const kernel = require_shapeTypes.getKernel();
220
- const vtx = kernel.makeVertex(point[0], point[1], point[2]);
221
219
  return (element) => {
222
- const d = kernel.distance(vtx, element.wrapped).value;
223
- return Math.abs(d - distance) < tolerance;
220
+ const kernel = require_shapeTypes.getKernel();
221
+ const vtx = kernel.makeVertex(point[0], point[1], point[2]);
222
+ try {
223
+ const d = kernel.distance(vtx, element.wrapped).value;
224
+ return Math.abs(d - distance) < tolerance;
225
+ } finally {
226
+ kernel.dispose(vtx);
227
+ }
224
228
  };
225
229
  }
226
230
  // src/query/shapeFinders.ts
@@ -1,12 +1,12 @@
1
- import { q as getKernel, y as isFace } from "./shapeTypes-Db3yAgTO.js";
1
+ import { q as getKernel, y as isFace } from "./shapeTypes-PNVEv6ga.js";
2
2
  import { E as ok, g as err, o as queryError, x as isOk } from "./errors-BTccWbtE.js";
3
- import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-DKNVBMuN.js";
3
+ import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-BZUY10TD.js";
4
4
  import { t as DEG2RAD } from "./constants-iraOnb2p.js";
5
5
  import { a as vecDot, d as vecNormalize } from "./vecOps-S-m9H_fe.js";
6
- import { l as normalAt, s as getSurfaceType } from "./faceFns-DEDlLMcn.js";
7
- import { a as isSameShape, n as getHashCode } from "./shapeFns-D7DcPxfx.js";
8
- import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-AMqd_WaO.js";
9
- import { n as measureArea } from "./measureFns-BuxKO1GV.js";
6
+ import { l as normalAt, s as getSurfaceType } from "./faceFns-lE2OvBfq.js";
7
+ import { a as isSameShape, n as getHashCode } from "./shapeFns-CdrDroOM.js";
8
+ import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-BGPSFUWB.js";
9
+ import { n as measureArea } from "./measureFns-C94G0fH8.js";
10
10
  // src/utils/vec2d.ts
11
11
  /** Precision for curve intersection and parameter operations. */
12
12
  var PRECISION_INTERSECTION = 1e-9;
@@ -216,11 +216,15 @@ function resolveDir(dir) {
216
216
  * with a vertex constructed at the reference point.
217
217
  */
218
218
  function distanceFromPointFilter(distance, point, tolerance) {
219
- const kernel = getKernel();
220
- const vtx = kernel.makeVertex(point[0], point[1], point[2]);
221
219
  return (element) => {
222
- const d = kernel.distance(vtx, element.wrapped).value;
223
- return Math.abs(d - distance) < tolerance;
220
+ const kernel = getKernel();
221
+ const vtx = kernel.makeVertex(point[0], point[1], point[2]);
222
+ try {
223
+ const d = kernel.distance(vtx, element.wrapped).value;
224
+ return Math.abs(d - distance) < tolerance;
225
+ } finally {
226
+ kernel.dispose(vtx);
227
+ }
224
228
  };
225
229
  }
226
230
  // src/query/shapeFinders.ts
@@ -1,8 +1,8 @@
1
- const require_shapeTypes = require("./shapeTypes-HDVHzNk1.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D938X2mg.cjs");
2
2
  const require_bug = require("./bug-CBcpIPuf.cjs");
3
3
  const require_errors = require("./errors-O_blYTWT.cjs");
4
4
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
5
- const require_blueprint = require("./blueprint-p1SmFAfl.cjs");
5
+ const require_blueprint = require("./blueprint-ERmwk6zG.cjs");
6
6
  // src/io/objExportFns.ts
7
7
  /** Read a vec3 from a typed array at the given vertex index. */
8
8
  function vec3At(arr, i) {
@@ -1,8 +1,8 @@
1
- import { n as castResultShape, q as getKernel } from "./shapeTypes-Db3yAgTO.js";
1
+ import { n as castResultShape, q as getKernel } from "./shapeTypes-PNVEv6ga.js";
2
2
  import { i as wasmIndex, r as vec3At$1 } from "./bug-ClMTAJhe.js";
3
3
  import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-BTccWbtE.js";
4
4
  import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
5
- import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-CLgJoNt5.js";
5
+ import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-Zmt5-07y.js";
6
6
  // src/io/objExportFns.ts
7
7
  /** Read a vec3 from a typed array at the given vertex index. */
8
8
  function vec3At(arr, i) {
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { currentQuality } from './kernel/quality.js';
6
6
  export type { QualityLevel } from './kernel/quality.js';
7
7
  export { EXACT_BREP_CAPABILITIES, DEFAULT_CAPABILITIES } from './kernel/capabilities.js';
8
8
  export type { KernelCapabilities, TessellationModel } from './kernel/capabilities.js';
9
- export type { KernelAdapter, BrepkitHandle, OcctWasmHandle, OcctWasmModule, OcctKernelWasm, SurfaceType, ShapeOrientation, ShapeType, KernelBooleanOps, KernelBuilderOps, KernelCore, KernelCurveOps, KernelEvolutionOps, KernelIOOps, KernelMeasureOps, KernelMeshOps, KernelModifierOps, KernelPrimitiveOps, KernelRepairOps, KernelSurfaceOps, KernelSweepOps, KernelTopologyOps, KernelTransformOps, } from './kernel/index.js';
9
+ export type { KernelAdapter, BrepkitHandle, OcctWasmHandle, OcctWasmModule, OcctKernelWasm, SurfaceType as KernelSurfaceType, ShapeOrientation, ShapeType, KernelBooleanOps, KernelBuilderOps, KernelCore, KernelCurveOps, KernelEvolutionOps, KernelIOOps, KernelMeasureOps, KernelMeshOps, KernelModifierOps, KernelPrimitiveOps, KernelRepairOps, KernelSurfaceOps, KernelSweepOps, KernelTopologyOps, KernelTransformOps, } from './kernel/index.js';
10
10
  export { supportsProjection, supportsConstraintSketch } from './kernel/index.js';
11
11
  export type { ProjectionCapability, ConstraintSketchCapability } from './kernel/index.js';
12
12
  export { getPerformanceStats, resetPerformanceStats } from './kernel/index.js';
@@ -93,7 +93,7 @@ export { facesOfEdge, edgesOfFace, wiresOfFace, verticesOfEdge, verticesOfFace,
93
93
  export { getCurveType, curveStartPoint, curveEndPoint, curvePointAt, curveTangentAt, curveAxis, curveLength, curveIsClosed, curveIsPeriodic, curvePeriod, getOrientation, flipOrientation, offsetWire2D, interpolateCurve, approximateCurve, type InterpolateCurveOptions, type ApproximateCurveOptions, } from './topology/curveFns.js';
94
94
  export { getNurbsCurveData, getNurbsSurfaceData } from './topology/nurbsFns.js';
95
95
  export type { NurbsCurveData, NurbsSurfaceData } from './kernel/types.js';
96
- export { getSurfaceType, faceGeomType, faceOrientation, flipFaceOrientation, uvBounds, pointOnSurface, uvCoordinates, normalAt, faceCenter, faceAxis, classifyPointOnFace, outerWire, innerWires, removeHolesFromFace, projectPointOnFace, type UVBounds, type PointProjectionResult, } from './topology/faceFns.js';
96
+ export { getSurfaceType, faceGeomType, faceOrientation, flipFaceOrientation, uvBounds, pointOnSurface, uvCoordinates, normalAt, faceCenter, faceAxis, classifyPointOnFace, outerWire, innerWires, removeHolesFromFace, projectPointOnFace, type SurfaceType, type UVBounds, type PointProjectionResult, } from './topology/faceFns.js';
97
97
  export { exportSTEP, exportSTL, exportIGES, meshMultiLOD, meshLODs, meshLODsProgressive, type ShapeMesh, type EdgeMesh, type MeshOptions, type MultiLODMesh, type LODMesh, type MeshLODsOptions, type MeshLODsProgressiveOptions, type MeshLevelFn, } from './topology/meshFns.js';
98
98
  export { clearMeshCache, createMeshCache, type MeshCacheContext } from './topology/meshCache.js';
99
99
  export { toBufferGeometryData, toLineGeometryData, toGroupedBufferGeometryData, type BufferGeometryData, type LineGeometryData, type GroupedBufferGeometryData, type BufferGeometryGroup, toLODGeometryData, type LODGeometryData, toLODGeometryLevels, type LODGeometryLevel, } from './topology/threeHelpers.js';
package/dist/io.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_meshFns = require("./meshFns-BNrdUhgG.cjs");
3
- const require_importFns = require("./importFns-Fr6WPpl2.cjs");
2
+ const require_meshFns = require("./meshFns-GXF5gPZL.cjs");
3
+ const require_importFns = require("./importFns-fIdcaMqt.cjs");
4
4
  exports.blueprintToDXF = require_importFns.blueprintToDXF;
5
5
  exports.exportDXF = require_importFns.exportDXF;
6
6
  exports.exportGlb = require_importFns.exportGlb;
package/dist/io.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-LytwBtBQ.js";
2
- import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-Bz4sXl93.js";
1
+ import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-jarDZKw1.js";
2
+ import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-gB1X3ti2.js";
3
3
  export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
@@ -89,6 +89,13 @@ export declare function intersectCurves2dFn(c1: Curve2dObj, c2: Curve2dObj, tole
89
89
  points: [number, number][];
90
90
  segments: Curve2dObj[];
91
91
  };
92
+ /**
93
+ * Gauss-Newton the foot point of (px, py) on c from a sampled start parameter, staying
94
+ * within [from, to] (either order). A sampling grid alone leaves the point up to
95
+ * ~r*pi/N off an arc, while intersection and split callers treat a point as on the
96
+ * curve only within ~1e-8, so an unrefined sample rejects nearly every real crossing.
97
+ */
98
+ export declare function refineFootPoint(c: Curve2dObj, px: number, py: number, start: number, from: number, to: number): number;
92
99
  export declare function serializeCurve2d(c: Curve2dObj): string;
93
100
  export declare function deserializeCurve2d(data: string): Curve2dObj;
94
101
  export declare function createBBox2d(): BBox2d;
@@ -14,7 +14,7 @@ export declare function makeEllipseEdge(k: OcctKernelWasm, center: Vec3, normal:
14
14
  export declare function makeEllipseArc(k: OcctKernelWasm, center: Vec3, normal: Vec3, majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, xDir?: Vec3): KernelShape;
15
15
  export declare function makeBezierEdge(k: OcctKernelWasm, Module: OcctWasmModule, points: [number, number, number][]): KernelShape;
16
16
  export declare function makeTangentArc(k: OcctKernelWasm, startPoint: [number, number, number], startTangent: [number, number, number], endPoint: [number, number, number]): KernelShape;
17
- export declare function makeHelixWire(k: OcctKernelWasm, pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number]): KernelShape;
17
+ export declare function makeHelixWire(k: OcctKernelWasm, pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number], leftHanded?: boolean): KernelShape;
18
18
  export declare function makeCompound(k: OcctKernelWasm, Module: OcctWasmModule, shapes: KernelShape[]): KernelShape;
19
19
  export declare function solidFromShell(k: OcctKernelWasm, shell: KernelShape): KernelShape;
20
20
  export declare function buildSolidFromFaces(k: OcctKernelWasm, Module: OcctWasmModule, points: Array<{
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_occtWasmAdapter = require("../../occtWasmAdapter-D1EXktNq.cjs");
2
+ const require_occtWasmAdapter = require("../../occtWasmAdapter-DeoeK2iJ.cjs");
3
3
  exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
@@ -96,7 +96,7 @@ export declare class OcctWasmAdapter implements KernelAdapter {
96
96
  makeEllipseArc(center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, xDir?: [number, number, number]): KernelShape;
97
97
  makeBezierEdge(points: [number, number, number][]): KernelShape;
98
98
  makeTangentArc(startPoint: [number, number, number], startTangent: [number, number, number], endPoint: [number, number, number]): KernelShape;
99
- makeHelixWire(pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number], _leftHanded?: boolean): KernelShape;
99
+ makeHelixWire(pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number], leftHanded?: boolean): KernelShape;
100
100
  makeWireFromMixed(items: KernelShape[]): KernelShape;
101
101
  makeCompound(shapes: KernelShape[]): KernelShape;
102
102
  solidFromShell(shell: KernelShape): KernelShape;
@@ -1 +1 @@
1
- export { t as OcctWasmAdapter } from "../../occtWasmAdapter-RBm-JLoN.js";
1
+ export { t as OcctWasmAdapter } from "../../occtWasmAdapter-DlNmVNUn.js";
@@ -172,6 +172,11 @@ export interface OcctKernelWasm {
172
172
  makeBezierEdge(flatPoints: EmVectorDouble): number;
173
173
  makeTangentArc(x1: number, y1: number, z1: number, tx: number, ty: number, tz: number, x2: number, y2: number, z2: number): number;
174
174
  makeHelixWire(px: number, py: number, pz: number, dx: number, dy: number, dz: number, pitch: number, height: number, radius: number): number;
175
+ /**
176
+ * {@link makeHelixWire} with an explicit winding. Optional: absent on WASM
177
+ * builds older than occt-wasm 4.3.0, so callers must feature-detect it.
178
+ */
179
+ makeHelixWireHanded?(px: number, py: number, pz: number, dx: number, dy: number, dz: number, pitch: number, height: number, radius: number, leftHanded: boolean): number;
175
180
  makeWire(edgeIds: EmVectorUint32): number;
176
181
  makeFace(wireId: number): number;
177
182
  makeNonPlanarFace(wireId: number): number;
@@ -1,4 +1,4 @@
1
- const require_shapeTypes = require("./shapeTypes-HDVHzNk1.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D938X2mg.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
3
  const require_types = require("./types-CjF9Rofr.cjs");
4
4
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
@@ -40,6 +40,14 @@ function makeSpineWire(start, end) {
40
40
  kernel.dispose(edge);
41
41
  return require_shapeTypes.castResultShape(wire);
42
42
  }
43
+ /** A planar face bounded by `wire`, or `null` when the wire does not span one. */
44
+ function planarFaceOf(wire) {
45
+ try {
46
+ return require_shapeTypes.getKernel().makeFace(wire.wrapped, true);
47
+ } catch {
48
+ return null;
49
+ }
50
+ }
43
51
  /** Build a helix wire for twist extrusion. */
44
52
  function makeHelixWire(pitch, height, radius, center, dir, leftHanded = false) {
45
53
  const kernel = require_shapeTypes.getKernel();
@@ -87,7 +95,14 @@ function castSweepShellTuple(result) {
87
95
  */
88
96
  function sweep(wire, spine, config = {}, shellMode = false) {
89
97
  if (config.mode === "simple" && !shellMode) {
90
- const resultOc = require_shapeTypes.getKernel().simplePipe(wire.wrapped, spine.wrapped);
98
+ const kernel = require_shapeTypes.getKernel();
99
+ const profileFace = planarFaceOf(wire);
100
+ let resultOc;
101
+ try {
102
+ resultOc = kernel.simplePipe(profileFace ?? wire.wrapped, spine.wrapped);
103
+ } finally {
104
+ if (profileFace) kernel.dispose(profileFace);
105
+ }
91
106
  const shape = require_shapeTypes.castResultShape(resultOc);
92
107
  if (!require_shapeTypes.isShape3D(shape)) {
93
108
  require_shapeTypes.disposeResultShape(shape);
@@ -1,4 +1,4 @@
1
- import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-Db3yAgTO.js";
1
+ import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-PNVEv6ga.js";
2
2
  import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode } from "./errors-BTccWbtE.js";
3
3
  import { r as toVec3 } from "./types-CKXsIm9-.js";
4
4
  import { c as vecLength, t as vecAdd } from "./vecOps-S-m9H_fe.js";
@@ -40,6 +40,14 @@ function makeSpineWire(start, end) {
40
40
  kernel.dispose(edge);
41
41
  return castResultShape(wire);
42
42
  }
43
+ /** A planar face bounded by `wire`, or `null` when the wire does not span one. */
44
+ function planarFaceOf(wire) {
45
+ try {
46
+ return getKernel().makeFace(wire.wrapped, true);
47
+ } catch {
48
+ return null;
49
+ }
50
+ }
43
51
  /** Build a helix wire for twist extrusion. */
44
52
  function makeHelixWire(pitch, height, radius, center, dir, leftHanded = false) {
45
53
  const kernel = getKernel();
@@ -87,7 +95,14 @@ function castSweepShellTuple(result) {
87
95
  */
88
96
  function sweep(wire, spine, config = {}, shellMode = false) {
89
97
  if (config.mode === "simple" && !shellMode) {
90
- const resultOc = getKernel().simplePipe(wire.wrapped, spine.wrapped);
98
+ const kernel = getKernel();
99
+ const profileFace = planarFaceOf(wire);
100
+ let resultOc;
101
+ try {
102
+ resultOc = kernel.simplePipe(profileFace ?? wire.wrapped, spine.wrapped);
103
+ } finally {
104
+ if (profileFace) kernel.dispose(profileFace);
105
+ }
91
106
  const shape = castResultShape(resultOc);
92
107
  if (!isShape3D(shape)) {
93
108
  disposeResultShape(shape);
@@ -1,7 +1,7 @@
1
- import { q as getKernel } from "./shapeTypes-Db3yAgTO.js";
1
+ import { q as getKernel } from "./shapeTypes-PNVEv6ga.js";
2
2
  import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
3
- import { E as kernelCallRaw } from "./topologyQueryFns-DKNVBMuN.js";
4
- import { m as uvBounds } from "./faceFns-DEDlLMcn.js";
3
+ import { E as kernelCallRaw } from "./topologyQueryFns-BZUY10TD.js";
4
+ import { m as uvBounds } from "./faceFns-lE2OvBfq.js";
5
5
  // src/measurement/measureCache.ts
6
6
  var cache = /* @__PURE__ */ new WeakMap();
7
7
  function getCachedMeasurement(shape, key) {
@@ -27,6 +27,66 @@ function nullShapeErr(fn) {
27
27
  return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `${fn}: shape is a null shape`));
28
28
  }
29
29
  /**
30
+ * Run `fn` on fresh handles to the distinct sub-shapes of `type`, releasing them
31
+ * afterwards. Unlike getFaces and friends this leaves the shape's topology cache
32
+ * alone, so a measurement allocates nothing that outlives it.
33
+ */
34
+ function withSubShapes(shape, type, fn) {
35
+ const kernel = getKernel();
36
+ const items = kernel.iterShapes(shape.wrapped, type);
37
+ try {
38
+ return fn(items);
39
+ } finally {
40
+ for (const item of items) kernel.dispose(item);
41
+ }
42
+ }
43
+ /** Run `fn` on a throwaway compound of `parts`, releasing the compound afterwards. */
44
+ function withCompoundOf(parts, fn) {
45
+ const kernel = getKernel();
46
+ const c = kernel.makeCompound(parts);
47
+ try {
48
+ return fn(c);
49
+ } finally {
50
+ kernel.dispose(c);
51
+ }
52
+ }
53
+ function volumeOf(target) {
54
+ const kernel = getKernel();
55
+ const m = kernel.volume(target);
56
+ const comResult = kernelCallRaw(() => kernel.centerOfMass(target), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
57
+ if (!comResult.ok) return comResult;
58
+ return ok({
59
+ mass: m,
60
+ volume: m,
61
+ centerOfMass: comResult.value
62
+ });
63
+ }
64
+ /** Area-weighted centroid of `faces`, from each face's own surface center of mass. */
65
+ function surfaceCentroid(faces) {
66
+ const kernel = getKernel();
67
+ let total = 0;
68
+ let x = 0;
69
+ let y = 0;
70
+ let z = 0;
71
+ for (const f of faces) {
72
+ const a = kernel.area(f);
73
+ const [cx, cy, cz] = kernel.surfaceCenterOfMass(f);
74
+ total += a;
75
+ x += a * cx;
76
+ y += a * cy;
77
+ z += a * cz;
78
+ }
79
+ return total > 0 ? [
80
+ x / total,
81
+ y / total,
82
+ z / total
83
+ ] : [
84
+ 0,
85
+ 0,
86
+ 0
87
+ ];
88
+ }
89
+ /**
30
90
  * Measure volume properties of a 3D shape.
31
91
  *
32
92
  * @param shape - A solid or compound shape.
@@ -37,31 +97,23 @@ function measureVolumeProps(shape) {
37
97
  const cached = getCachedMeasurement(shape.wrapped, "volume");
38
98
  if (cached) return ok(cached);
39
99
  if (shapeIsNull(shape)) return nullShapeErr("measureVolumeProps");
40
- const kernel = getKernel();
41
- const type = kernel.shapeType(shape.wrapped);
42
- if (type !== "solid" && type !== "compsolid" && type !== "compound") {
43
- const zero = {
44
- mass: 0,
45
- volume: 0,
46
- centerOfMass: [
47
- 0,
48
- 0,
49
- 0
50
- ]
51
- };
52
- setCachedMeasurement(shape.wrapped, "volume", zero);
53
- return ok(zero);
54
- }
55
- const m = kernel.volume(shape.wrapped);
56
- const comResult = kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
57
- if (!comResult.ok) return comResult;
58
- const result = {
59
- mass: m,
60
- volume: m,
61
- centerOfMass: comResult.value
100
+ const type = getKernel().shapeType(shape.wrapped);
101
+ const zero = {
102
+ mass: 0,
103
+ volume: 0,
104
+ centerOfMass: [
105
+ 0,
106
+ 0,
107
+ 0
108
+ ]
62
109
  };
63
- setCachedMeasurement(shape.wrapped, "volume", result);
64
- return ok(result);
110
+ let result;
111
+ if (type === "solid" || type === "compsolid") result = volumeOf(shape.wrapped);
112
+ else if (type === "compound") result = withSubShapes(shape, "solid", (solids) => solids.length === 0 ? ok(zero) : withCompoundOf(solids, volumeOf));
113
+ else result = ok(zero);
114
+ if (!result.ok) return result;
115
+ setCachedMeasurement(shape.wrapped, "volume", result.value);
116
+ return result;
65
117
  }
66
118
  /**
67
119
  * Measure surface properties of a face or 3D shape.
@@ -76,7 +128,7 @@ function measureSurfaceProps(shape) {
76
128
  if (shapeIsNull(shape)) return nullShapeErr("measureSurfaceProps");
77
129
  const kernel = getKernel();
78
130
  const m = kernel.area(shape.wrapped);
79
- const comResult = kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
131
+ const comResult = kernelCallRaw(() => kernel.shapeType(shape.wrapped) === "face" ? kernel.surfaceCenterOfMass(shape.wrapped) : withSubShapes(shape, "face", surfaceCentroid), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
80
132
  if (!comResult.ok) return comResult;
81
133
  const result = {
82
134
  mass: m,
@@ -89,8 +141,9 @@ function measureSurfaceProps(shape) {
89
141
  /**
90
142
  * Measure linear properties of any shape.
91
143
  *
92
- * For edges this is the arc length; for wires/compounds it is the total
93
- * length of all edges.
144
+ * For edges this is the arc length; for wires and faces it is the total length
145
+ * of their edges; for shells, solids, and compounds it is the total length of
146
+ * their distinct edges, each counted once.
94
147
  *
95
148
  * @param shape - Any shape whose linear extent is to be measured.
96
149
  * @returns `Result` containing length, center of mass, and raw mass property.
@@ -101,12 +154,26 @@ function measureLinearProps(shape) {
101
154
  if (cached) return ok(cached);
102
155
  if (shapeIsNull(shape)) return nullShapeErr("measureLinearProps");
103
156
  const kernel = getKernel();
104
- const m = kernel.length(shape.wrapped);
105
- const result = {
106
- mass: m,
107
- length: m,
108
- centerOfMass: kernel.linearCenterOfMass(shape.wrapped)
157
+ const type = kernel.shapeType(shape.wrapped);
158
+ const linearOf = (target) => {
159
+ const m = kernel.length(target);
160
+ return {
161
+ mass: m,
162
+ length: m,
163
+ centerOfMass: kernel.linearCenterOfMass(target)
164
+ };
109
165
  };
166
+ let result;
167
+ if (type === "vertex" || type === "edge" || type === "wire" || type === "face") result = linearOf(shape.wrapped);
168
+ else result = withSubShapes(shape, "edge", (edges) => edges.length === 0 ? {
169
+ mass: 0,
170
+ length: 0,
171
+ centerOfMass: [
172
+ 0,
173
+ 0,
174
+ 0
175
+ ]
176
+ } : withCompoundOf(edges, linearOf));
110
177
  setCachedMeasurement(shape.wrapped, "linear", result);
111
178
  return ok(result);
112
179
  }
@@ -1,7 +1,7 @@
1
- const require_shapeTypes = require("./shapeTypes-HDVHzNk1.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D938X2mg.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-gyva7bvF.cjs");
4
- const require_faceFns = require("./faceFns-C6fYNgZl.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-4WYqtSFF.cjs");
4
+ const require_faceFns = require("./faceFns-Cx7cwUMx.cjs");
5
5
  // src/measurement/measureCache.ts
6
6
  var cache = /* @__PURE__ */ new WeakMap();
7
7
  function getCachedMeasurement(shape, key) {
@@ -27,6 +27,66 @@ function nullShapeErr(fn) {
27
27
  return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `${fn}: shape is a null shape`));
28
28
  }
29
29
  /**
30
+ * Run `fn` on fresh handles to the distinct sub-shapes of `type`, releasing them
31
+ * afterwards. Unlike getFaces and friends this leaves the shape's topology cache
32
+ * alone, so a measurement allocates nothing that outlives it.
33
+ */
34
+ function withSubShapes(shape, type, fn) {
35
+ const kernel = require_shapeTypes.getKernel();
36
+ const items = kernel.iterShapes(shape.wrapped, type);
37
+ try {
38
+ return fn(items);
39
+ } finally {
40
+ for (const item of items) kernel.dispose(item);
41
+ }
42
+ }
43
+ /** Run `fn` on a throwaway compound of `parts`, releasing the compound afterwards. */
44
+ function withCompoundOf(parts, fn) {
45
+ const kernel = require_shapeTypes.getKernel();
46
+ const c = kernel.makeCompound(parts);
47
+ try {
48
+ return fn(c);
49
+ } finally {
50
+ kernel.dispose(c);
51
+ }
52
+ }
53
+ function volumeOf(target) {
54
+ const kernel = require_shapeTypes.getKernel();
55
+ const m = kernel.volume(target);
56
+ const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.centerOfMass(target), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
57
+ if (!comResult.ok) return comResult;
58
+ return require_errors.ok({
59
+ mass: m,
60
+ volume: m,
61
+ centerOfMass: comResult.value
62
+ });
63
+ }
64
+ /** Area-weighted centroid of `faces`, from each face's own surface center of mass. */
65
+ function surfaceCentroid(faces) {
66
+ const kernel = require_shapeTypes.getKernel();
67
+ let total = 0;
68
+ let x = 0;
69
+ let y = 0;
70
+ let z = 0;
71
+ for (const f of faces) {
72
+ const a = kernel.area(f);
73
+ const [cx, cy, cz] = kernel.surfaceCenterOfMass(f);
74
+ total += a;
75
+ x += a * cx;
76
+ y += a * cy;
77
+ z += a * cz;
78
+ }
79
+ return total > 0 ? [
80
+ x / total,
81
+ y / total,
82
+ z / total
83
+ ] : [
84
+ 0,
85
+ 0,
86
+ 0
87
+ ];
88
+ }
89
+ /**
30
90
  * Measure volume properties of a 3D shape.
31
91
  *
32
92
  * @param shape - A solid or compound shape.
@@ -37,31 +97,23 @@ function measureVolumeProps(shape) {
37
97
  const cached = getCachedMeasurement(shape.wrapped, "volume");
38
98
  if (cached) return require_errors.ok(cached);
39
99
  if (shapeIsNull(shape)) return nullShapeErr("measureVolumeProps");
40
- const kernel = require_shapeTypes.getKernel();
41
- const type = kernel.shapeType(shape.wrapped);
42
- if (type !== "solid" && type !== "compsolid" && type !== "compound") {
43
- const zero = {
44
- mass: 0,
45
- volume: 0,
46
- centerOfMass: [
47
- 0,
48
- 0,
49
- 0
50
- ]
51
- };
52
- setCachedMeasurement(shape.wrapped, "volume", zero);
53
- return require_errors.ok(zero);
54
- }
55
- const m = kernel.volume(shape.wrapped);
56
- const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
57
- if (!comResult.ok) return comResult;
58
- const result = {
59
- mass: m,
60
- volume: m,
61
- centerOfMass: comResult.value
100
+ const type = require_shapeTypes.getKernel().shapeType(shape.wrapped);
101
+ const zero = {
102
+ mass: 0,
103
+ volume: 0,
104
+ centerOfMass: [
105
+ 0,
106
+ 0,
107
+ 0
108
+ ]
62
109
  };
63
- setCachedMeasurement(shape.wrapped, "volume", result);
64
- return require_errors.ok(result);
110
+ let result;
111
+ if (type === "solid" || type === "compsolid") result = volumeOf(shape.wrapped);
112
+ else if (type === "compound") result = withSubShapes(shape, "solid", (solids) => solids.length === 0 ? require_errors.ok(zero) : withCompoundOf(solids, volumeOf));
113
+ else result = require_errors.ok(zero);
114
+ if (!result.ok) return result;
115
+ setCachedMeasurement(shape.wrapped, "volume", result.value);
116
+ return result;
65
117
  }
66
118
  /**
67
119
  * Measure surface properties of a face or 3D shape.
@@ -76,7 +128,7 @@ function measureSurfaceProps(shape) {
76
128
  if (shapeIsNull(shape)) return nullShapeErr("measureSurfaceProps");
77
129
  const kernel = require_shapeTypes.getKernel();
78
130
  const m = kernel.area(shape.wrapped);
79
- const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
131
+ const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.shapeType(shape.wrapped) === "face" ? kernel.surfaceCenterOfMass(shape.wrapped) : withSubShapes(shape, "face", surfaceCentroid), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
80
132
  if (!comResult.ok) return comResult;
81
133
  const result = {
82
134
  mass: m,
@@ -89,8 +141,9 @@ function measureSurfaceProps(shape) {
89
141
  /**
90
142
  * Measure linear properties of any shape.
91
143
  *
92
- * For edges this is the arc length; for wires/compounds it is the total
93
- * length of all edges.
144
+ * For edges this is the arc length; for wires and faces it is the total length
145
+ * of their edges; for shells, solids, and compounds it is the total length of
146
+ * their distinct edges, each counted once.
94
147
  *
95
148
  * @param shape - Any shape whose linear extent is to be measured.
96
149
  * @returns `Result` containing length, center of mass, and raw mass property.
@@ -101,12 +154,26 @@ function measureLinearProps(shape) {
101
154
  if (cached) return require_errors.ok(cached);
102
155
  if (shapeIsNull(shape)) return nullShapeErr("measureLinearProps");
103
156
  const kernel = require_shapeTypes.getKernel();
104
- const m = kernel.length(shape.wrapped);
105
- const result = {
106
- mass: m,
107
- length: m,
108
- centerOfMass: kernel.linearCenterOfMass(shape.wrapped)
157
+ const type = kernel.shapeType(shape.wrapped);
158
+ const linearOf = (target) => {
159
+ const m = kernel.length(target);
160
+ return {
161
+ mass: m,
162
+ length: m,
163
+ centerOfMass: kernel.linearCenterOfMass(target)
164
+ };
109
165
  };
166
+ let result;
167
+ if (type === "vertex" || type === "edge" || type === "wire" || type === "face") result = linearOf(shape.wrapped);
168
+ else result = withSubShapes(shape, "edge", (edges) => edges.length === 0 ? {
169
+ mass: 0,
170
+ length: 0,
171
+ centerOfMass: [
172
+ 0,
173
+ 0,
174
+ 0
175
+ ]
176
+ } : withCompoundOf(edges, linearOf));
110
177
  setCachedMeasurement(shape.wrapped, "linear", result);
111
178
  return require_errors.ok(result);
112
179
  }
@@ -22,8 +22,9 @@ export declare function measureSurfaceProps(shape: Face<Dimension> | Shape3D): R
22
22
  /**
23
23
  * Measure linear properties of any shape.
24
24
  *
25
- * For edges this is the arc length; for wires/compounds it is the total
26
- * length of all edges.
25
+ * For edges this is the arc length; for wires and faces it is the total length
26
+ * of their edges; for shells, solids, and compounds it is the total length of
27
+ * their distinct edges, each counted once.
27
28
  *
28
29
  * @param shape - Any shape whose linear extent is to be measured.
29
30
  * @returns `Result` containing length, center of mass, and raw mass property.