brepjs 8.1.1 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/{Blueprint-B5qTpU-Q.js → Blueprint-CdVaHDSx.js} +9 -8
  4. package/dist/{Blueprint-BUGSPYrj.cjs → Blueprint-a3ukJMG4.cjs} +10 -9
  5. package/dist/{boolean2D-KX9ZFvBj.js → boolean2D-DzA0STqC.js} +10 -10
  6. package/dist/{boolean2D-CyX8tCE_.cjs → boolean2D-pvPIs21j.cjs} +10 -10
  7. package/dist/{booleanFns-DGMIgJl_.js → booleanFns-BcQUqjUu.js} +45 -8
  8. package/dist/{booleanFns-ND7sZvhu.cjs → booleanFns-Cd414V3l.cjs} +45 -8
  9. package/dist/brepjs.cjs +201 -107
  10. package/dist/brepjs.js +271 -176
  11. package/dist/{cast-CqDc8oFW.cjs → cast-C107o5ow.cjs} +2 -2
  12. package/dist/{cast-BEg1mN7n.js → cast-D0OhP1nV.js} +2 -2
  13. package/dist/core/types.d.ts +24 -0
  14. package/dist/core/types.d.ts.map +1 -1
  15. package/dist/core.cjs +3 -3
  16. package/dist/core.js +3 -3
  17. package/dist/{cornerFinder-DfcO5DX-.cjs → cornerFinder-BdKtobgb.cjs} +1 -1
  18. package/dist/{cornerFinder-CQCfLU9g.js → cornerFinder-DvPiz-VR.js} +1 -1
  19. package/dist/{curveBuilders-U26XDfxg.js → curveBuilders-CN72XaIQ.js} +2 -2
  20. package/dist/{curveBuilders-BjtdNw1B.cjs → curveBuilders-Du03_Yyf.cjs} +2 -2
  21. package/dist/curveFns-B5EQsSwv.cjs +177 -0
  22. package/dist/curveFns-CyHyk29c.js +178 -0
  23. package/dist/{drawFns-YeIBjuvT.js → drawFns-CAAE4Z88.js} +13 -12
  24. package/dist/{drawFns-BwNihPRU.cjs → drawFns-Mr2pghU8.cjs} +16 -15
  25. package/dist/{faceFns-DcSCjDG0.cjs → faceFns-D1Sqnlu6.cjs} +3 -3
  26. package/dist/{faceFns-CyokaCDr.js → faceFns-ub3CugDN.js} +3 -3
  27. package/dist/{helpers-BaT099OL.cjs → helpers-CP2KrBZl.cjs} +9 -9
  28. package/dist/{helpers-gMcAmk4y.js → helpers-r_e-u1JM.js} +6 -6
  29. package/dist/index.d.ts +3 -3
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/io.cjs +4 -4
  32. package/dist/io.js +4 -4
  33. package/dist/kernel/occtAdapter.d.ts +1 -0
  34. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  35. package/dist/kernel/transformOps.d.ts +8 -0
  36. package/dist/kernel/transformOps.d.ts.map +1 -1
  37. package/dist/kernel/types.d.ts +1 -0
  38. package/dist/kernel/types.d.ts.map +1 -1
  39. package/dist/{loft-jIkZRqHm.js → loft-BHn7GKm8.js} +4 -4
  40. package/dist/{loft-8asn63t4.cjs → loft-PMRx9iMG.cjs} +4 -4
  41. package/dist/{measurement-lRLwaoqD.cjs → measurement-B06hNs89.cjs} +3 -3
  42. package/dist/{measurement-DWv8kK6J.js → measurement-BfhEneUl.js} +3 -3
  43. package/dist/measurement.cjs +1 -1
  44. package/dist/measurement.js +1 -1
  45. package/dist/{meshFns-DgAIL1B-.js → meshFns-BEvGVcym.js} +5 -2
  46. package/dist/{meshFns-DWuLC3fk.cjs → meshFns-CJV_k_EQ.cjs} +5 -2
  47. package/dist/{occtBoundary-DHtzU4tz.cjs → occtBoundary-BFAaUtA7.cjs} +41 -0
  48. package/dist/{occtBoundary-DYsksDtE.js → occtBoundary-CoXB2xvx.js} +41 -0
  49. package/dist/{operations-BtwU1X9p.js → operations-B314mytX.js} +5 -5
  50. package/dist/{operations-CCFPvtd-.cjs → operations-CYGNxn5D.cjs} +5 -5
  51. package/dist/operations.cjs +2 -2
  52. package/dist/operations.js +2 -2
  53. package/dist/query.cjs +5 -5
  54. package/dist/query.js +6 -6
  55. package/dist/{curveFns-BIRQ0DXA.js → shapeFns-CWd_ASDV.js} +198 -195
  56. package/dist/{curveFns-Bjy0UBlz.cjs → shapeFns-Z_ScEjmn.cjs} +179 -176
  57. package/dist/{shapeTypes-i7VwMRwc.js → shapeTypes-BU2LKv2S.js} +1 -1
  58. package/dist/{shapeTypes-b_lhwQB7.cjs → shapeTypes-UqVCIO_T.cjs} +1 -1
  59. package/dist/sketching.cjs +2 -2
  60. package/dist/sketching.js +2 -2
  61. package/dist/topology/api.d.ts +9 -1
  62. package/dist/topology/api.d.ts.map +1 -1
  63. package/dist/topology/booleanFns.d.ts.map +1 -1
  64. package/dist/topology/meshFns.d.ts +1 -0
  65. package/dist/topology/meshFns.d.ts.map +1 -1
  66. package/dist/topology/modifierFns.d.ts.map +1 -1
  67. package/dist/topology/shapeFns.d.ts +39 -1
  68. package/dist/topology/shapeFns.d.ts.map +1 -1
  69. package/dist/topology/wrapperFns.d.ts +2 -1
  70. package/dist/topology/wrapperFns.d.ts.map +1 -1
  71. package/dist/{topology-BpvKYOnc.cjs → topology-A7-jUtHB.cjs} +13 -12
  72. package/dist/{topology-BRq45bhS.js → topology-BupialMm.js} +8 -7
  73. package/dist/topology.cjs +34 -33
  74. package/dist/topology.js +58 -57
  75. package/dist/{vectors-DWLjb9-P.js → vectors-BhfKwL9J.js} +1 -1
  76. package/dist/{vectors-aQBZK0Sb.cjs → vectors-t1XG4LpL.cjs} +1 -1
  77. package/dist/vectors.cjs +2 -2
  78. package/dist/vectors.js +2 -2
  79. package/package.json +1 -1
package/dist/2d.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Blueprint = require("./Blueprint-BUGSPYrj.cjs");
4
- const boolean2D = require("./boolean2D-CyX8tCE_.cjs");
3
+ const Blueprint = require("./Blueprint-a3ukJMG4.cjs");
4
+ const boolean2D = require("./boolean2D-pvPIs21j.cjs");
5
5
  function reverseCurve(curve) {
6
6
  const cloned = curve.clone();
7
7
  cloned.reverse();
package/dist/2d.js CHANGED
@@ -1,6 +1,6 @@
1
- import { B as Blueprint } from "./Blueprint-B5qTpU-Q.js";
2
- import { e, C, f } from "./Blueprint-B5qTpU-Q.js";
3
- import { b, C as C2, c, d, f as f2, e as e2, i, g, o, p, r } from "./boolean2D-KX9ZFvBj.js";
1
+ import { B as Blueprint } from "./Blueprint-CdVaHDSx.js";
2
+ import { e, C, f } from "./Blueprint-CdVaHDSx.js";
3
+ import { b, C as C2, c, d, f as f2, e as e2, i, g, o, p, r } from "./boolean2D-DzA0STqC.js";
4
4
  function reverseCurve(curve) {
5
5
  const cloned = curve.clone();
6
6
  cloned.reverse();
@@ -1,13 +1,14 @@
1
- import { r as resolvePlane } from "./vectors-DWLjb9-P.js";
2
- import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-DYsksDtE.js";
3
- import { t as localGC, u as createFace, e as isFace, y as registerForCleanup, z as unregisterFromCleanup, p as gcWithScope, o as createEdge, n as createWire } from "./shapeTypes-i7VwMRwc.js";
4
- import { u as uvBounds, a as faceGeomType, f as faceCenter, h as uvCoordinates } from "./faceFns-CyokaCDr.js";
5
- import { a as getEdges, C as findCurveType, F as getOrientation } from "./curveFns-BIRQ0DXA.js";
1
+ import { r as resolvePlane } from "./vectors-BhfKwL9J.js";
2
+ import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-CoXB2xvx.js";
3
+ import { t as localGC, u as createFace, e as isFace, y as registerForCleanup, z as unregisterFromCleanup, p as gcWithScope, o as createEdge, n as createWire } from "./shapeTypes-BU2LKv2S.js";
4
+ import { u as uvBounds, a as faceGeomType, f as faceCenter, h as uvCoordinates } from "./faceFns-ub3CugDN.js";
5
+ import { j as findCurveType, m as getOrientation } from "./curveFns-CyHyk29c.js";
6
6
  import { e as err, o as occtError, l as ok, a as andThen, x as validationError, u as unwrap, b as computationError } from "./errors-wGhcJMpB.js";
7
- import { d as distance2d, s as samePoint, k as scalarMultiply2d, i as add2d, n as normalize2d, h as subtract2d, g as getSingleFace } from "./helpers-gMcAmk4y.js";
8
- import { c as cast } from "./cast-BEg1mN7n.js";
7
+ import { d as distance2d, s as samePoint, k as scalarMultiply2d, i as add2d, n as normalize2d, h as subtract2d, g as getSingleFace } from "./helpers-r_e-u1JM.js";
8
+ import { c as cast } from "./cast-D0OhP1nV.js";
9
9
  import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
10
- import { m as makeLine, a as assembleWire$1 } from "./curveBuilders-U26XDfxg.js";
10
+ import { c as getEdges } from "./shapeFns-CWd_ASDV.js";
11
+ import { m as makeLine, a as assembleWire$1 } from "./curveBuilders-CN72XaIQ.js";
11
12
  import { bug } from "./result.js";
12
13
  function makePlane(plane, origin) {
13
14
  if (plane && typeof plane !== "string") {
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-aQBZK0Sb.cjs");
3
- const occtBoundary = require("./occtBoundary-DHtzU4tz.cjs");
4
- const shapeTypes = require("./shapeTypes-b_lhwQB7.cjs");
5
- const faceFns = require("./faceFns-DcSCjDG0.cjs");
6
- const curveFns = require("./curveFns-Bjy0UBlz.cjs");
2
+ const vectors = require("./vectors-t1XG4LpL.cjs");
3
+ const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
4
+ const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
5
+ const faceFns = require("./faceFns-D1Sqnlu6.cjs");
6
+ const curveFns = require("./curveFns-B5EQsSwv.cjs");
7
7
  const errors = require("./errors-DK1VAdP4.cjs");
8
- const helpers = require("./helpers-BaT099OL.cjs");
9
- const cast = require("./cast-CqDc8oFW.cjs");
8
+ const helpers = require("./helpers-CP2KrBZl.cjs");
9
+ const cast = require("./cast-C107o5ow.cjs");
10
10
  const vecOps = require("./vecOps-CjRL1jau.cjs");
11
- const curveBuilders = require("./curveBuilders-BjtdNw1B.cjs");
11
+ const shapeFns = require("./shapeFns-Z_ScEjmn.cjs");
12
+ const curveBuilders = require("./curveBuilders-Du03_Yyf.cjs");
12
13
  const result = require("./result.cjs");
13
14
  function makePlane(plane, origin) {
14
15
  if (plane && typeof plane !== "string") {
@@ -83,7 +84,7 @@ function makeNonPlanarFace(wire) {
83
84
  const faceBuilder = r(
84
85
  new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
85
86
  );
86
- curveFns.getEdges(wire).forEach((edge) => {
87
+ shapeFns.getEdges(wire).forEach((edge) => {
87
88
  faceBuilder.Add_1(
88
89
  edge.wrapped,
89
90
  oc.GeomAbs_Shape.GeomAbs_C0,
@@ -1,16 +1,16 @@
1
- import { a as createPlane } from "./vectors-DWLjb9-P.js";
1
+ import { a as createPlane } from "./vectors-BhfKwL9J.js";
2
2
  import { l as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-wGhcJMpB.js";
3
- import { d as downcast } from "./cast-BEg1mN7n.js";
4
- import { g as getKernel, a as toVec3 } from "./occtBoundary-DYsksDtE.js";
3
+ import { d as downcast } from "./cast-D0OhP1nV.js";
4
+ import { g as getKernel, a as toVec3 } from "./occtBoundary-CoXB2xvx.js";
5
5
  import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
6
- import { r as revolution, k as complexExtrude, t as twistExtrude, i as basicFaceExtrusion, j as genericSweep, l as loft } from "./loft-jIkZRqHm.js";
7
- import { p as gcWithScope, u as createFace, n as createWire, t as localGC, o as createEdge } from "./shapeTypes-i7VwMRwc.js";
8
- import { q as curveStartPoint, n as curveTangentAt, c as curveIsClosed } from "./curveFns-BIRQ0DXA.js";
9
- import { C as Curve2D, i as make2dSegmentCurve, r as approximateAsBSpline, j as make2dArcFromCenter, s as isPoint2D, o as make2dCircle, t as make2dThreePointArc, e as BoundingBox2d, v as viewbox, u as asSVG, B as Blueprint, m as makeFace, d as makeNewFaceWithinFace, w as make2dEllipseArc, x as make2dTangentArc, y as make2dBezierCurve, f as axis2d, z as zip, A as removeDuplicatePoints } from "./Blueprint-B5qTpU-Q.js";
10
- import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-CyokaCDr.js";
6
+ import { r as revolution, k as complexExtrude, t as twistExtrude, i as basicFaceExtrusion, j as genericSweep, l as loft } from "./loft-BHn7GKm8.js";
7
+ import { p as gcWithScope, u as createFace, n as createWire, t as localGC, o as createEdge } from "./shapeTypes-BU2LKv2S.js";
8
+ import { e as curveStartPoint, a as curveTangentAt, c as curveIsClosed } from "./curveFns-CyHyk29c.js";
9
+ import { C as Curve2D, i as make2dSegmentCurve, r as approximateAsBSpline, j as make2dArcFromCenter, s as isPoint2D, o as make2dCircle, t as make2dThreePointArc, e as BoundingBox2d, v as viewbox, u as asSVG, B as Blueprint, m as makeFace, d as makeNewFaceWithinFace, w as make2dEllipseArc, x as make2dTangentArc, y as make2dBezierCurve, f as axis2d, z as zip, A as removeDuplicatePoints } from "./Blueprint-CdVaHDSx.js";
10
+ import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-ub3CugDN.js";
11
11
  import { bug } from "./result.js";
12
- import { s as samePoint$1, n as normalize2d, h as subtract2d, i as add2d, j as crossProduct2d, k as scalarMultiply2d, b as polarToCartesian, r as rotate2d, l as cartesianToPolar, d as distance2d, p as polarAngle2d, m as PRECISION_INTERSECTION } from "./helpers-gMcAmk4y.js";
13
- import { a as assembleWire } from "./curveBuilders-U26XDfxg.js";
12
+ import { s as samePoint$1, n as normalize2d, h as subtract2d, i as add2d, j as crossProduct2d, k as scalarMultiply2d, b as polarToCartesian, r as rotate2d, l as cartesianToPolar, d as distance2d, p as polarAngle2d, m as PRECISION_INTERSECTION } from "./helpers-r_e-u1JM.js";
13
+ import { a as assembleWire } from "./curveBuilders-CN72XaIQ.js";
14
14
  function* pointsIteration(intersector) {
15
15
  const nPoints = intersector.NbPoints();
16
16
  if (!nPoints) return;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-aQBZK0Sb.cjs");
2
+ const vectors = require("./vectors-t1XG4LpL.cjs");
3
3
  const errors = require("./errors-DK1VAdP4.cjs");
4
- const cast = require("./cast-CqDc8oFW.cjs");
5
- const occtBoundary = require("./occtBoundary-DHtzU4tz.cjs");
4
+ const cast = require("./cast-C107o5ow.cjs");
5
+ const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const loft = require("./loft-8asn63t4.cjs");
8
- const shapeTypes = require("./shapeTypes-b_lhwQB7.cjs");
9
- const curveFns = require("./curveFns-Bjy0UBlz.cjs");
10
- const Blueprint = require("./Blueprint-BUGSPYrj.cjs");
11
- const faceFns = require("./faceFns-DcSCjDG0.cjs");
7
+ const loft = require("./loft-PMRx9iMG.cjs");
8
+ const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
9
+ const curveFns = require("./curveFns-B5EQsSwv.cjs");
10
+ const Blueprint = require("./Blueprint-a3ukJMG4.cjs");
11
+ const faceFns = require("./faceFns-D1Sqnlu6.cjs");
12
12
  const result = require("./result.cjs");
13
- const helpers = require("./helpers-BaT099OL.cjs");
14
- const curveBuilders = require("./curveBuilders-BjtdNw1B.cjs");
13
+ const helpers = require("./helpers-CP2KrBZl.cjs");
14
+ const curveBuilders = require("./curveBuilders-Du03_Yyf.cjs");
15
15
  function* pointsIteration(intersector) {
16
16
  const nPoints = intersector.NbPoints();
17
17
  if (!nPoints) return;
@@ -1,8 +1,9 @@
1
- import { g as getKernel } from "./occtBoundary-DYsksDtE.js";
2
- import { p as gcWithScope, c as castShape, h as isShape3D } from "./shapeTypes-i7VwMRwc.js";
1
+ import { g as getKernel } from "./occtBoundary-CoXB2xvx.js";
2
+ import { p as gcWithScope, c as castShape, h as isShape3D } from "./shapeTypes-BU2LKv2S.js";
3
3
  import { l as ok, d as isErr, e as err, x as validationError, B as BrepErrorCode, p as typeCastError, o as occtError } from "./errors-wGhcJMpB.js";
4
- import { r as resolvePlane } from "./vectors-DWLjb9-P.js";
4
+ import { r as resolvePlane } from "./vectors-BhfKwL9J.js";
5
5
  import { n as vecScale, v as vecAdd } from "./vecOps-ZDdZWbwT.js";
6
+ import { p as propagateOrigins, a as propagateOriginsByHash } from "./shapeFns-CWd_ASDV.js";
6
7
  function applyGlue(op, optimisation) {
7
8
  const oc = getKernel().oc;
8
9
  if (optimisation === "commonFace") {
@@ -63,7 +64,15 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
63
64
  applyGlue(fuseOp, optimisation);
64
65
  fuseOp.Build(progress);
65
66
  if (simplify) fuseOp.SimplifyResult(true, true, 1e-3);
66
- return castToShape3D(fuseOp.Shape(), "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
67
+ const fuseResult = castToShape3D(
68
+ fuseOp.Shape(),
69
+ "FUSE_NOT_3D",
70
+ "Fuse did not produce a 3D shape"
71
+ );
72
+ if (fuseResult.ok) {
73
+ propagateOrigins(fuseOp, [a, b], fuseResult.value);
74
+ }
75
+ return fuseResult;
67
76
  }
68
77
  function cut(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
69
78
  if (signal?.aborted) throw signal.reason;
@@ -78,7 +87,11 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
78
87
  applyGlue(cutOp, optimisation);
79
88
  cutOp.Build(progress);
80
89
  if (simplify) cutOp.SimplifyResult(true, true, 1e-3);
81
- return castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
90
+ const cutResult = castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
91
+ if (cutResult.ok) {
92
+ propagateOrigins(cutOp, [base, tool], cutResult.value);
93
+ }
94
+ return cutResult;
82
95
  }
83
96
  function intersect(a, b, { simplify = false, signal } = {}) {
84
97
  if (signal?.aborted) throw signal.reason;
@@ -92,7 +105,15 @@ function intersect(a, b, { simplify = false, signal } = {}) {
92
105
  const intOp = r(new oc.BRepAlgoAPI_Common_3(a.wrapped, b.wrapped, progress));
93
106
  intOp.Build(progress);
94
107
  if (simplify) intOp.SimplifyResult(true, true, 1e-3);
95
- return castToShape3D(intOp.Shape(), "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape");
108
+ const intResult = castToShape3D(
109
+ intOp.Shape(),
110
+ "INTERSECT_NOT_3D",
111
+ "Intersect did not produce a 3D shape"
112
+ );
113
+ if (intResult.ok) {
114
+ propagateOrigins(intOp, [a, b], intResult.value);
115
+ }
116
+ return intResult;
96
117
  }
97
118
  function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel, signal) {
98
119
  if (signal?.aborted) throw signal.reason;
@@ -130,7 +151,15 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
130
151
  shapes.map((s) => s.wrapped),
131
152
  { optimisation, simplify, strategy, ...signal ? { signal } : {} }
132
153
  );
133
- return castToShape3D(result, "FUSE_ALL_NOT_3D", "fuseAll did not produce a 3D shape");
154
+ const fuseAllResult = castToShape3D(
155
+ result,
156
+ "FUSE_ALL_NOT_3D",
157
+ "fuseAll did not produce a 3D shape"
158
+ );
159
+ if (fuseAllResult.ok) {
160
+ propagateOriginsByHash(shapes, fuseAllResult.value);
161
+ }
162
+ return fuseAllResult;
134
163
  }
135
164
  return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal);
136
165
  }
@@ -151,7 +180,15 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal }
151
180
  applyGlue(cutOp, optimisation);
152
181
  cutOp.Build(progress);
153
182
  if (simplify) cutOp.SimplifyResult(true, true, 1e-3);
154
- return castToShape3D(cutOp.Shape(), "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
183
+ const cutAllResult = castToShape3D(
184
+ cutOp.Shape(),
185
+ "CUT_ALL_NOT_3D",
186
+ "cutAll did not produce a 3D shape"
187
+ );
188
+ if (cutAllResult.ok) {
189
+ propagateOrigins(cutOp, [base, ...tools], cutAllResult.value);
190
+ }
191
+ return cutAllResult;
155
192
  }
156
193
  function makeSectionFace(plane, size) {
157
194
  const oc = getKernel().oc;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
- const occtBoundary = require("./occtBoundary-DHtzU4tz.cjs");
3
- const shapeTypes = require("./shapeTypes-b_lhwQB7.cjs");
2
+ const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
3
+ const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
4
4
  const errors = require("./errors-DK1VAdP4.cjs");
5
- const vectors = require("./vectors-aQBZK0Sb.cjs");
5
+ const vectors = require("./vectors-t1XG4LpL.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
+ const shapeFns = require("./shapeFns-Z_ScEjmn.cjs");
7
8
  function applyGlue(op, optimisation) {
8
9
  const oc = occtBoundary.getKernel().oc;
9
10
  if (optimisation === "commonFace") {
@@ -64,7 +65,15 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
64
65
  applyGlue(fuseOp, optimisation);
65
66
  fuseOp.Build(progress);
66
67
  if (simplify) fuseOp.SimplifyResult(true, true, 1e-3);
67
- return castToShape3D(fuseOp.Shape(), "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
68
+ const fuseResult = castToShape3D(
69
+ fuseOp.Shape(),
70
+ "FUSE_NOT_3D",
71
+ "Fuse did not produce a 3D shape"
72
+ );
73
+ if (fuseResult.ok) {
74
+ shapeFns.propagateOrigins(fuseOp, [a, b], fuseResult.value);
75
+ }
76
+ return fuseResult;
68
77
  }
69
78
  function cut(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
70
79
  if (signal?.aborted) throw signal.reason;
@@ -79,7 +88,11 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
79
88
  applyGlue(cutOp, optimisation);
80
89
  cutOp.Build(progress);
81
90
  if (simplify) cutOp.SimplifyResult(true, true, 1e-3);
82
- return castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
91
+ const cutResult = castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
92
+ if (cutResult.ok) {
93
+ shapeFns.propagateOrigins(cutOp, [base, tool], cutResult.value);
94
+ }
95
+ return cutResult;
83
96
  }
84
97
  function intersect(a, b, { simplify = false, signal } = {}) {
85
98
  if (signal?.aborted) throw signal.reason;
@@ -93,7 +106,15 @@ function intersect(a, b, { simplify = false, signal } = {}) {
93
106
  const intOp = r(new oc.BRepAlgoAPI_Common_3(a.wrapped, b.wrapped, progress));
94
107
  intOp.Build(progress);
95
108
  if (simplify) intOp.SimplifyResult(true, true, 1e-3);
96
- return castToShape3D(intOp.Shape(), "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape");
109
+ const intResult = castToShape3D(
110
+ intOp.Shape(),
111
+ "INTERSECT_NOT_3D",
112
+ "Intersect did not produce a 3D shape"
113
+ );
114
+ if (intResult.ok) {
115
+ shapeFns.propagateOrigins(intOp, [a, b], intResult.value);
116
+ }
117
+ return intResult;
97
118
  }
98
119
  function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel, signal) {
99
120
  if (signal?.aborted) throw signal.reason;
@@ -131,7 +152,15 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
131
152
  shapes.map((s) => s.wrapped),
132
153
  { optimisation, simplify, strategy, ...signal ? { signal } : {} }
133
154
  );
134
- return castToShape3D(result, "FUSE_ALL_NOT_3D", "fuseAll did not produce a 3D shape");
155
+ const fuseAllResult = castToShape3D(
156
+ result,
157
+ "FUSE_ALL_NOT_3D",
158
+ "fuseAll did not produce a 3D shape"
159
+ );
160
+ if (fuseAllResult.ok) {
161
+ shapeFns.propagateOriginsByHash(shapes, fuseAllResult.value);
162
+ }
163
+ return fuseAllResult;
135
164
  }
136
165
  return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal);
137
166
  }
@@ -152,7 +181,15 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal }
152
181
  applyGlue(cutOp, optimisation);
153
182
  cutOp.Build(progress);
154
183
  if (simplify) cutOp.SimplifyResult(true, true, 1e-3);
155
- return castToShape3D(cutOp.Shape(), "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
184
+ const cutAllResult = castToShape3D(
185
+ cutOp.Shape(),
186
+ "CUT_ALL_NOT_3D",
187
+ "cutAll did not produce a 3D shape"
188
+ );
189
+ if (cutAllResult.ok) {
190
+ shapeFns.propagateOrigins(cutOp, [base, ...tools], cutAllResult.value);
191
+ }
192
+ return cutAllResult;
156
193
  }
157
194
  function makeSectionFace(plane, size) {
158
195
  const oc = occtBoundary.getKernel().oc;