brepjs 20.13.0 → 20.13.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.
Files changed (90) hide show
  1. package/dist/2d.cjs +6 -6
  2. package/dist/2d.js +6 -6
  3. package/dist/{adjacencyFns-BXzEHSC5.cjs → adjacencyFns-BA9xrrmS.cjs} +3 -3
  4. package/dist/{adjacencyFns-BYjzMejn.js → adjacencyFns-C4Tui11_.js} +3 -3
  5. package/dist/{blueprint-464KGkzc.cjs → blueprint-D193PMxX.cjs} +5 -5
  6. package/dist/{blueprint-D-4-uTkr.js → blueprint-DH0H9OWv.js} +5 -5
  7. package/dist/{blueprintFns-CE5RdX-E.js → blueprintFns-Bfiqbmtc.js} +2 -2
  8. package/dist/{blueprintFns-BdyFiuiC.cjs → blueprintFns-DYIKTIvJ.cjs} +2 -2
  9. package/dist/{blueprintSketcher-C4XHzqTw.cjs → blueprintSketcher-B1UrnhFt.cjs} +3 -3
  10. package/dist/{blueprintSketcher-CQ9LxcIl.js → blueprintSketcher-RA8ti2Xp.js} +3 -3
  11. package/dist/{boolean2D-DwJvQ4p_.js → boolean2D-CCKUmway.js} +4 -4
  12. package/dist/{boolean2D-CKE32vHV.cjs → boolean2D-XIehGONX.cjs} +4 -4
  13. package/dist/{booleanFns-CsTz48A3.js → booleanFns-CyxmW1pL.js} +5 -5
  14. package/dist/{booleanFns-MkzdfjDv.cjs → booleanFns-zRlNDHQY.cjs} +5 -5
  15. package/dist/brepjs.cjs +30 -30
  16. package/dist/brepjs.js +30 -30
  17. package/dist/{cameraFns-vHpapIZG.cjs → cameraFns-BDjt94fY.cjs} +3 -3
  18. package/dist/{cameraFns-BDl_D28X.js → cameraFns-CtpBKmwD.js} +3 -3
  19. package/dist/core.cjs +2 -2
  20. package/dist/core.js +2 -2
  21. package/dist/{cornerFinder-Dyk5sKEN.js → cornerFinder-CIryesVI.js} +1 -1
  22. package/dist/{cornerFinder-adDN0_C4.cjs → cornerFinder-DWN1Vkea.cjs} +1 -1
  23. package/dist/{curveFns-HtjEh2W-.cjs → curveFns-0vAErrs9.cjs} +1 -1
  24. package/dist/{curveFns-RjNVzxNc.js → curveFns-b_C6tBeU.js} +1 -1
  25. package/dist/{drawFns-stc8-Gma.js → drawFns--_Bd7ONO.js} +12 -12
  26. package/dist/{drawFns-B5gZtD_P.cjs → drawFns-vcRf5KKV.cjs} +12 -12
  27. package/dist/{faceFns-C7wBHMPv.cjs → faceFns-DzNcnzS5.cjs} +2 -2
  28. package/dist/{faceFns-DaPoCzd-.js → faceFns-WtnWpVQl.js} +2 -2
  29. package/dist/{healingFns-C3Wq_hN3.js → healingFns-B82dNj9P.js} +7 -7
  30. package/dist/{healingFns-zYCbT8vR.cjs → healingFns-D26gj7M5.cjs} +7 -7
  31. package/dist/{helpers-BdtYVyP5.cjs → helpers-BO5NktbN.cjs} +6 -6
  32. package/dist/{helpers-CDzSlBi_.js → helpers-C5I0ZqYC.js} +6 -6
  33. package/dist/{importFns-CotbQ9l7.cjs → importFns-Ceb2VgcK.cjs} +34 -20
  34. package/dist/{importFns-DR7Adv-W.js → importFns-sxpO2z86.js} +34 -20
  35. package/dist/io/importFns.d.ts +12 -5
  36. package/dist/io.cjs +2 -2
  37. package/dist/io.js +2 -2
  38. package/dist/kernel/brepkit/igesMerge.d.ts +13 -0
  39. package/dist/kernel/brepkit/stepMerge.d.ts +14 -0
  40. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  41. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  42. package/dist/{loftFns-C9k9UAKh.cjs → loftFns-KXrP3aat.cjs} +1 -1
  43. package/dist/{loftFns-Cbnrz3p8.js → loftFns-Y-aBF_f7.js} +1 -1
  44. package/dist/{measureFns-DivR02Xb.js → measureFns-B0PhQ5dY.js} +3 -3
  45. package/dist/{measureFns-Bi62maOJ.cjs → measureFns-C8UjdHpB.cjs} +3 -3
  46. package/dist/measurement.cjs +2 -2
  47. package/dist/measurement.js +2 -2
  48. package/dist/{meshFns-CcuY52tt.js → meshFns-BazHDlpY.js} +4 -4
  49. package/dist/{meshFns-8MTf0Lo_.cjs → meshFns-BnkXZ0Xm.cjs} +4 -4
  50. package/dist/{occtWasmAdapter-BNOuP9DA.cjs → occtWasmAdapter-4YnvqZOW.cjs} +72 -3
  51. package/dist/{occtWasmAdapter-1k4udeb3.js → occtWasmAdapter-CGsnjMOe.js} +72 -3
  52. package/dist/operations.cjs +2 -2
  53. package/dist/operations.js +2 -2
  54. package/dist/{primitiveFns-BifV4IGL.cjs → primitiveFns-BM709SMs.cjs} +5 -5
  55. package/dist/{primitiveFns-uDvN1FH6.js → primitiveFns-BZALpT35.js} +5 -5
  56. package/dist/{principalBoxFns-DjxE8Rym.cjs → principalBoxFns-C_hSxRc7.cjs} +3 -3
  57. package/dist/{principalBoxFns-ez0xXLyK.js → principalBoxFns-DLOoxmZB.js} +3 -3
  58. package/dist/projection.cjs +1 -1
  59. package/dist/projection.js +1 -1
  60. package/dist/query.cjs +2 -2
  61. package/dist/query.js +2 -2
  62. package/dist/{refResolveFns-CuaYXFya.js → refResolveFns-BA1ES0sL.js} +6 -6
  63. package/dist/{refResolveFns-CTkAPUwM.cjs → refResolveFns-BkSLmvyY.cjs} +6 -6
  64. package/dist/{shapeFns-Rmgd4x9I.cjs → shapeFns-Bgql2_E6.cjs} +2 -2
  65. package/dist/{shapeFns-DgpWLKra.js → shapeFns-CSWOXGx9.js} +2 -2
  66. package/dist/shapeRef.cjs +1 -1
  67. package/dist/shapeRef.js +1 -1
  68. package/dist/{shapeTypes-BjitsJRQ.cjs → shapeTypes-BFfnNmzj.cjs} +214 -23
  69. package/dist/{shapeTypes-DbPghQD3.js → shapeTypes-C7hqbMwl.js} +214 -23
  70. package/dist/sketching.cjs +3 -3
  71. package/dist/sketching.js +3 -3
  72. package/dist/{solidBuilders-BUI_fGzR.js → solidBuilders-B01dFnd7.js} +3 -3
  73. package/dist/{solidBuilders-Bs2NA3xl.cjs → solidBuilders-CWw3yasa.cjs} +3 -3
  74. package/dist/{surfaceBuilders-CO_DKhWA.js → surfaceBuilders-Cn7GIsyR.js} +3 -3
  75. package/dist/{surfaceBuilders-Cn1mkQ3j.cjs → surfaceBuilders-DL7UTpW2.cjs} +3 -3
  76. package/dist/text.cjs +2 -2
  77. package/dist/text.js +2 -2
  78. package/dist/{textBlueprints-CT0Kbw1f.js → textBlueprints-B7gDC-aP.js} +8 -8
  79. package/dist/{textBlueprints-P_D0KUVx.cjs → textBlueprints-dOnCv38X.cjs} +8 -8
  80. package/dist/{textMetrics-CXKdzefS.js → textMetrics-BFzj8Zvn.js} +1 -1
  81. package/dist/{textMetrics-CVyX8GyL.cjs → textMetrics-Cqc0xzHC.cjs} +1 -1
  82. package/dist/{threadFns-BV4HLdPE.cjs → threadFns-DwTPnV_1.cjs} +7 -7
  83. package/dist/{threadFns-COs6jmaf.js → threadFns-M8pqF4TW.js} +7 -7
  84. package/dist/topology.cjs +9 -9
  85. package/dist/topology.js +9 -9
  86. package/dist/{topologyQueryFns-s0LddGkF.cjs → topologyQueryFns-95FptXtu.cjs} +1 -1
  87. package/dist/{topologyQueryFns-J2ae_Gvc.js → topologyQueryFns-C3-_9dFM.js} +1 -1
  88. package/dist/{validityTypes-BVZ0lSNi.cjs → validityTypes--tgDeAF8.cjs} +1 -1
  89. package/dist/{validityTypes-CD_Xz0vZ.js → validityTypes-C6qOP241.js} +1 -1
  90. package/package.json +1 -1
@@ -4850,17 +4850,86 @@ function toBREP(k, shape) {
4850
4850
  function fromBREP(k, data) {
4851
4851
  return wrapResult(k, k.fromBREP(data));
4852
4852
  }
4853
+ /**
4854
+ * A new XCAF document holding each part as a free shape of its own, tagged
4855
+ * with its name and color.
4856
+ *
4857
+ * XCAF stores a shape once. A part identical to an earlier one comes back as
4858
+ * that part's label, and a part sharing another part's geometry (`TShape`) at
4859
+ * another placement becomes a reference to it, which leaves the shared label
4860
+ * no longer free, so it is not written. Either way there are fewer free shapes
4861
+ * than parts; the document is then rebuilt once with those parts copied, and a
4862
+ * copy has a `TShape` of its own. Copying the part whose label became shared,
4863
+ * not the placed parts referencing it, keeps those sharing one geometry.
4864
+ */
4853
4865
  function addXcafParts(k, parts) {
4854
4866
  const docId = k.xcafNewDocument();
4855
- for (const entry of parts) {
4856
- const labelId = k.xcafAddShape(docId, unwrap(entry.shape));
4867
+ let merged;
4868
+ try {
4869
+ merged = mergedParts(addEachPart(k, docId, parts, /* @__PURE__ */ new Set()), freeShapes(k, docId));
4870
+ } catch (e) {
4871
+ k.xcafClose(docId);
4872
+ throw e;
4873
+ }
4874
+ if (merged.size === 0) return docId;
4875
+ k.xcafClose(docId);
4876
+ const rebuilt = k.xcafNewDocument();
4877
+ try {
4878
+ addEachPart(k, rebuilt, parts, merged);
4879
+ return rebuilt;
4880
+ } catch (e) {
4881
+ k.xcafClose(rebuilt);
4882
+ throw e;
4883
+ }
4884
+ }
4885
+ /** Add `parts` in order, copying those in `copy`; the label each part went in as. */
4886
+ function addEachPart(k, docId, parts, copy) {
4887
+ return parts.map((entry, i) => {
4888
+ const labelId = addPartShape(k, docId, unwrap(entry.shape), copy.has(i));
4857
4889
  if (entry.name) k.xcafSetName(docId, labelId, entry.name);
4858
4890
  if (entry.color) {
4859
4891
  const [r, g, b] = entry.color;
4860
4892
  k.xcafSetColor(docId, labelId, r / 255, g / 255, b / 255);
4861
4893
  }
4894
+ return labelId;
4895
+ });
4896
+ }
4897
+ /**
4898
+ * The parts that did not become a free shape of their own: a repeat of an
4899
+ * earlier part's label, or a label no longer free. Each part adds at most one
4900
+ * free shape, so as many free shapes as parts means none merged.
4901
+ */
4902
+ function mergedParts(labels, free) {
4903
+ const merged = /* @__PURE__ */ new Set();
4904
+ if (free.length === labels.length) return merged;
4905
+ const freeLabels = new Set(free);
4906
+ const seen = /* @__PURE__ */ new Set();
4907
+ labels.forEach((label, i) => {
4908
+ if (seen.has(label) || !freeLabels.has(label)) merged.add(i);
4909
+ seen.add(label);
4910
+ });
4911
+ return merged;
4912
+ }
4913
+ /** Add a shape, or a copy of it; the document keeps the copy's geometry once its slot is released. */
4914
+ function addPartShape(k, docId, shapeId, copy) {
4915
+ if (!copy) return k.xcafAddShape(docId, shapeId);
4916
+ const copyId = k.copy(shapeId);
4917
+ try {
4918
+ return k.xcafAddShape(docId, copyId);
4919
+ } finally {
4920
+ k.release(copyId);
4921
+ }
4922
+ }
4923
+ /** The document's free shapes' label ids. */
4924
+ function freeShapes(k, docId) {
4925
+ const roots = k.xcafGetRootLabels(docId);
4926
+ try {
4927
+ const ids = [];
4928
+ for (let i = 0; i < roots.size(); i++) ids.push(roots.get(i));
4929
+ return ids;
4930
+ } finally {
4931
+ roots.delete();
4862
4932
  }
4863
- return docId;
4864
4933
  }
4865
4934
  function writeXcafDoc(k, docId, units) {
4866
4935
  const roots = k.xcafGetRootLabels(docId);
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_threadFns = require("./threadFns-BV4HLdPE.cjs");
3
- const require_loftFns = require("./loftFns-C9k9UAKh.cjs");
2
+ const require_threadFns = require("./threadFns-DwTPnV_1.cjs");
3
+ const require_loftFns = require("./loftFns-KXrP3aat.cjs");
4
4
  exports.addChild = require_threadFns.addChild;
5
5
  exports.addJoint = require_threadFns.addJoint;
6
6
  exports.addStep = require_threadFns.addStep;
@@ -1,3 +1,3 @@
1
- import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, H as circularPattern, I as createAssemblyNode, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, Y as createAssembly, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as updateNode } from "./threadFns-COs6jmaf.js";
2
- import { c as twistExtrude, o as supportExtrude, r as complexExtrude, s as sweep } from "./loftFns-Cbnrz3p8.js";
1
+ import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, H as circularPattern, I as createAssemblyNode, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, Y as createAssembly, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as updateNode } from "./threadFns-M8pqF4TW.js";
2
+ import { c as twistExtrude, o as supportExtrude, r as complexExtrude, s as sweep } from "./loftFns-Y-aBF_f7.js";
3
3
  export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, exportURDF, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, importURDF, inverseKinematics, jointTrajectory, jointTransform, jointsFromDH, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
@@ -1,11 +1,11 @@
1
- const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
- const require_validityTypes = require("./validityTypes-BVZ0lSNi.cjs");
3
+ const require_validityTypes = require("./validityTypes--tgDeAF8.cjs");
4
4
  const require_constants = require("./constants-oee0S_x6.cjs");
5
5
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
6
- const require_solidBuilders = require("./solidBuilders-Bs2NA3xl.cjs");
7
- const require_booleanFns = require("./booleanFns-MkzdfjDv.cjs");
8
- const require_surfaceBuilders = require("./surfaceBuilders-Cn1mkQ3j.cjs");
6
+ const require_solidBuilders = require("./solidBuilders-CWw3yasa.cjs");
7
+ const require_booleanFns = require("./booleanFns-zRlNDHQY.cjs");
8
+ const require_surfaceBuilders = require("./surfaceBuilders-DL7UTpW2.cjs");
9
9
  // src/topology/transformFns.ts
10
10
  /**
11
11
  * Immutable shape transforms — translate, rotate, scale, mirror, applyMatrix.
@@ -1,11 +1,11 @@
1
- import { E as GeometryCleanupError, G as _usingCtx, d as createSolid, n as castResultShape, q as getKernel } from "./shapeTypes-DbPghQD3.js";
1
+ import { E as GeometryCleanupError, G as _usingCtx, d as createSolid, n as castResultShape, q as getKernel } from "./shapeTypes-C7hqbMwl.js";
2
2
  import { E as ok, d as validationError, g as err, m as andThen, t as BrepErrorCode } from "./errors-BTccWbtE.js";
3
- import { n as isClosedWire } from "./validityTypes-CD_Xz0vZ.js";
3
+ import { n as isClosedWire } from "./validityTypes-C6qOP241.js";
4
4
  import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-iraOnb2p.js";
5
5
  import { d as vecNormalize, h as vecScale } from "./vecOps-S-m9H_fe.js";
6
- import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-BUI_fGzR.js";
7
- import { f as collectInputFaceHashes, g as propagateMetadataThroughRelocation, h as propagateMetadataByHash, m as propagateAllMetadata, p as hasAnyMetadata } from "./booleanFns-CsTz48A3.js";
8
- import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-CO_DKhWA.js";
6
+ import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-B01dFnd7.js";
7
+ import { f as collectInputFaceHashes, g as propagateMetadataThroughRelocation, h as propagateMetadataByHash, m as propagateAllMetadata, p as hasAnyMetadata } from "./booleanFns-CyxmW1pL.js";
8
+ import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-Cn7GIsyR.js";
9
9
  // src/topology/transformFns.ts
10
10
  /**
11
11
  * Immutable shape transforms — translate, rotate, scale, mirror, applyMatrix.
@@ -1,9 +1,9 @@
1
- const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
2
2
  const require_bug = require("./bug-CBcpIPuf.cjs");
3
3
  const require_errors = require("./errors-O_blYTWT.cjs");
4
- const require_topologyQueryFns = require("./topologyQueryFns-s0LddGkF.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
5
5
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
6
- const require_measureFns = require("./measureFns-Bi62maOJ.cjs");
6
+ const require_measureFns = require("./measureFns-C8UjdHpB.cjs");
7
7
  // src/measurement/principalBoxFns.ts
8
8
  /**
9
9
  * Principal-axes bounding box: a solid's extent measured in the frame of its
@@ -1,9 +1,9 @@
1
- import { G as _usingCtx, n as castResultShape, q as getKernel } from "./shapeTypes-DbPghQD3.js";
1
+ import { G as _usingCtx, n as castResultShape, q as getKernel } from "./shapeTypes-C7hqbMwl.js";
2
2
  import { i as wasmIndex } from "./bug-ClMTAJhe.js";
3
3
  import { E as ok, d as validationError, g as err, t as BrepErrorCode, u as unsupportedError } from "./errors-BTccWbtE.js";
4
- import { E as kernelCallRaw } from "./topologyQueryFns-J2ae_Gvc.js";
4
+ import { E as kernelCallRaw } from "./topologyQueryFns-C3-_9dFM.js";
5
5
  import { r as vecCross } from "./vecOps-S-m9H_fe.js";
6
- import { f as withCompoundOf, h as setCachedMeasurement, m as getCachedMeasurement, p as withSubShapes } from "./measureFns-DivR02Xb.js";
6
+ import { f as withCompoundOf, h as setCachedMeasurement, m as getCachedMeasurement, p as withSubShapes } from "./measureFns-B0PhQ5dY.js";
7
7
  // src/measurement/principalBoxFns.ts
8
8
  /**
9
9
  * Principal-axes bounding box: a solid's extent measured in the frame of its
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cameraFns = require("./cameraFns-vHpapIZG.cjs");
2
+ const require_cameraFns = require("./cameraFns-BDjt94fY.cjs");
3
3
  exports.PROJECTION_PLANES = require_cameraFns.PROJECTION_PLANES;
4
4
  exports.cameraFromPlane = require_cameraFns.cameraFromPlane;
5
5
  exports.cameraLookAt = require_cameraFns.cameraLookAt;
@@ -1 +1 @@
1
- export { o as PROJECTION_PLANES, t as cameraFromPlane, n as cameraLookAt, r as createCamera, s as isProjectionPlane, a as makeProjectedEdges, i as projectEdges } from "./cameraFns-BDl_D28X.js";
1
+ export { o as PROJECTION_PLANES, t as cameraFromPlane, n as cameraLookAt, r as createCamera, s as isProjectionPlane, a as makeProjectedEdges, i as projectEdges } from "./cameraFns-CtpBKmwD.js";
package/dist/query.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_helpers = require("./helpers-BdtYVyP5.cjs");
3
- const require_cornerFinder = require("./cornerFinder-adDN0_C4.cjs");
2
+ const require_helpers = require("./helpers-BO5NktbN.cjs");
3
+ const require_cornerFinder = require("./cornerFinder-DWN1Vkea.cjs");
4
4
  exports.cornerFinder = require_cornerFinder.cornerFinder;
5
5
  exports.edgeFinder = require_helpers.edgeFinder;
6
6
  exports.faceFinder = require_helpers.faceFinder;
package/dist/query.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-CDzSlBi_.js";
2
- import { t as cornerFinder } from "./cornerFinder-Dyk5sKEN.js";
1
+ import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-C5I0ZqYC.js";
2
+ import { t as cornerFinder } from "./cornerFinder-CIryesVI.js";
3
3
  export { cornerFinder, edgeFinder, faceFinder, getSingleFace };
@@ -1,10 +1,10 @@
1
- import { g as disposeTransientSubShape, o as castShapeWithKnownType, q as getKernel } from "./shapeTypes-DbPghQD3.js";
2
- import { c as getFaces, w as vertexPosition } from "./topologyQueryFns-J2ae_Gvc.js";
3
- import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-DaPoCzd-.js";
1
+ import { g as disposeTransientSubShape, o as castShapeWithKnownType, q as getKernel } from "./shapeTypes-C7hqbMwl.js";
2
+ import { c as getFaces, w as vertexPosition } from "./topologyQueryFns-C3-_9dFM.js";
3
+ import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-WtnWpVQl.js";
4
4
  import { t as getFaceRoles } from "./faceRoleFns-BPxzQF-n.js";
5
- import { n as getHashCode } from "./shapeFns-DgpWLKra.js";
6
- import { n as measureArea, s as measureLength } from "./measureFns-DivR02Xb.js";
7
- import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, o as sharedEdges, s as verticesOfEdge, t as adjacentFaceHashes } from "./adjacencyFns-BYjzMejn.js";
5
+ import { n as getHashCode } from "./shapeFns-CSWOXGx9.js";
6
+ import { n as measureArea, s as measureLength } from "./measureFns-B0PhQ5dY.js";
7
+ import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, o as sharedEdges, s as verticesOfEdge, t as adjacentFaceHashes } from "./adjacencyFns-C4Tui11_.js";
8
8
  // src/topology/shapeRef/scoring.ts
9
9
  /**
10
10
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,10 +1,10 @@
1
- const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
2
- const require_topologyQueryFns = require("./topologyQueryFns-s0LddGkF.cjs");
3
- const require_faceFns = require("./faceFns-C7wBHMPv.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
2
+ const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
3
+ const require_faceFns = require("./faceFns-DzNcnzS5.cjs");
4
4
  const require_faceRoleFns = require("./faceRoleFns-Db5bYj4Q.cjs");
5
- const require_shapeFns = require("./shapeFns-Rmgd4x9I.cjs");
6
- const require_measureFns = require("./measureFns-Bi62maOJ.cjs");
7
- const require_adjacencyFns = require("./adjacencyFns-BXzEHSC5.cjs");
5
+ const require_shapeFns = require("./shapeFns-Bgql2_E6.cjs");
6
+ const require_measureFns = require("./measureFns-C8UjdHpB.cjs");
7
+ const require_adjacencyFns = require("./adjacencyFns-BA9xrrmS.cjs");
8
8
  // src/topology/shapeRef/scoring.ts
9
9
  /**
10
10
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-s0LddGkF.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
4
4
  const require_constants = require("./constants-oee0S_x6.cjs");
5
5
  // src/topology/shapeFns.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { q as getKernel } from "./shapeTypes-DbPghQD3.js";
1
+ import { q as getKernel } from "./shapeTypes-C7hqbMwl.js";
2
2
  import { t as BrepErrorCode } from "./errors-BTccWbtE.js";
3
- import { E as kernelCallRaw, T as kernelCall } from "./topologyQueryFns-J2ae_Gvc.js";
3
+ import { E as kernelCallRaw, T as kernelCall } from "./topologyQueryFns-C3-_9dFM.js";
4
4
  import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
5
5
  // src/topology/shapeFns.ts
6
6
  /**
package/dist/shapeRef.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_refResolveFns = require("./refResolveFns-CTkAPUwM.cjs");
2
+ const require_refResolveFns = require("./refResolveFns-BkSLmvyY.cjs");
3
3
  exports.assignRoles = require_refResolveFns.assignRoles;
4
4
  exports.captureHint = require_refResolveFns.captureHint;
5
5
  exports.createDerivedFaceRef = require_refResolveFns.createDerivedFaceRef;
package/dist/shapeRef.js CHANGED
@@ -1 +1 @@
1
- export { h as assignRoles, g as captureHint, l as createDerivedFaceRef, p as createEdgeRef, _ as createRef, d as createVertexRef, b as defaultScorer, t as isDerivedFaceRef, n as isEdgeRef, r as isFaceRef, i as isLineageRef, a as isVertexRef, u as resolveDerivedFaceRef, m as resolveEdgeRef, o as resolveLineageRef, v as resolveRef, s as resolveRefIn, c as resolveRefParams, f as resolveVertexRef, y as updateRoles } from "./refResolveFns-CuaYXFya.js";
1
+ export { h as assignRoles, g as captureHint, l as createDerivedFaceRef, p as createEdgeRef, _ as createRef, d as createVertexRef, b as defaultScorer, t as isDerivedFaceRef, n as isEdgeRef, r as isFaceRef, i as isLineageRef, a as isVertexRef, u as resolveDerivedFaceRef, m as resolveEdgeRef, o as resolveLineageRef, v as resolveRef, s as resolveRefIn, c as resolveRefParams, f as resolveVertexRef, y as updateRoles } from "./refResolveFns-BA1ES0sL.js";
@@ -1,4 +1,4 @@
1
- const require_occtWasmAdapter = require("./occtWasmAdapter-BNOuP9DA.cjs");
1
+ const require_occtWasmAdapter = require("./occtWasmAdapter-4YnvqZOW.cjs");
2
2
  const require_bug = require("./bug-CBcpIPuf.cjs");
3
3
  // src/kernel/quality.ts
4
4
  /**
@@ -8446,22 +8446,219 @@ function makeMeshOps$1(bk) {
8446
8446
  meshShape: (shape, tolerance, angularTolerance) => {}
8447
8447
  };
8448
8448
  }
8449
+ // src/kernel/brepkit/igesMerge.ts
8450
+ /**
8451
+ * Merge single-solid brepkit IGES documents into one.
8452
+ *
8453
+ * brepkit-wasm's `exportIges` takes one solid, but an IGES file holds one
8454
+ * document. brepkit's writer emits only standalone entities that point at no
8455
+ * other entity, so the merge appends each later document's directory and
8456
+ * parameter entries, renumbering only the fixed-column fields that number or
8457
+ * link them, and keeps the first document's start and global sections.
8458
+ *
8459
+ * @module
8460
+ */
8461
+ /** Plane, line, B-spline curve and B-spline surface: the entities brepkit writes. */
8462
+ var POINTER_FREE = /* @__PURE__ */ new Set([
8463
+ 108,
8464
+ 110,
8465
+ 126,
8466
+ 128
8467
+ ]);
8468
+ var PLANE = 108;
8469
+ /** A plane's sixth parameter points at its bounding curve; brepkit writes none. */
8470
+ var PLANE_BOUND = 5;
8471
+ /** Each line by the section letter in column 73. */
8472
+ function sections(doc) {
8473
+ const bySection = /* @__PURE__ */ new Map();
8474
+ for (const line of doc.split("\n")) {
8475
+ if (line.length < 73) continue;
8476
+ const letter = line.charAt(72);
8477
+ const lines = bySection.get(letter) ?? [];
8478
+ lines.push(line.slice(0, 80));
8479
+ bySection.set(letter, lines);
8480
+ }
8481
+ return {
8482
+ start: bySection.get("S") ?? [],
8483
+ global: bySection.get("G") ?? [],
8484
+ directory: bySection.get("D") ?? [],
8485
+ parameter: bySection.get("P") ?? []
8486
+ };
8487
+ }
8488
+ /** The `index`th 8-column field of a directory line. */
8489
+ function field(line, index) {
8490
+ return Number(line.slice(index * 8, index * 8 + 8).trim() || "0");
8491
+ }
8492
+ function withField(line, index, value) {
8493
+ return line.slice(0, index * 8) + String(value).padStart(8) + line.slice(index * 8 + 8);
8494
+ }
8495
+ /** `line` with its section letter and sequence number in columns 73-80. */
8496
+ function withSequence(line, letter, sequence) {
8497
+ return line.slice(0, 72).padEnd(72) + letter + String(sequence).padStart(7);
8498
+ }
8499
+ /** Throw unless the entity a directory entry describes points at nothing. */
8500
+ function assertPointerFree(line1, line2, parameter) {
8501
+ const type = field(line1, 0);
8502
+ const linked = [
8503
+ 2,
8504
+ 3,
8505
+ 4,
8506
+ 5,
8507
+ 6,
8508
+ 7
8509
+ ].some((i) => field(line1, i) !== 0) || field(line2, 2) !== 0;
8510
+ let bounded = false;
8511
+ if (type === PLANE) {
8512
+ const first = field(line1, 1) - 1;
8513
+ bounded = (parameter.slice(first, first + field(line2, 3)).map((l) => l.slice(0, 64)).join("").split(/[,;]/)[PLANE_BOUND]?.trim() ?? "0") !== "0";
8514
+ }
8515
+ if (!POINTER_FREE.has(type) || linked || bounded) throw new Error(`brepkit: cannot merge IGES documents holding a linked entity (type ${type})`);
8516
+ }
8517
+ /** One IGES document holding the entities of every brepkit IGES document in `docs`. */
8518
+ function mergeIgesDocuments(docs) {
8519
+ const [first, ...rest] = docs;
8520
+ if (first === void 0) return "";
8521
+ if (rest.length === 0) return first;
8522
+ const base = sections(first);
8523
+ const directory = [];
8524
+ const parameter = [];
8525
+ for (const doc of docs) {
8526
+ const { directory: d, parameter: p } = sections(doc);
8527
+ const dOffset = directory.length;
8528
+ const pOffset = parameter.length;
8529
+ for (let i = 0; i + 1 < d.length; i += 2) {
8530
+ const line1 = d[i] ?? "";
8531
+ const line2 = d[i + 1] ?? "";
8532
+ assertPointerFree(line1, line2, p);
8533
+ const renumbered = withField(line1, 1, field(line1, 1) + pOffset);
8534
+ directory.push(withSequence(renumbered, "D", dOffset + i + 1));
8535
+ directory.push(withSequence(line2, "D", dOffset + i + 2));
8536
+ }
8537
+ p.forEach((line, j) => {
8538
+ const owner = Number(line.slice(64, 72).trim()) + dOffset;
8539
+ parameter.push(withSequence(line.slice(0, 64) + String(owner).padStart(8), "P", pOffset + j + 1));
8540
+ });
8541
+ }
8542
+ const count = (letter, n) => letter + String(n).padStart(7);
8543
+ const terminate = count("S", base.start.length) + count("G", base.global.length) + count("D", directory.length) + count("P", parameter.length);
8544
+ return [
8545
+ ...base.start,
8546
+ ...base.global,
8547
+ ...directory,
8548
+ ...parameter,
8549
+ withSequence(terminate, "T", 1),
8550
+ ""
8551
+ ].join("\n");
8552
+ }
8553
+ // src/kernel/brepkit/stepMerge.ts
8554
+ var REPRESENTATION = /^(ADVANCED_BREP_SHAPE_REPRESENTATION\s*\(\s*'(?:[^']|'')*'\s*,\s*\()([^)]*)\)/;
8555
+ /** A string literal, kept as is, or a `#n` entity reference. */
8556
+ var TOKEN = /'(?:[^']|'')*'|#(\d+)/g;
8557
+ /** Rewrite every `#n` reference outside a string literal to `#map(n)`. */
8558
+ function mapRefs(body, map) {
8559
+ return body.replace(TOKEN, (token, id) => id === void 0 ? token : `#${map(Number(id))}`);
8560
+ }
8561
+ function refsOf(body) {
8562
+ const refs = [];
8563
+ mapRefs(body, (id) => {
8564
+ refs.push(id);
8565
+ return id;
8566
+ });
8567
+ return refs;
8568
+ }
8569
+ /** Split the data section into records at semicolons outside string literals. */
8570
+ function parseStep(doc) {
8571
+ const dataStart = doc.indexOf("DATA;");
8572
+ if (dataStart < 0) throw new Error("brepkit: STEP document has no DATA section");
8573
+ const bodyStart = dataStart + 5;
8574
+ const records = [];
8575
+ let inString = false;
8576
+ let start = bodyStart;
8577
+ for (let i = bodyStart; i < doc.length; i++) {
8578
+ const ch = doc.charAt(i);
8579
+ if (ch === "'") inString = !inString;
8580
+ if (inString || ch !== ";") continue;
8581
+ const statement = doc.slice(start, i).trim();
8582
+ if (statement === "ENDSEC") return {
8583
+ head: doc.slice(0, bodyStart),
8584
+ tail: doc.slice(start).trimStart(),
8585
+ records
8586
+ };
8587
+ const match = /^#(\d+)\s*=\s*([\s\S]*)$/.exec(statement);
8588
+ if (!match) throw new Error(`brepkit: unreadable STEP record '${statement.slice(0, 40)}'`);
8589
+ records.push({
8590
+ id: Number(match[1]),
8591
+ body: match[2] ?? ""
8592
+ });
8593
+ start = i + 1;
8594
+ }
8595
+ throw new Error("brepkit: STEP document has an unterminated DATA section");
8596
+ }
8597
+ function representationIndex(records) {
8598
+ const index = records.findIndex((r) => REPRESENTATION.test(r.body));
8599
+ if (index < 0) throw new Error("brepkit: STEP document has no shape representation");
8600
+ return index;
8601
+ }
8602
+ /** The ids of the solids a document's shape representation lists. */
8603
+ function solidIds(records) {
8604
+ const rep = records[representationIndex(records)];
8605
+ return refsOf(REPRESENTATION.exec(rep?.body ?? "")?.[2] ?? "");
8606
+ }
8607
+ /** The records `roots` reach, in file order, renumbered consecutively from `firstId`. */
8608
+ function takeReachable(records, roots, firstId) {
8609
+ const byId = new Map(records.map((r) => [r.id, r.body]));
8610
+ const reached = /* @__PURE__ */ new Set();
8611
+ const pending = [...roots];
8612
+ while (pending.length > 0) {
8613
+ const id = pending.pop() ?? 0;
8614
+ if (reached.has(id)) continue;
8615
+ reached.add(id);
8616
+ for (const ref of refsOf(byId.get(id) ?? "")) pending.push(ref);
8617
+ }
8618
+ const kept = records.filter((r) => reached.has(r.id));
8619
+ const renumber = new Map(kept.map((r, i) => [r.id, firstId + i]));
8620
+ const remap = (id) => renumber.get(id) ?? id;
8621
+ return {
8622
+ lines: kept.map((r) => `#${remap(r.id)} = ${mapRefs(r.body, remap)};`),
8623
+ renumber
8624
+ };
8625
+ }
8626
+ /** One STEP document holding the solids of every brepkit STEP document in `docs`. */
8627
+ function mergeStepDocuments(docs) {
8628
+ const [first, ...rest] = docs;
8629
+ if (first === void 0) return "";
8630
+ if (rest.length === 0) return first;
8631
+ const base = parseStep(first);
8632
+ let nextId = base.records.reduce((max, r) => Math.max(max, r.id), 0) + 1;
8633
+ const added = [];
8634
+ const solids = [];
8635
+ for (const doc of rest) {
8636
+ const { records } = parseStep(doc);
8637
+ const roots = solidIds(records);
8638
+ const { lines, renumber } = takeReachable(records, roots, nextId);
8639
+ for (const line of lines) added.push(line);
8640
+ for (const id of roots) solids.push(renumber.get(id) ?? id);
8641
+ nextId += lines.length;
8642
+ }
8643
+ const repIndex = representationIndex(base.records);
8644
+ const extraItems = solids.map((id) => `, #${id}`).join("");
8645
+ const addItems = (_match, open, items) => `${open}${items}${extraItems})`;
8646
+ const lines = base.records.map(({ id, body }, i) => `#${id} = ${i === repIndex ? body.replace(REPRESENTATION, addItems) : body};`);
8647
+ const merged = [
8648
+ ...lines.slice(0, repIndex),
8649
+ ...added,
8650
+ ...lines.slice(repIndex)
8651
+ ];
8652
+ return `${base.head}\n${merged.join("\n")}\n${base.tail}`;
8653
+ }
8449
8654
  // src/kernel/brepkit/ioOps.ts
8450
8655
  function exportSTEP(bk, shapes) {
8451
8656
  if (shapes.length === 0) return "";
8452
- const parts = [];
8453
- for (const shape of shapes) {
8454
- const solidIds = unwrapSolidsForExport(bk, shape, "exportSTEP");
8455
- for (const sid of solidIds) {
8456
- const bytes = bk.exportStep(sid);
8457
- parts.push(new TextDecoder().decode(bytes));
8458
- }
8459
- }
8460
- return parts.join("\n");
8657
+ return mergeStepDocuments(shapes.flatMap((shape) => unwrapSolidsForExport(bk, shape, "exportSTEP")).map((sid) => new TextDecoder().decode(bk.exportStep(sid))));
8461
8658
  }
8462
8659
  function exportSTL$1(bk, shape, binary, tolerance = require_occtWasmAdapter.DEFAULT_STL_TOLERANCE, angularTolerance = require_occtWasmAdapter.DEFAULT_STL_ANGULAR_TOLERANCE) {
8463
- const solidIds = unwrapSolidsForExport(bk, shape, "exportSTL");
8464
- const { vertices, triangles } = mesh$1(bk, solidHandle(require_bug.wasmIndex(solidIds, 0)), {
8660
+ unwrapSolidsForExport(bk, shape, "exportSTL");
8661
+ const { vertices, triangles } = mesh$1(bk, shape, {
8465
8662
  tolerance,
8466
8663
  angularTolerance,
8467
8664
  skipNormals: true
@@ -8478,15 +8675,7 @@ function importSTL(bk, data) {
8478
8675
  }
8479
8676
  function exportIGES(bk, shapes) {
8480
8677
  if (shapes.length === 0) return "";
8481
- const parts = [];
8482
- for (const shape of shapes) {
8483
- const solidIds = unwrapSolidsForExport(bk, shape, "exportIGES");
8484
- for (const sid of solidIds) {
8485
- const bytes = bk.exportIges(sid);
8486
- parts.push(new TextDecoder().decode(bytes));
8487
- }
8488
- }
8489
- return parts.join("\n");
8678
+ return mergeIgesDocuments(shapes.flatMap((shape) => unwrapSolidsForExport(bk, shape, "exportIGES")).map((sid) => new TextDecoder().decode(bk.exportIges(sid))));
8490
8679
  }
8491
8680
  function importIGES(bk, data) {
8492
8681
  const bytes = typeof data === "string" ? new TextEncoder().encode(data) : new Uint8Array(data);
@@ -8529,9 +8718,11 @@ function toBREP(bk, shape) {
8529
8718
  }
8530
8719
  function fromBREP(bk, data) {
8531
8720
  if (typeof bk.fromBREP === "function" && data.trimStart().startsWith("{")) return solidHandle(bk.fromBREP(data));
8532
- const first = importSTEP(bk, data)[0];
8721
+ const shapes = importSTEP(bk, data);
8722
+ const [first] = shapes;
8533
8723
  if (!first) throw new Error("brepkit: fromBREP produced no shapes");
8534
- return first;
8724
+ if (shapes.length === 1) return first;
8725
+ return compoundHandle(bk.makeCompound(shapes.map((s) => unwrap$1(s, "solid"))));
8535
8726
  }
8536
8727
  function createXCAFDocument(_bk, shapes) {
8537
8728
  return {