brepjs 20.8.0 → 20.10.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 (106) hide show
  1. package/dist/2d.cjs +7 -7
  2. package/dist/2d.js +7 -7
  3. package/dist/{adjacencyFns-_RTYhwtD.cjs → adjacencyFns-DaKzrm6n.cjs} +3 -3
  4. package/dist/{adjacencyFns-BgJQQjdt.js → adjacencyFns-QlyPpWhd.js} +3 -3
  5. package/dist/{blueprint-wq2TU1XP.cjs → blueprint-BwUhy-0u.cjs} +7 -7
  6. package/dist/{blueprint-Bth4EVaO.js → blueprint-T5IMurrv.js} +7 -7
  7. package/dist/{blueprintFns-DQmNe1p6.js → blueprintFns-CZ_RJTYB.js} +3 -3
  8. package/dist/{blueprintFns-Dd0gm1rX.cjs → blueprintFns-DCWiQOnn.cjs} +3 -3
  9. package/dist/{blueprintSketcher-CSDqr27-.cjs → blueprintSketcher-DDA1AcP5.cjs} +4 -4
  10. package/dist/{blueprintSketcher-DNp87aQZ.js → blueprintSketcher-ZHeS6RGQ.js} +4 -4
  11. package/dist/{boolean2D-BAb4SnIL.js → boolean2D-CCYpepZs.js} +5 -5
  12. package/dist/{boolean2D-BkgOjMRt.cjs → boolean2D-CVkehTYy.cjs} +5 -5
  13. package/dist/brepjs.cjs +59 -93
  14. package/dist/brepjs.js +59 -94
  15. package/dist/{cameraFns-CKUN90f_.cjs → cameraFns-C4vnJuVn.cjs} +4 -4
  16. package/dist/{cameraFns-9AGyuZVp.js → cameraFns-CYdit3jH.js} +4 -4
  17. package/dist/core/errors.d.ts +3 -0
  18. package/dist/core.cjs +4 -4
  19. package/dist/core.js +4 -4
  20. package/dist/{cornerFinder-DJWo6h1Z.cjs → cornerFinder-B6d-A7bA.cjs} +1 -1
  21. package/dist/{cornerFinder-Cr_04etw.js → cornerFinder-pBdrMPZ0.js} +1 -1
  22. package/dist/{curveFns-CkA2WJP2.js → curveFns-BEHgd_lK.js} +2 -2
  23. package/dist/{curveFns-U7srQ3ZA.cjs → curveFns-MO2zNRPy.cjs} +2 -2
  24. package/dist/{drawFns-DlCxozRP.cjs → drawFns-BqQWEJAY.cjs} +14 -14
  25. package/dist/{drawFns-C6bmFijD.js → drawFns-CxsE55au.js} +14 -14
  26. package/dist/{errors-GVyCnpi0.cjs → errors-B9r_Dzs1.cjs} +3 -0
  27. package/dist/{errors-vxP5FT8B.js → errors-CUsZRWJ7.js} +3 -0
  28. package/dist/{faceFns-DSRREV5G.cjs → faceFns-FpT-Ap5E.cjs} +3 -3
  29. package/dist/{faceFns-BBk6XKJO.js → faceFns-pZvWlzpX.js} +3 -3
  30. package/dist/{healingFns-CEr0afli.js → healingFns-DO4iNGRY.js} +134 -13
  31. package/dist/{healingFns-C9G3yjOe.cjs → healingFns-x0-D6Rh1.cjs} +139 -12
  32. package/dist/{helpers-sDialr0f.js → helpers-B4k3UskG.js} +7 -7
  33. package/dist/{helpers-JuPoaP_b.cjs → helpers-Dzq_vAO5.cjs} +7 -7
  34. package/dist/{importFns-ClqPJCFR.cjs → importFns-CeHEdOsm.cjs} +3 -3
  35. package/dist/{importFns-DSUfSQn2.js → importFns-CmZ-MW_q.js} +3 -3
  36. package/dist/index.d.ts +1 -1
  37. package/dist/io.cjs +2 -2
  38. package/dist/io.js +2 -2
  39. package/dist/kernel/faultyEdges.d.ts +11 -0
  40. package/dist/kernel/occtWasm/constructionOps.d.ts +4 -2
  41. package/dist/kernel/occtWasm/helpers.d.ts +5 -0
  42. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  43. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +18 -2
  44. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  45. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +2 -0
  46. package/dist/{loftFns-B8DSoG-F.js → loftFns--HPa9bzA.js} +2 -2
  47. package/dist/{loftFns-mkJeOaII.cjs → loftFns-BAdVToS1.cjs} +2 -2
  48. package/dist/{measureFns-PRM3gOjw.js → measureFns-BFUFjzym.js} +4 -4
  49. package/dist/{measureFns-BvNkzSR6.cjs → measureFns-DugGNpl1.cjs} +4 -4
  50. package/dist/measurement.cjs +2 -2
  51. package/dist/measurement.js +2 -2
  52. package/dist/{meshFns-CgbT3uuO.js → meshFns-U0q7DxYW.js} +4 -4
  53. package/dist/{meshFns-W7ZTKqiJ.cjs → meshFns-p-lwZsSo.cjs} +4 -4
  54. package/dist/ns/modifiers.d.ts +1 -1
  55. package/dist/{occtWasmAdapter-PzZJHUAd.js → occtWasmAdapter-ClvPe3OJ.js} +135 -13
  56. package/dist/{occtWasmAdapter-BSQeA69d.cjs → occtWasmAdapter-CsDULjij.cjs} +140 -12
  57. package/dist/operations.cjs +2 -2
  58. package/dist/operations.js +2 -2
  59. package/dist/{originTrackingFns-DJDTRJh3.cjs → originTrackingFns-BisDJwJu.cjs} +2 -2
  60. package/dist/{originTrackingFns-D8SNCDKj.js → originTrackingFns-CIeKNLsH.js} +2 -2
  61. package/dist/{planeOps-C9d2Y56B.cjs → planeOps-C7sRqzno.cjs} +1 -1
  62. package/dist/{planeOps-Dp0YvuFE.js → planeOps-DgG0vHN7.js} +1 -1
  63. package/dist/{primitiveFns-EtHyTqhw.cjs → primitiveFns-Cw9q1eOL.cjs} +5 -5
  64. package/dist/{primitiveFns-W3RYNJcm.js → primitiveFns-DdSWvgfC.js} +5 -5
  65. package/dist/{principalBoxFns-Cbtty-2_.js → principalBoxFns-CjY_nvEs.js} +4 -4
  66. package/dist/{principalBoxFns-CmZa7qHi.cjs → principalBoxFns-TMr0eTjD.cjs} +4 -4
  67. package/dist/projection.cjs +1 -1
  68. package/dist/projection.js +1 -1
  69. package/dist/query.cjs +2 -2
  70. package/dist/query.js +2 -2
  71. package/dist/{refResolveFns-BkciKtNP.js → refResolveFns-0B1rrAx8.js} +6 -6
  72. package/dist/{refResolveFns-D99Vqe7a.cjs → refResolveFns-DAP4mI9C.cjs} +6 -6
  73. package/dist/result.cjs +1 -1
  74. package/dist/result.js +1 -1
  75. package/dist/{shapeFns-B54CsPyk.cjs → shapeFns-Bebgp5OO.cjs} +3 -3
  76. package/dist/{shapeFns-DB3l3ULC.js → shapeFns-ioHfSlPu.js} +3 -3
  77. package/dist/shapeRef.cjs +1 -1
  78. package/dist/shapeRef.js +1 -1
  79. package/dist/{shapeTypes-CgbUTASh.js → shapeTypes-Cj2qNze9.js} +1 -1
  80. package/dist/{shapeTypes-D_anqiRe.cjs → shapeTypes-ExC90tMw.cjs} +1 -1
  81. package/dist/sketching.cjs +3 -3
  82. package/dist/sketching.js +3 -3
  83. package/dist/{solidBuilders-DE_na4G3.js → solidBuilders-Ci8YWRBI.js} +7 -7
  84. package/dist/{solidBuilders-CUd-korS.cjs → solidBuilders-kq8rSMtF.cjs} +7 -7
  85. package/dist/{surfaceBuilders-wdGNiImD.js → surfaceBuilders-ANbHa5lb.js} +4 -4
  86. package/dist/{surfaceBuilders-DOn2jWkh.cjs → surfaceBuilders-BNU35xbA.cjs} +4 -4
  87. package/dist/text.cjs +2 -2
  88. package/dist/text.js +2 -2
  89. package/dist/{textBlueprints-B_jwMuej.js → textBlueprints-8cjvJO_y.js} +9 -9
  90. package/dist/{textBlueprints-BQ60Rc96.cjs → textBlueprints-v-gM2QiP.cjs} +9 -9
  91. package/dist/{textMetrics-Dj3yfZNQ.js → textMetrics-BXB9uWYC.js} +2 -2
  92. package/dist/{textMetrics-Bm0a4kh7.cjs → textMetrics-DwwRGGEU.cjs} +2 -2
  93. package/dist/{threadFns-BuRPVenB.cjs → threadFns-C9MTJubY.cjs} +8 -8
  94. package/dist/{threadFns-DlL5VnMf.js → threadFns-D6rqmZ3W.js} +8 -8
  95. package/dist/topology/api.d.ts +2 -0
  96. package/dist/topology/modifierFns.d.ts +14 -0
  97. package/dist/topology/wrapperFns.d.ts +1 -0
  98. package/dist/topology.cjs +9 -9
  99. package/dist/topology.js +9 -9
  100. package/dist/{topologyQueryFns-6M_dbT1R.js → topologyQueryFns-C552gkmo.js} +2 -2
  101. package/dist/{topologyQueryFns-ENxs8uu2.cjs → topologyQueryFns-DYbxJ2Hy.cjs} +2 -2
  102. package/dist/{validityTypes-BPamqRZ8.cjs → validityTypes-BDbTFKtx.cjs} +2 -2
  103. package/dist/{validityTypes-BTuI0vcR.js → validityTypes-C5Zt145z.js} +2 -2
  104. package/dist/vectors.cjs +1 -1
  105. package/dist/vectors.js +1 -1
  106. package/package.json +2 -2
@@ -1,9 +1,10 @@
1
- import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, x as isShape3D, y as isFace } from "./shapeTypes-CgbUTASh.js";
2
- import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode, x as isOk } from "./errors-vxP5FT8B.js";
3
- import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-6M_dbT1R.js";
1
+ import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType, x as isShape3D, y as isFace } from "./shapeTypes-Cj2qNze9.js";
2
+ import { k as isUnsupportedKernelOperationError, n as faultyEdgeIndexesOf } from "./occtWasmAdapter-ClvPe3OJ.js";
3
+ import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode, u as unsupportedError, x as isOk } from "./errors-CUsZRWJ7.js";
4
+ import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-C552gkmo.js";
4
5
  import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
5
- import { y as downcast } from "./faceFns-BBk6XKJO.js";
6
- import { C as propagateAllMetadata, f as cut, h as fuseAll, m as fuse, p as cutAll, x as collectInputFaceHashes } from "./solidBuilders-DE_na4G3.js";
6
+ import { y as downcast } from "./faceFns-pZvWlzpX.js";
7
+ import { C as propagateAllMetadata, f as cut, h as fuseAll, m as fuse, p as cutAll, w as propagateMetadataByHash, x as collectInputFaceHashes } from "./solidBuilders-Ci8YWRBI.js";
7
8
  import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
8
9
  // src/topology/threeHelpers.ts
9
10
  /**
@@ -365,15 +366,26 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
365
366
  const { shape: resultShape, evolution } = getKernel().filletWithHistory(shape.wrapped, edgeShapes, kernelRadius, inputFaceHashes, HASH_CODE_MAX);
366
367
  return finalizeShape3D(evolution, resultShape, [shape], BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
367
368
  } catch (e) {
368
- const raw = e instanceof Error ? e.message : String(e);
369
- return err(kernelError("FILLET_FAILED", `Fillet operation failed: ${raw}`, e, {
370
- operation: "fillet",
369
+ return err(edgeTreatmentError("fillet", e, filteredEdges, {
371
370
  edgeCount: selectedCount,
372
371
  radius
373
372
  }));
374
373
  }
375
374
  }
376
375
  /**
376
+ * `FILLET_FAILED` / `CHAMFER_FAILED`, with `metadata.failedEdges` set to the
377
+ * edges the kernel named when it could not build them (occt-wasm 5.8+).
378
+ */
379
+ function edgeTreatmentError(operation, e, edges, metadata) {
380
+ const raw = e instanceof Error ? e.message : String(e);
381
+ const failedEdges = faultyEdgeIndexesOf(e)?.flatMap((i) => edges[i] ?? []);
382
+ return kernelError(operation === "fillet" ? "FILLET_FAILED" : "CHAMFER_FAILED", `${operation === "fillet" ? "Fillet" : "Chamfer"} operation failed: ${raw}`, e, {
383
+ operation,
384
+ ...metadata,
385
+ ...failedEdges ? { failedEdges } : {}
386
+ }, failedEdges && failedEdges.length > 0 ? `The ${operation} could not be built on metadata.failedEdges: use a smaller size there, or leave those edges out` : void 0);
387
+ }
388
+ /**
377
389
  * Apply a chamfer (beveled edge) to selected edges of a 3D shape.
378
390
  *
379
391
  * @param shape - The shape to modify.
@@ -393,8 +405,8 @@ function chamfer(shape, edges, distance) {
393
405
  if (paramErr) return paramErr;
394
406
  const selectedEdges = edges ?? getEdges(shape);
395
407
  if (selectedEdges.length === 0) return err(validationError(BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
408
+ let filteredEdges = [];
396
409
  try {
397
- let filteredEdges;
398
410
  let kernelDistance;
399
411
  if (typeof distance === "function") {
400
412
  const resolved = resolveEdgeCallback$1(selectedEdges, distance);
@@ -409,9 +421,7 @@ function chamfer(shape, edges, distance) {
409
421
  const { shape: resultShape, evolution } = getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, HASH_CODE_MAX);
410
422
  return finalizeShape3D(evolution, resultShape, [shape], BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape");
411
423
  } catch (e) {
412
- const raw = e instanceof Error ? e.message : String(e);
413
- return err(kernelError("CHAMFER_FAILED", `Chamfer operation failed: ${raw}`, e, {
414
- operation: "chamfer",
424
+ return err(edgeTreatmentError("chamfer", e, filteredEdges, {
415
425
  edgeCount: selectedEdges.length,
416
426
  distance
417
427
  }));
@@ -586,6 +596,117 @@ function variableFillet(shape, edge, radii) {
586
596
  return err(kernelError(BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet failed", e));
587
597
  }
588
598
  }
599
+ function faceSignature(face) {
600
+ const kernel = getKernel();
601
+ const { min, max } = kernel.boundingBox(face);
602
+ return {
603
+ hash: kernel.hashCode(face, HASH_CODE_MAX),
604
+ type: kernel.surfaceType(face),
605
+ area: kernel.area(face),
606
+ center: kernel.surfaceCenterOfMass(face),
607
+ box: [...min, ...max]
608
+ };
609
+ }
610
+ var near = (a, b, tol) => a.every((v, i) => Math.abs(v - (b[i] ?? NaN)) <= tol);
611
+ function sameFace(a, b) {
612
+ if (a.hash === b.hash) return true;
613
+ if (a.type !== b.type || Math.abs(a.area - b.area) > 1e-6 * Math.max(1, a.area)) return false;
614
+ const tol = 1e-6 * Math.max(1, Math.sqrt(a.area));
615
+ return near(a.center, b.center, tol) && near(a.box, b.box, tol);
616
+ }
617
+ /**
618
+ * Indexes of the picked faces still in `result`, as themselves or rebuilt in
619
+ * place: where the faces around a pick cannot close its gap, defeaturing
620
+ * hands that face back instead of failing.
621
+ */
622
+ function keptFaceIndexes(picked, result) {
623
+ const remaining = getFaces(result).map((f) => faceSignature(f.wrapped));
624
+ const kept = [];
625
+ picked.forEach((face, i) => {
626
+ const signature = faceSignature(face.wrapped);
627
+ if (remaining.some((other) => sameFace(signature, other))) kept.push(i);
628
+ });
629
+ return kept;
630
+ }
631
+ /**
632
+ * The one solid a result holds, taking ownership of `result`: occt-wasm's
633
+ * defeaturing returns the healed body wrapped in a compound. `undefined` (with
634
+ * everything released) when the result holds no solid or more than one.
635
+ */
636
+ function soleSolid(result) {
637
+ if (isSolid(result)) return result;
638
+ const kernel = getKernel();
639
+ const solids = [...kernel.iterShapes(result.wrapped, "solid")];
640
+ disposeResultShape(result);
641
+ const [only, ...extra] = solids;
642
+ for (const s of extra) kernel.dispose(s);
643
+ if (only === void 0 || extra.length > 0) {
644
+ if (only !== void 0) kernel.dispose(only);
645
+ return;
646
+ }
647
+ return castResultShapeWithKnownType(only, "solid");
648
+ }
649
+ function validateRemoveFacesInputs(shape, faces) {
650
+ const check = validateNotNull$1(shape, "removeFaces: shape");
651
+ if (isErr(check)) return check;
652
+ if (faces.length === 0) return err(validationError(BrepErrorCode.NO_FACES, "removeFaces: at least one face must be specified", void 0, void 0, "Pick the faces of the feature to remove"));
653
+ const own = new Set(subShapeHashes(shape, "face"));
654
+ const foreign = faces.findIndex((f) => !own.has(getKernel().hashCode(f.wrapped, HASH_CODE_MAX)));
655
+ if (foreign === -1) return void 0;
656
+ return err(validationError(BrepErrorCode.FACE_NOT_IN_SHAPE, `removeFaces: face ${foreign} is not a face of the shape`, void 0, { faceIndex: foreign }, "Pick the faces with getFaces() on the same shape passed to removeFaces"));
657
+ }
658
+ function removeFacesKernelError(e, faceCount) {
659
+ if (isUnsupportedKernelOperationError(e)) {
660
+ const kernelId = getKernel().kernelId;
661
+ return err(unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, `removeFaces: the ${kernelId} kernel has no defeaturing`, e, { kernel: kernelId }, "Use the occt-wasm kernel, which provides defeaturing"));
662
+ }
663
+ const raw = e instanceof Error ? e.message : String(e);
664
+ return err(kernelError(BrepErrorCode.REMOVE_FACES_FAILED, `removeFaces failed: ${raw}`, e, {
665
+ operation: "removeFaces",
666
+ faceCount
667
+ }));
668
+ }
669
+ /**
670
+ * Remove faces from a solid and close the gap with the faces around them
671
+ * (OCCT defeaturing): a hole, pocket, boss, or fillet face disappears and its
672
+ * neighbours extend to meet.
673
+ *
674
+ * @param shape - The solid to edit.
675
+ * @param faces - Faces of `shape` to remove.
676
+ * @returns Err `REMOVE_FACES_INCOMPLETE` (with `metadata.keptFaceIndexes`)
677
+ * when a picked face is still in the result because its neighbours could not
678
+ * close the gap, `REMOVE_FACES_FAILED` when the kernel fails or the result is
679
+ * not one valid solid, and `UNSUPPORTED_CAPABILITY` on a kernel without
680
+ * defeaturing.
681
+ */
682
+ function removeFaces(shape, faces) {
683
+ const invalid = validateRemoveFacesInputs(shape, faces);
684
+ if (invalid) return invalid;
685
+ const kernel = getKernel();
686
+ let result;
687
+ try {
688
+ result = soleSolid(castResultShape(kernel.defeature(shape.wrapped, faces.map((f) => f.wrapped))));
689
+ } catch (e) {
690
+ return removeFacesKernelError(e, faces.length);
691
+ }
692
+ if (result === void 0 || !kernel.isValid(result.wrapped)) {
693
+ if (result) disposeResultShape(result);
694
+ return err(kernelError(BrepErrorCode.REMOVE_FACES_FAILED, "removeFaces: the result is not one valid solid", void 0, {
695
+ operation: "removeFaces",
696
+ faceCount: faces.length
697
+ }));
698
+ }
699
+ const kept = keptFaceIndexes(faces, result);
700
+ if (kept.length > 0) {
701
+ disposeResultShape(result);
702
+ return err(kernelError(BrepErrorCode.REMOVE_FACES_INCOMPLETE, `removeFaces: ${kept.length} of ${faces.length} face(s) could not be removed; the faces around them cannot close the gap`, void 0, {
703
+ operation: "removeFaces",
704
+ keptFaceIndexes: kept
705
+ }, "Remove the whole feature, or leave out the faces listed in metadata.keptFaceIndexes"));
706
+ }
707
+ propagateMetadataByHash([shape], result);
708
+ return ok(result);
709
+ }
589
710
  // src/topology/chamferAngleFns.ts
590
711
  /**
591
712
  * Chamfer with distance + angle — functional API.
@@ -1356,4 +1477,4 @@ function fixSelfIntersection(wire) {
1356
1477
  return err(kernelError(BrepErrorCode.FIX_SELF_INTERSECTION_FAILED, "Failed to fix wire self-intersection", e));
1357
1478
  }
1358
1479
  }
1359
- export { toBufferGeometryData as A, chamfer as C, shell as D, offset as E, toLODGeometryData as M, toLODGeometryLevels as N, thicken as O, toLineGeometryData as P, chamferDistAngle as S, fillet as T, checkBoolean as _, healFace as a, getNurbsCurveData as b, isValid as c, chamferWithEvolution as d, cutWithEvolution as f, shellWithEvolution as g, intersectWithEvolution as h, heal as i, toGroupedBufferGeometryData as j, variableFillet as k, solidFromShell as l, fuseWithEvolution as m, fixSelfIntersection as n, healSolid as o, filletWithEvolution as p, fixShape as r, healWire as s, autoHeal as t, positionOnCurve as u, cutAllBisect as v, draft as w, getNurbsSurfaceData as x, fuseAllBisect as y };
1480
+ export { variableFillet as A, chamfer as C, removeFaces as D, offset as E, toLineGeometryData as F, toGroupedBufferGeometryData as M, toLODGeometryData as N, shell as O, toLODGeometryLevels as P, chamferDistAngle as S, fillet as T, checkBoolean as _, healFace as a, getNurbsCurveData as b, isValid as c, chamferWithEvolution as d, cutWithEvolution as f, shellWithEvolution as g, intersectWithEvolution as h, heal as i, toBufferGeometryData as j, thicken as k, solidFromShell as l, fuseWithEvolution as m, fixSelfIntersection as n, healSolid as o, filletWithEvolution as p, fixShape as r, healWire as s, autoHeal as t, positionOnCurve as u, cutAllBisect as v, draft as w, getNurbsSurfaceData as x, fuseAllBisect as y };
@@ -1,9 +1,10 @@
1
- const require_shapeTypes = require("./shapeTypes-D_anqiRe.cjs");
2
- const require_errors = require("./errors-GVyCnpi0.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-ENxs8uu2.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-ExC90tMw.cjs");
2
+ const require_occtWasmAdapter = require("./occtWasmAdapter-CsDULjij.cjs");
3
+ const require_errors = require("./errors-B9r_Dzs1.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-DYbxJ2Hy.cjs");
4
5
  const require_constants = require("./constants-oee0S_x6.cjs");
5
- const require_faceFns = require("./faceFns-DSRREV5G.cjs");
6
- const require_solidBuilders = require("./solidBuilders-CUd-korS.cjs");
6
+ const require_faceFns = require("./faceFns-FpT-Ap5E.cjs");
7
+ const require_solidBuilders = require("./solidBuilders-kq8rSMtF.cjs");
7
8
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
8
9
  // src/topology/threeHelpers.ts
9
10
  /**
@@ -365,15 +366,26 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
365
366
  const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, edgeShapes, kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
366
367
  return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
367
368
  } catch (e) {
368
- const raw = e instanceof Error ? e.message : String(e);
369
- return require_errors.err(require_errors.kernelError("FILLET_FAILED", `Fillet operation failed: ${raw}`, e, {
370
- operation: "fillet",
369
+ return require_errors.err(edgeTreatmentError("fillet", e, filteredEdges, {
371
370
  edgeCount: selectedCount,
372
371
  radius
373
372
  }));
374
373
  }
375
374
  }
376
375
  /**
376
+ * `FILLET_FAILED` / `CHAMFER_FAILED`, with `metadata.failedEdges` set to the
377
+ * edges the kernel named when it could not build them (occt-wasm 5.8+).
378
+ */
379
+ function edgeTreatmentError(operation, e, edges, metadata) {
380
+ const raw = e instanceof Error ? e.message : String(e);
381
+ const failedEdges = require_occtWasmAdapter.faultyEdgeIndexesOf(e)?.flatMap((i) => edges[i] ?? []);
382
+ return require_errors.kernelError(operation === "fillet" ? "FILLET_FAILED" : "CHAMFER_FAILED", `${operation === "fillet" ? "Fillet" : "Chamfer"} operation failed: ${raw}`, e, {
383
+ operation,
384
+ ...metadata,
385
+ ...failedEdges ? { failedEdges } : {}
386
+ }, failedEdges && failedEdges.length > 0 ? `The ${operation} could not be built on metadata.failedEdges: use a smaller size there, or leave those edges out` : void 0);
387
+ }
388
+ /**
377
389
  * Apply a chamfer (beveled edge) to selected edges of a 3D shape.
378
390
  *
379
391
  * @param shape - The shape to modify.
@@ -393,8 +405,8 @@ function chamfer(shape, edges, distance) {
393
405
  if (paramErr) return paramErr;
394
406
  const selectedEdges = edges ?? require_topologyQueryFns.getEdges(shape);
395
407
  if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
408
+ let filteredEdges = [];
396
409
  try {
397
- let filteredEdges;
398
410
  let kernelDistance;
399
411
  if (typeof distance === "function") {
400
412
  const resolved = resolveEdgeCallback$1(selectedEdges, distance);
@@ -409,9 +421,7 @@ function chamfer(shape, edges, distance) {
409
421
  const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_constants.HASH_CODE_MAX);
410
422
  return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape");
411
423
  } catch (e) {
412
- const raw = e instanceof Error ? e.message : String(e);
413
- return require_errors.err(require_errors.kernelError("CHAMFER_FAILED", `Chamfer operation failed: ${raw}`, e, {
414
- operation: "chamfer",
424
+ return require_errors.err(edgeTreatmentError("chamfer", e, filteredEdges, {
415
425
  edgeCount: selectedEdges.length,
416
426
  distance
417
427
  }));
@@ -586,6 +596,117 @@ function variableFillet(shape, edge, radii) {
586
596
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet failed", e));
587
597
  }
588
598
  }
599
+ function faceSignature(face) {
600
+ const kernel = require_shapeTypes.getKernel();
601
+ const { min, max } = kernel.boundingBox(face);
602
+ return {
603
+ hash: kernel.hashCode(face, require_constants.HASH_CODE_MAX),
604
+ type: kernel.surfaceType(face),
605
+ area: kernel.area(face),
606
+ center: kernel.surfaceCenterOfMass(face),
607
+ box: [...min, ...max]
608
+ };
609
+ }
610
+ var near = (a, b, tol) => a.every((v, i) => Math.abs(v - (b[i] ?? NaN)) <= tol);
611
+ function sameFace(a, b) {
612
+ if (a.hash === b.hash) return true;
613
+ if (a.type !== b.type || Math.abs(a.area - b.area) > 1e-6 * Math.max(1, a.area)) return false;
614
+ const tol = 1e-6 * Math.max(1, Math.sqrt(a.area));
615
+ return near(a.center, b.center, tol) && near(a.box, b.box, tol);
616
+ }
617
+ /**
618
+ * Indexes of the picked faces still in `result`, as themselves or rebuilt in
619
+ * place: where the faces around a pick cannot close its gap, defeaturing
620
+ * hands that face back instead of failing.
621
+ */
622
+ function keptFaceIndexes(picked, result) {
623
+ const remaining = require_topologyQueryFns.getFaces(result).map((f) => faceSignature(f.wrapped));
624
+ const kept = [];
625
+ picked.forEach((face, i) => {
626
+ const signature = faceSignature(face.wrapped);
627
+ if (remaining.some((other) => sameFace(signature, other))) kept.push(i);
628
+ });
629
+ return kept;
630
+ }
631
+ /**
632
+ * The one solid a result holds, taking ownership of `result`: occt-wasm's
633
+ * defeaturing returns the healed body wrapped in a compound. `undefined` (with
634
+ * everything released) when the result holds no solid or more than one.
635
+ */
636
+ function soleSolid(result) {
637
+ if (require_shapeTypes.isSolid(result)) return result;
638
+ const kernel = require_shapeTypes.getKernel();
639
+ const solids = [...kernel.iterShapes(result.wrapped, "solid")];
640
+ require_shapeTypes.disposeResultShape(result);
641
+ const [only, ...extra] = solids;
642
+ for (const s of extra) kernel.dispose(s);
643
+ if (only === void 0 || extra.length > 0) {
644
+ if (only !== void 0) kernel.dispose(only);
645
+ return;
646
+ }
647
+ return require_shapeTypes.castResultShapeWithKnownType(only, "solid");
648
+ }
649
+ function validateRemoveFacesInputs(shape, faces) {
650
+ const check = validateNotNull$1(shape, "removeFaces: shape");
651
+ if (require_errors.isErr(check)) return check;
652
+ if (faces.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NO_FACES, "removeFaces: at least one face must be specified", void 0, void 0, "Pick the faces of the feature to remove"));
653
+ const own = new Set(require_topologyQueryFns.subShapeHashes(shape, "face"));
654
+ const foreign = faces.findIndex((f) => !own.has(require_shapeTypes.getKernel().hashCode(f.wrapped, require_constants.HASH_CODE_MAX)));
655
+ if (foreign === -1) return void 0;
656
+ return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FACE_NOT_IN_SHAPE, `removeFaces: face ${foreign} is not a face of the shape`, void 0, { faceIndex: foreign }, "Pick the faces with getFaces() on the same shape passed to removeFaces"));
657
+ }
658
+ function removeFacesKernelError(e, faceCount) {
659
+ if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) {
660
+ const kernelId = require_shapeTypes.getKernel().kernelId;
661
+ return require_errors.err(require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `removeFaces: the ${kernelId} kernel has no defeaturing`, e, { kernel: kernelId }, "Use the occt-wasm kernel, which provides defeaturing"));
662
+ }
663
+ const raw = e instanceof Error ? e.message : String(e);
664
+ return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.REMOVE_FACES_FAILED, `removeFaces failed: ${raw}`, e, {
665
+ operation: "removeFaces",
666
+ faceCount
667
+ }));
668
+ }
669
+ /**
670
+ * Remove faces from a solid and close the gap with the faces around them
671
+ * (OCCT defeaturing): a hole, pocket, boss, or fillet face disappears and its
672
+ * neighbours extend to meet.
673
+ *
674
+ * @param shape - The solid to edit.
675
+ * @param faces - Faces of `shape` to remove.
676
+ * @returns Err `REMOVE_FACES_INCOMPLETE` (with `metadata.keptFaceIndexes`)
677
+ * when a picked face is still in the result because its neighbours could not
678
+ * close the gap, `REMOVE_FACES_FAILED` when the kernel fails or the result is
679
+ * not one valid solid, and `UNSUPPORTED_CAPABILITY` on a kernel without
680
+ * defeaturing.
681
+ */
682
+ function removeFaces(shape, faces) {
683
+ const invalid = validateRemoveFacesInputs(shape, faces);
684
+ if (invalid) return invalid;
685
+ const kernel = require_shapeTypes.getKernel();
686
+ let result;
687
+ try {
688
+ result = soleSolid(require_shapeTypes.castResultShape(kernel.defeature(shape.wrapped, faces.map((f) => f.wrapped))));
689
+ } catch (e) {
690
+ return removeFacesKernelError(e, faces.length);
691
+ }
692
+ if (result === void 0 || !kernel.isValid(result.wrapped)) {
693
+ if (result) require_shapeTypes.disposeResultShape(result);
694
+ return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.REMOVE_FACES_FAILED, "removeFaces: the result is not one valid solid", void 0, {
695
+ operation: "removeFaces",
696
+ faceCount: faces.length
697
+ }));
698
+ }
699
+ const kept = keptFaceIndexes(faces, result);
700
+ if (kept.length > 0) {
701
+ require_shapeTypes.disposeResultShape(result);
702
+ return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.REMOVE_FACES_INCOMPLETE, `removeFaces: ${kept.length} of ${faces.length} face(s) could not be removed; the faces around them cannot close the gap`, void 0, {
703
+ operation: "removeFaces",
704
+ keptFaceIndexes: kept
705
+ }, "Remove the whole feature, or leave out the faces listed in metadata.keptFaceIndexes"));
706
+ }
707
+ require_solidBuilders.propagateMetadataByHash([shape], result);
708
+ return require_errors.ok(result);
709
+ }
589
710
  // src/topology/chamferAngleFns.ts
590
711
  /**
591
712
  * Chamfer with distance + angle — functional API.
@@ -1500,6 +1621,12 @@ Object.defineProperty(exports, "positionOnCurve", {
1500
1621
  return positionOnCurve;
1501
1622
  }
1502
1623
  });
1624
+ Object.defineProperty(exports, "removeFaces", {
1625
+ enumerable: true,
1626
+ get: function() {
1627
+ return removeFaces;
1628
+ }
1629
+ });
1503
1630
  Object.defineProperty(exports, "shell", {
1504
1631
  enumerable: true,
1505
1632
  get: function() {
@@ -1,12 +1,12 @@
1
- import { q as getKernel, y as isFace } from "./shapeTypes-CgbUTASh.js";
2
- import { E as ok, g as err, o as queryError, x as isOk } from "./errors-vxP5FT8B.js";
3
- import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-6M_dbT1R.js";
1
+ import { q as getKernel, y as isFace } from "./shapeTypes-Cj2qNze9.js";
2
+ import { E as ok, g as err, o as queryError, x as isOk } from "./errors-CUsZRWJ7.js";
3
+ import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-C552gkmo.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-BBk6XKJO.js";
7
- import { a as isSameShape, n as getHashCode } from "./shapeFns-DB3l3ULC.js";
8
- import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-CkA2WJP2.js";
9
- import { n as measureArea } from "./measureFns-PRM3gOjw.js";
6
+ import { l as normalAt, s as getSurfaceType } from "./faceFns-pZvWlzpX.js";
7
+ import { a as isSameShape, n as getHashCode } from "./shapeFns-ioHfSlPu.js";
8
+ import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-BEHgd_lK.js";
9
+ import { n as measureArea } from "./measureFns-BFUFjzym.js";
10
10
  // src/utils/vec2d.ts
11
11
  /** Precision for curve intersection and parameter operations. */
12
12
  var PRECISION_INTERSECTION = 1e-9;
@@ -1,12 +1,12 @@
1
- const require_shapeTypes = require("./shapeTypes-D_anqiRe.cjs");
2
- const require_errors = require("./errors-GVyCnpi0.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-ENxs8uu2.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-ExC90tMw.cjs");
2
+ const require_errors = require("./errors-B9r_Dzs1.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-DYbxJ2Hy.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-DSRREV5G.cjs");
7
- const require_shapeFns = require("./shapeFns-B54CsPyk.cjs");
8
- const require_curveFns = require("./curveFns-U7srQ3ZA.cjs");
9
- const require_measureFns = require("./measureFns-BvNkzSR6.cjs");
6
+ const require_faceFns = require("./faceFns-FpT-Ap5E.cjs");
7
+ const require_shapeFns = require("./shapeFns-Bebgp5OO.cjs");
8
+ const require_curveFns = require("./curveFns-MO2zNRPy.cjs");
9
+ const require_measureFns = require("./measureFns-DugGNpl1.cjs");
10
10
  // src/utils/vec2d.ts
11
11
  /** Precision for curve intersection and parameter operations. */
12
12
  var PRECISION_INTERSECTION = 1e-9;
@@ -1,8 +1,8 @@
1
- const require_shapeTypes = require("./shapeTypes-D_anqiRe.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-ExC90tMw.cjs");
2
2
  const require_bug = require("./bug-CBcpIPuf.cjs");
3
- const require_errors = require("./errors-GVyCnpi0.cjs");
3
+ const require_errors = require("./errors-B9r_Dzs1.cjs");
4
4
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
5
- const require_blueprint = require("./blueprint-wq2TU1XP.cjs");
5
+ const require_blueprint = require("./blueprint-BwUhy-0u.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-CgbUTASh.js";
1
+ import { n as castResultShape, q as getKernel } from "./shapeTypes-Cj2qNze9.js";
2
2
  import { i as wasmIndex, r as vec3At$1 } from "./bug-ClMTAJhe.js";
3
- import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-vxP5FT8B.js";
3
+ import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-CUsZRWJ7.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-Bth4EVaO.js";
5
+ import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-T5IMurrv.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
@@ -145,7 +145,7 @@ export type { Shapeable, WrappedMarker, FinderFn, FilletRadius, ChamferDistance,
145
145
  export { resolve, resolve3D } from './topology/apiTypes.js';
146
146
  export { box, cylinder, sphere, cone, torus, ellipsoid, line, circle, ellipse, helix, threePointArc, ellipseArc, bsplineApprox, bezier, tangentArc, wire, wireLoop, face, filledFace, subFace, polygon, vertex, compound, solid, offsetFace, sewShells, addHoles, type BoxOptions, type CylinderOptions, type SphereOptions, type ConeOptions, type TorusOptions, type EllipsoidOptions, type CircleOptions, type EllipseOptions, type HelixOptions, type EllipseArcOptions, } from './topology/primitiveFns.js';
147
147
  export { fill } from './topology/surfaceBuilders.js';
148
- export { translate, rotate, mirror, scale, clone, locate, applyMatrix, composeTransforms, transformCopy, type TransformOp, type ComposedTransform, fuse, cut, fuseAll, cutAll, intersect, section, sectionToFace, split, slice, fillet, chamfer, shell, offset, thicken, draft, heal, simplify, mesh, meshEdges, describe, toBREP, fromBREP, isValid, isEmpty, type RotateOptions, type MirrorOptions, type ScaleOptions, } from './topology/api.js';
148
+ export { translate, rotate, mirror, scale, clone, locate, applyMatrix, composeTransforms, transformCopy, type TransformOp, type ComposedTransform, fuse, cut, fuseAll, cutAll, intersect, section, sectionToFace, split, slice, fillet, chamfer, shell, removeFaces, offset, thicken, draft, heal, simplify, mesh, meshEdges, describe, toBREP, fromBREP, isValid, isEmpty, type RotateOptions, type MirrorOptions, type ScaleOptions, } from './topology/api.js';
149
149
  export { extrude, revolve, loft, type RevolveOptions, type LoftOptions as CleanLoftOptions, type SweepOptions as CleanSweepOptions, } from './operations/api.js';
150
150
  export { loftAll, type LoftAllEntry } from './operations/loftFns.js';
151
151
  export { thread, type ThreadOptions } from './operations/threadFns.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-W7ZTKqiJ.cjs");
3
- const require_importFns = require("./importFns-ClqPJCFR.cjs");
2
+ const require_meshFns = require("./meshFns-p-lwZsSo.cjs");
3
+ const require_importFns = require("./importFns-CeHEdOsm.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-CgbT3uuO.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-DSUfSQn2.js";
1
+ import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-U0q7DxYW.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-CmZ-MW_q.js";
3
3
  export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A fillet or chamfer the kernel could not build, naming the edges it failed
3
+ * on. The indexes point into the edges array passed to the kernel method, so
4
+ * the caller can map them back to its own edge handles without retrying edge
5
+ * by edge.
6
+ */
7
+ export declare class FaultyEdgesError extends Error {
8
+ constructor(message: string, faultyEdgeIndexes: readonly number[], options?: ErrorOptions);
9
+ }
10
+ /** The failing edges' indexes carried by a {@link FaultyEdgesError}, or `undefined`. */
11
+ export declare function faultyEdgeIndexesOf(error: unknown): readonly number[] | undefined;
@@ -9,8 +9,9 @@ export declare function makeLineEdge(k: OcctKernelWasm, p1: [number, number, num
9
9
  export declare function makeCircleEdge(k: OcctKernelWasm, center: [number, number, number], normal: [number, number, number], radius: number): KernelShape;
10
10
  export declare function makeCircleArc(k: OcctKernelWasm, center: [number, number, number], normal: [number, number, number], radius: number, startAngle: number, endAngle: number): KernelShape;
11
11
  export declare function makeArcEdge(k: OcctKernelWasm, p1: [number, number, number], p2: [number, number, number], p3: [number, number, number]): KernelShape;
12
- export declare function makeEllipseEdge(k: OcctKernelWasm, center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number): KernelShape;
13
- export declare function makeEllipseArc(k: OcctKernelWasm, center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, startAngle: number, endAngle: number): KernelShape;
12
+ type Vec3 = [number, number, number];
13
+ export declare function makeEllipseEdge(k: OcctKernelWasm, center: Vec3, normal: Vec3, majorRadius: number, minorRadius: number, xDir?: Vec3): KernelShape;
14
+ export declare function makeEllipseArc(k: OcctKernelWasm, center: Vec3, normal: Vec3, majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, xDir?: Vec3): KernelShape;
14
15
  export declare function makeBezierEdge(k: OcctKernelWasm, Module: OcctWasmModule, points: [number, number, number][]): KernelShape;
15
16
  export declare function makeTangentArc(k: OcctKernelWasm, startPoint: [number, number, number], startTangent: [number, number, number], endPoint: [number, number, number]): KernelShape;
16
17
  export declare function makeHelixWire(k: OcctKernelWasm, pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number]): KernelShape;
@@ -35,3 +36,4 @@ export declare function createVector3d(x: number, y: number, z: number): KernelT
35
36
  export declare function createAxis1(cx: number, cy: number, cz: number, dx: number, dy: number, dz: number): KernelType;
36
37
  export declare function createAxis2(ox: number, oy: number, oz: number, zx: number, zy: number, zz: number, xx?: number, xy?: number, xz?: number): KernelType;
37
38
  export declare function createAxis3(ox: number, oy: number, oz: number, zx: number, zy: number, zz: number, xx?: number, xy?: number, xz?: number): KernelType;
39
+ export {};
@@ -6,6 +6,11 @@ export declare function handle(type: ShapeType, id: number): OcctWasmHandle;
6
6
  export declare function isOcctWasmHandle(shape: unknown): shape is OcctWasmHandle;
7
7
  /** Extract the u32 id from a handle. */
8
8
  export declare function unwrap(shape: KernelShape): number;
9
+ /**
10
+ * Run a raw fillet/chamfer call, turning the facade's ` [faulty edges: 3,7]`
11
+ * message suffix (arena ids, occt-wasm 5.8+) into indexes into `edges`.
12
+ */
13
+ export declare function reportingFaultyEdges<T>(edges: readonly KernelShape[], run: () => T): T;
9
14
  /** Map a WASM shape type string to our ShapeType enum. */
10
15
  export declare function mapShapeType(wasmType: string): ShapeType;
11
16
  /** Wrap a WASM u32 result as a typed handle, querying the kernel for type. */
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_occtWasmAdapter = require("../../occtWasmAdapter-BSQeA69d.cjs");
2
+ const require_occtWasmAdapter = require("../../occtWasmAdapter-CsDULjij.cjs");
3
3
  exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
@@ -40,6 +40,22 @@ export declare class OcctWasmAdapter implements KernelAdapter {
40
40
  static fromKernel(kernel: OcctKernelOwner): OcctWasmAdapter;
41
41
  /** The owner retained to keep the borrowed raw kernel alive, or `undefined` when built from a raw kernel. */
42
42
  get retainedKernelOwner(): OcctKernelOwner | undefined;
43
+ /**
44
+ * Bring a shape built through occt-wasm's own `OcctKernel` (the kernel this
45
+ * adapter wraps) into brepjs without a BREP round trip:
46
+ * `castShape(adapter.adoptShape(id))`.
47
+ *
48
+ * brepjs takes ownership of the arena slot and frees it when the shape is
49
+ * disposed or collected, so do not also `release(id)` it through `OcctKernel`.
50
+ */
51
+ adoptShape(id: number): KernelShape;
52
+ /**
53
+ * The occt-wasm arena id behind a brepjs shape (`adapter.shapeId(solid.wrapped)`),
54
+ * for passing it to `OcctKernel` calls. The id stays owned by brepjs: it is
55
+ * valid until the brepjs shape is disposed, and must not be released through
56
+ * `OcctKernel`.
57
+ */
58
+ shapeId(shape: KernelShape): number;
43
59
  dispose(h: {
44
60
  delete(): void;
45
61
  }): void;
@@ -76,8 +92,8 @@ export declare class OcctWasmAdapter implements KernelAdapter {
76
92
  makeCircleEdge(center: [number, number, number], normal: [number, number, number], radius: number): KernelShape;
77
93
  makeCircleArc(center: [number, number, number], normal: [number, number, number], radius: number, startAngle: number, endAngle: number): KernelShape;
78
94
  makeArcEdge(p1: [number, number, number], p2: [number, number, number], p3: [number, number, number]): KernelShape;
79
- makeEllipseEdge(center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, _xDir?: [number, number, number]): KernelShape;
80
- makeEllipseArc(center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, _xDir?: [number, number, number]): KernelShape;
95
+ makeEllipseEdge(center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, xDir?: [number, number, number]): KernelShape;
96
+ makeEllipseArc(center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, xDir?: [number, number, number]): KernelShape;
81
97
  makeBezierEdge(points: [number, number, number][]): KernelShape;
82
98
  makeTangentArc(startPoint: [number, number, number], startTangent: [number, number, number], endPoint: [number, number, number]): KernelShape;
83
99
  makeHelixWire(pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number], _leftHanded?: boolean): KernelShape;
@@ -1 +1 @@
1
- export { t as OcctWasmAdapter } from "../../occtWasmAdapter-PzZJHUAd.js";
1
+ export { t as OcctWasmAdapter } from "../../occtWasmAdapter-ClvPe3OJ.js";
@@ -167,6 +167,8 @@ export interface OcctKernelWasm {
167
167
  makeArcEdge(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, x3: number, y3: number, z3: number): number;
168
168
  makeEllipseEdge(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, majorRadius: number, minorRadius: number): number;
169
169
  makeEllipseArc(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, majorRadius: number, minorRadius: number, startAngle: number, endAngle: number): number;
170
+ /** occt-wasm 5.8+: like makeEllipseArc with the major axis along (xx, xy, xz). */
171
+ makeEllipseArcOriented?(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, xx: number, xy: number, xz: number, majorRadius: number, minorRadius: number, startAngle: number, endAngle: number): number;
170
172
  makeBezierEdge(flatPoints: EmVectorDouble): number;
171
173
  makeTangentArc(x1: number, y1: number, z1: number, tx: number, ty: number, tz: number, x2: number, y2: number, z2: number): number;
172
174
  makeHelixWire(px: number, py: number, pz: number, dx: number, dy: number, dz: number, pitch: number, height: number, radius: number): number;
@@ -1,5 +1,5 @@
1
- import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-CgbUTASh.js";
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-vxP5FT8B.js";
1
+ import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-Cj2qNze9.js";
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-CUsZRWJ7.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";
5
5
  // src/operations/extrudeUtils.ts
@@ -1,5 +1,5 @@
1
- const require_shapeTypes = require("./shapeTypes-D_anqiRe.cjs");
2
- const require_errors = require("./errors-GVyCnpi0.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-ExC90tMw.cjs");
2
+ const require_errors = require("./errors-B9r_Dzs1.cjs");
3
3
  const require_types = require("./types-CjF9Rofr.cjs");
4
4
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
5
5
  // src/operations/extrudeUtils.ts
@@ -1,7 +1,7 @@
1
- import { q as getKernel } from "./shapeTypes-CgbUTASh.js";
2
- import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-vxP5FT8B.js";
3
- import { E as kernelCallRaw } from "./topologyQueryFns-6M_dbT1R.js";
4
- import { m as uvBounds } from "./faceFns-BBk6XKJO.js";
1
+ import { q as getKernel } from "./shapeTypes-Cj2qNze9.js";
2
+ import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-CUsZRWJ7.js";
3
+ import { E as kernelCallRaw } from "./topologyQueryFns-C552gkmo.js";
4
+ import { m as uvBounds } from "./faceFns-pZvWlzpX.js";
5
5
  // src/measurement/measureCache.ts
6
6
  var cache = /* @__PURE__ */ new WeakMap();
7
7
  function getCachedMeasurement(shape, key) {