brepjs 8.8.7 → 8.8.9

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 (43) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/{Blueprint-BWLPU0ZC.js → Blueprint-C7JlgasP.js} +2 -2
  4. package/dist/{Blueprint-CIfiTx-y.cjs → Blueprint-CTrwIDuQ.cjs} +2 -2
  5. package/dist/{boolean2D-BG9wtSKz.js → boolean2D-CypPzZM1.js} +4 -4
  6. package/dist/{boolean2D-Bs_OdV2_.cjs → boolean2D-KvkerCI-.cjs} +4 -4
  7. package/dist/{booleanFns-DHEaBJwW.js → booleanFns-BnLhgDGb.js} +2 -2
  8. package/dist/{booleanFns-CUxOBNlC.cjs → booleanFns-DEY86xmR.cjs} +2 -2
  9. package/dist/brepjs.cjs +33 -38
  10. package/dist/brepjs.js +41 -46
  11. package/dist/{cornerFinder-DfSdXbxK.js → cornerFinder-BurQenn5.js} +1 -1
  12. package/dist/{cornerFinder-BijsFhpz.cjs → cornerFinder-DLHDc022.cjs} +1 -1
  13. package/dist/{drawFns-Df_AbW16.js → drawFns-BY9W9rPP.js} +7 -7
  14. package/dist/{drawFns-BGGYhul8.cjs → drawFns-ibZFQZkt.cjs} +7 -7
  15. package/dist/{helpers-Ces6b2wm.cjs → helpers-DQGErXAX.cjs} +1 -1
  16. package/dist/{helpers-D7hTCTJm.js → helpers-SajoWDKO.js} +1 -1
  17. package/dist/io.cjs +2 -2
  18. package/dist/io.js +2 -2
  19. package/dist/{loft-BpfrTPIR.js → loft-CfKcU3Y1.js} +1 -1
  20. package/dist/{loft-GLxTzuXU.cjs → loft-hhMumRtt.cjs} +1 -1
  21. package/dist/{meshFns-BTb2esZJ.cjs → meshFns-CfjNBqS6.cjs} +1 -1
  22. package/dist/{meshFns-DJx5Yqiy.js → meshFns-Diog9oLS.js} +1 -1
  23. package/dist/operations/loftFns.d.ts +3 -1
  24. package/dist/operations/loftFns.d.ts.map +1 -1
  25. package/dist/{operations-CHIU-aGI.js → operations-BFDNdchq.js} +2 -2
  26. package/dist/{operations-T5f-v2rF.cjs → operations-CZUFSBuY.cjs} +2 -2
  27. package/dist/operations.cjs +2 -2
  28. package/dist/operations.js +2 -2
  29. package/dist/query.cjs +2 -2
  30. package/dist/query.js +3 -3
  31. package/dist/{shapeFns-CbZMmuQA.cjs → shapeFns-D4MYB8um.cjs} +145 -95
  32. package/dist/{shapeFns-5HlS8wvc.js → shapeFns-DNxuGWvV.js} +146 -96
  33. package/dist/sketching.cjs +2 -2
  34. package/dist/sketching.js +2 -2
  35. package/dist/{surfaceBuilders-zlVu1d-b.js → surfaceBuilders-DEd0HUri.js} +1 -1
  36. package/dist/{surfaceBuilders-zWnw2I0j.cjs → surfaceBuilders-DeFCNwZl.cjs} +1 -1
  37. package/dist/topology/shapeFns.d.ts.map +1 -1
  38. package/dist/topology/surfaceFns.d.ts.map +1 -1
  39. package/dist/{topology-ZRFxrEEW.cjs → topology-CRPSzNkp.cjs} +3 -3
  40. package/dist/{topology-CMS8QyJa.js → topology-XD2qFlgc.js} +3 -3
  41. package/dist/topology.cjs +4 -4
  42. package/dist/topology.js +4 -4
  43. package/package.json +2 -3
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const operations = require("./operations-T5f-v2rF.cjs");
4
- const loft = require("./loft-GLxTzuXU.cjs");
3
+ const operations = require("./operations-CZUFSBuY.cjs");
4
+ const loft = require("./loft-hhMumRtt.cjs");
5
5
  exports.addChild = operations.addChild;
6
6
  exports.addStep = operations.addStep;
7
7
  exports.circularPattern = operations.circularPattern;
@@ -1,5 +1,5 @@
1
- import { a, b, c, d, f, g, h, i, j, k, m, n, o, p, l, q, t, u, v, x, y, z, A, B, s, C, D, E, w } from "./operations-CHIU-aGI.js";
2
- import { b as b2, g as g2, l as l2, r } from "./loft-BpfrTPIR.js";
1
+ import { a, b, c, d, f, g, h, i, j, k, m, n, o, p, l, q, t, u, v, x, y, z, A, B, s, C, D, E, w } from "./operations-BFDNdchq.js";
2
+ import { b as b2, g as g2, l as l2, r } from "./loft-CfKcU3Y1.js";
3
3
  export {
4
4
  a as addChild,
5
5
  b as addStep,
package/dist/query.cjs CHANGED
@@ -45,8 +45,8 @@ var __callDispose = (stack, error, hasError) => {
45
45
  return next();
46
46
  };
47
47
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
48
- const helpers = require("./helpers-Ces6b2wm.cjs");
49
- const cornerFinder = require("./cornerFinder-BijsFhpz.cjs");
48
+ const helpers = require("./helpers-DQGErXAX.cjs");
49
+ const cornerFinder = require("./cornerFinder-DLHDc022.cjs");
50
50
  const occtBoundary = require("./occtBoundary-CN_uQJtA.cjs");
51
51
  const shapeTypes = require("./shapeTypes-sXITvFkF.cjs");
52
52
  const vecOps = require("./vecOps-CjRL1jau.cjs");
package/dist/query.js CHANGED
@@ -43,9 +43,9 @@ var __callDispose = (stack, error, hasError) => {
43
43
  };
44
44
  return next();
45
45
  };
46
- import { l as createTypedFinder, o as distanceFromPointFilter, q as resolveDir } from "./helpers-D7hTCTJm.js";
47
- import { m, g } from "./helpers-D7hTCTJm.js";
48
- import { c } from "./cornerFinder-DfSdXbxK.js";
46
+ import { l as createTypedFinder, o as distanceFromPointFilter, q as resolveDir } from "./helpers-SajoWDKO.js";
47
+ import { m, g } from "./helpers-SajoWDKO.js";
48
+ import { c } from "./cornerFinder-BurQenn5.js";
49
49
  import { g as getKernel } from "./occtBoundary-Ct0tN8cs.js";
50
50
  import { D as DisposalScope } from "./shapeTypes-D34s68Xi.js";
51
51
  import { j as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
@@ -85,56 +85,76 @@ function simplify(shape) {
85
85
  }
86
86
  }
87
87
  function translate(shape, v) {
88
- const oc = occtBoundary.getKernel().oc;
89
- const trsf = new oc.gp_Trsf_1();
90
- const vec = occtBoundary.toOcVec(v);
91
- trsf.SetTranslation_1(vec);
92
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
93
- const result = shapeTypes.castShape(transformer.Shape());
94
- propagateOrigins(transformer, [shape], result);
95
- transformer.delete();
96
- trsf.delete();
97
- vec.delete();
98
- return result;
88
+ var _stack = [];
89
+ try {
90
+ const oc = occtBoundary.getKernel().oc;
91
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
92
+ const trsf = scope.register(new oc.gp_Trsf_1());
93
+ const vec = scope.register(occtBoundary.toOcVec(v));
94
+ trsf.SetTranslation_1(vec);
95
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
96
+ const result = shapeTypes.castShape(transformer.Shape());
97
+ propagateOrigins(transformer, [shape], result);
98
+ return result;
99
+ } catch (_) {
100
+ var _error = _, _hasError = true;
101
+ } finally {
102
+ __callDispose(_stack, _error, _hasError);
103
+ }
99
104
  }
100
105
  function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
101
- const oc = occtBoundary.getKernel().oc;
102
- const trsf = new oc.gp_Trsf_1();
103
- const ax1 = occtBoundary.makeOcAx1(position, direction);
104
- trsf.SetRotation_1(ax1, angle * vecOps.DEG2RAD);
105
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
106
- const result = shapeTypes.castShape(transformer.Shape());
107
- propagateOrigins(transformer, [shape], result);
108
- transformer.delete();
109
- trsf.delete();
110
- ax1.delete();
111
- return result;
106
+ var _stack = [];
107
+ try {
108
+ const oc = occtBoundary.getKernel().oc;
109
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
110
+ const trsf = scope.register(new oc.gp_Trsf_1());
111
+ const ax1 = scope.register(occtBoundary.makeOcAx1(position, direction));
112
+ trsf.SetRotation_1(ax1, angle * vecOps.DEG2RAD);
113
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
114
+ const result = shapeTypes.castShape(transformer.Shape());
115
+ propagateOrigins(transformer, [shape], result);
116
+ return result;
117
+ } catch (_) {
118
+ var _error = _, _hasError = true;
119
+ } finally {
120
+ __callDispose(_stack, _error, _hasError);
121
+ }
112
122
  }
113
123
  function mirror(shape, planeNormal = [0, 1, 0], planeOrigin = [0, 0, 0]) {
114
- const oc = occtBoundary.getKernel().oc;
115
- const trsf = new oc.gp_Trsf_1();
116
- const ax2 = occtBoundary.makeOcAx2(planeOrigin, planeNormal);
117
- trsf.SetMirror_3(ax2);
118
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
119
- const result = shapeTypes.castShape(transformer.Shape());
120
- propagateOrigins(transformer, [shape], result);
121
- transformer.delete();
122
- trsf.delete();
123
- ax2.delete();
124
- return result;
124
+ var _stack = [];
125
+ try {
126
+ const oc = occtBoundary.getKernel().oc;
127
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
128
+ const trsf = scope.register(new oc.gp_Trsf_1());
129
+ const ax2 = scope.register(occtBoundary.makeOcAx2(planeOrigin, planeNormal));
130
+ trsf.SetMirror_3(ax2);
131
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
132
+ const result = shapeTypes.castShape(transformer.Shape());
133
+ propagateOrigins(transformer, [shape], result);
134
+ return result;
135
+ } catch (_) {
136
+ var _error = _, _hasError = true;
137
+ } finally {
138
+ __callDispose(_stack, _error, _hasError);
139
+ }
125
140
  }
126
141
  function scale(shape, factor, center = [0, 0, 0]) {
127
- const oc = occtBoundary.getKernel().oc;
128
- const trsf = new oc.gp_Trsf_1();
129
- const pnt = occtBoundary.toOcPnt(center);
130
- trsf.SetScale(pnt, factor);
131
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
132
- const result = shapeTypes.castShape(transformer.Shape());
133
- propagateOrigins(transformer, [shape], result);
134
- transformer.delete();
135
- trsf.delete();
136
- pnt.delete();
137
- return result;
142
+ var _stack = [];
143
+ try {
144
+ const oc = occtBoundary.getKernel().oc;
145
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
146
+ const trsf = scope.register(new oc.gp_Trsf_1());
147
+ const pnt = scope.register(occtBoundary.toOcPnt(center));
148
+ trsf.SetScale(pnt, factor);
149
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
150
+ const result = shapeTypes.castShape(transformer.Shape());
151
+ propagateOrigins(transformer, [shape], result);
152
+ return result;
153
+ } catch (_) {
154
+ var _error = _, _hasError = true;
155
+ } finally {
156
+ __callDispose(_stack, _error, _hasError);
157
+ }
138
158
  }
139
159
  function resize(shape, dimensions, options) {
140
160
  const bbox = occtBoundary.getKernel().boundingBox(shape.wrapped);
@@ -213,27 +233,35 @@ function applyMatrix(shape, matrix) {
213
233
  const oc = occtBoundary.getKernel().oc;
214
234
  const orthogonal = isOrthogonalMatrix(linear);
215
235
  if (orthogonal) {
216
- const trsf = new oc.gp_Trsf_1();
217
- trsf.SetValues(
218
- linear[0],
219
- linear[1],
220
- linear[2],
221
- translation[0],
222
- linear[3],
223
- linear[4],
224
- linear[5],
225
- translation[1],
226
- linear[6],
227
- linear[7],
228
- linear[8],
229
- translation[2]
230
- );
231
- const transformer2 = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
232
- const result2 = shapeTypes.castShape(transformer2.Shape());
233
- propagateOrigins(transformer2, [shape], result2);
234
- transformer2.delete();
235
- trsf.delete();
236
- return result2;
236
+ var _stack = [];
237
+ try {
238
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
239
+ const trsf = scope.register(new oc.gp_Trsf_1());
240
+ trsf.SetValues(
241
+ linear[0],
242
+ linear[1],
243
+ linear[2],
244
+ translation[0],
245
+ linear[3],
246
+ linear[4],
247
+ linear[5],
248
+ translation[1],
249
+ linear[6],
250
+ linear[7],
251
+ linear[8],
252
+ translation[2]
253
+ );
254
+ const transformer2 = scope.register(
255
+ new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true)
256
+ );
257
+ const result2 = shapeTypes.castShape(transformer2.Shape());
258
+ propagateOrigins(transformer2, [shape], result2);
259
+ return result2;
260
+ } catch (_) {
261
+ var _error = _, _hasError = true;
262
+ } finally {
263
+ __callDispose(_stack, _error, _hasError);
264
+ }
237
265
  }
238
266
  const gtrsf = new oc.gp_GTrsf_1();
239
267
  for (let row = 0; row < 3; row++) {
@@ -271,12 +299,21 @@ function composeTransforms(ops) {
271
299
  return { trsf: result, cleanup: () => result.delete() };
272
300
  }
273
301
  function transformCopy(shape, composed) {
274
- const oc = occtBoundary.getKernel().oc;
275
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, composed.trsf, true);
276
- const result = shapeTypes.castShape(transformer.Shape());
277
- propagateOrigins(transformer, [shape], result);
278
- transformer.delete();
279
- return result;
302
+ var _stack = [];
303
+ try {
304
+ const oc = occtBoundary.getKernel().oc;
305
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
306
+ const transformer = scope.register(
307
+ new oc.BRepBuilderAPI_Transform_2(shape.wrapped, composed.trsf, true)
308
+ );
309
+ const result = shapeTypes.castShape(transformer.Shape());
310
+ propagateOrigins(transformer, [shape], result);
311
+ return result;
312
+ } catch (_) {
313
+ var _error = _, _hasError = true;
314
+ } finally {
315
+ __callDispose(_stack, _error, _hasError);
316
+ }
280
317
  }
281
318
  const topoCache = /* @__PURE__ */ new WeakMap();
282
319
  function getOrCreateCache(shape) {
@@ -436,25 +473,32 @@ function* iterVertices(shape) {
436
473
  }
437
474
  }
438
475
  function getBounds(shape) {
439
- const oc = occtBoundary.getKernel().oc;
440
- const bbox = new oc.Bnd_Box_1();
441
- oc.BRepBndLib.Add(shape.wrapped, bbox, true);
442
- const xMin = { current: 0 };
443
- const yMin = { current: 0 };
444
- const zMin = { current: 0 };
445
- const xMax = { current: 0 };
446
- const yMax = { current: 0 };
447
- const zMax = { current: 0 };
448
- bbox.Get(xMin, yMin, zMin, xMax, yMax, zMax);
449
- bbox.delete();
450
- return {
451
- xMin: xMin.current,
452
- xMax: xMax.current,
453
- yMin: yMin.current,
454
- yMax: yMax.current,
455
- zMin: zMin.current,
456
- zMax: zMax.current
457
- };
476
+ var _stack = [];
477
+ try {
478
+ const oc = occtBoundary.getKernel().oc;
479
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
480
+ const bbox = scope.register(new oc.Bnd_Box_1());
481
+ oc.BRepBndLib.Add(shape.wrapped, bbox, true);
482
+ const xMin = { current: 0 };
483
+ const yMin = { current: 0 };
484
+ const zMin = { current: 0 };
485
+ const xMax = { current: 0 };
486
+ const yMax = { current: 0 };
487
+ const zMax = { current: 0 };
488
+ bbox.Get(xMin, yMin, zMin, xMax, yMax, zMax);
489
+ return {
490
+ xMin: xMin.current,
491
+ xMax: xMax.current,
492
+ yMin: yMin.current,
493
+ yMax: yMax.current,
494
+ zMin: zMin.current,
495
+ zMax: zMax.current
496
+ };
497
+ } catch (_) {
498
+ var _error = _, _hasError = true;
499
+ } finally {
500
+ __callDispose(_stack, _error, _hasError);
501
+ }
458
502
  }
459
503
  function describe(shape) {
460
504
  return {
@@ -468,11 +512,17 @@ function describe(shape) {
468
512
  };
469
513
  }
470
514
  function vertexPosition(vertex) {
471
- const oc = occtBoundary.getKernel().oc;
472
- const pnt = oc.BRep_Tool.Pnt(vertex.wrapped);
473
- const result = [pnt.X(), pnt.Y(), pnt.Z()];
474
- pnt.delete();
475
- return result;
515
+ var _stack = [];
516
+ try {
517
+ const oc = occtBoundary.getKernel().oc;
518
+ const scope = __using(_stack, new shapeTypes.DisposalScope());
519
+ const pnt = scope.register(oc.BRep_Tool.Pnt(vertex.wrapped));
520
+ return [pnt.X(), pnt.Y(), pnt.Z()];
521
+ } catch (_) {
522
+ var _error = _, _hasError = true;
523
+ } finally {
524
+ __callDispose(_stack, _error, _hasError);
525
+ }
476
526
  }
477
527
  exports.applyMatrix = applyMatrix;
478
528
  exports.clone = clone;
@@ -44,7 +44,7 @@ var __callDispose = (stack, error, hasError) => {
44
44
  return next();
45
45
  };
46
46
  import { g as getKernel, b as toOcVec, m as makeOcAx1, c as makeOcAx2, d as toOcPnt } from "./occtBoundary-Ct0tN8cs.js";
47
- import { c as castShape, g as getShapeKind, D as DisposalScope } from "./shapeTypes-D34s68Xi.js";
47
+ import { D as DisposalScope, c as castShape, g as getShapeKind } from "./shapeTypes-D34s68Xi.js";
48
48
  import { D as DEG2RAD, H as HASH_CODE_MAX } from "./vecOps-ZDdZWbwT.js";
49
49
  import { i as iterTopo, d as downcast } from "./faceFns-DG4bu-QB.js";
50
50
  import { u as unwrap } from "./errors-CHfaHQSt.js";
@@ -84,56 +84,76 @@ function simplify(shape) {
84
84
  }
85
85
  }
86
86
  function translate(shape, v) {
87
- const oc = getKernel().oc;
88
- const trsf = new oc.gp_Trsf_1();
89
- const vec = toOcVec(v);
90
- trsf.SetTranslation_1(vec);
91
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
92
- const result = castShape(transformer.Shape());
93
- propagateOrigins(transformer, [shape], result);
94
- transformer.delete();
95
- trsf.delete();
96
- vec.delete();
97
- return result;
87
+ var _stack = [];
88
+ try {
89
+ const oc = getKernel().oc;
90
+ const scope = __using(_stack, new DisposalScope());
91
+ const trsf = scope.register(new oc.gp_Trsf_1());
92
+ const vec = scope.register(toOcVec(v));
93
+ trsf.SetTranslation_1(vec);
94
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
95
+ const result = castShape(transformer.Shape());
96
+ propagateOrigins(transformer, [shape], result);
97
+ return result;
98
+ } catch (_) {
99
+ var _error = _, _hasError = true;
100
+ } finally {
101
+ __callDispose(_stack, _error, _hasError);
102
+ }
98
103
  }
99
104
  function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
100
- const oc = getKernel().oc;
101
- const trsf = new oc.gp_Trsf_1();
102
- const ax1 = makeOcAx1(position, direction);
103
- trsf.SetRotation_1(ax1, angle * DEG2RAD);
104
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
105
- const result = castShape(transformer.Shape());
106
- propagateOrigins(transformer, [shape], result);
107
- transformer.delete();
108
- trsf.delete();
109
- ax1.delete();
110
- return result;
105
+ var _stack = [];
106
+ try {
107
+ const oc = getKernel().oc;
108
+ const scope = __using(_stack, new DisposalScope());
109
+ const trsf = scope.register(new oc.gp_Trsf_1());
110
+ const ax1 = scope.register(makeOcAx1(position, direction));
111
+ trsf.SetRotation_1(ax1, angle * DEG2RAD);
112
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
113
+ const result = castShape(transformer.Shape());
114
+ propagateOrigins(transformer, [shape], result);
115
+ return result;
116
+ } catch (_) {
117
+ var _error = _, _hasError = true;
118
+ } finally {
119
+ __callDispose(_stack, _error, _hasError);
120
+ }
111
121
  }
112
122
  function mirror(shape, planeNormal = [0, 1, 0], planeOrigin = [0, 0, 0]) {
113
- const oc = getKernel().oc;
114
- const trsf = new oc.gp_Trsf_1();
115
- const ax2 = makeOcAx2(planeOrigin, planeNormal);
116
- trsf.SetMirror_3(ax2);
117
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
118
- const result = castShape(transformer.Shape());
119
- propagateOrigins(transformer, [shape], result);
120
- transformer.delete();
121
- trsf.delete();
122
- ax2.delete();
123
- return result;
123
+ var _stack = [];
124
+ try {
125
+ const oc = getKernel().oc;
126
+ const scope = __using(_stack, new DisposalScope());
127
+ const trsf = scope.register(new oc.gp_Trsf_1());
128
+ const ax2 = scope.register(makeOcAx2(planeOrigin, planeNormal));
129
+ trsf.SetMirror_3(ax2);
130
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
131
+ const result = castShape(transformer.Shape());
132
+ propagateOrigins(transformer, [shape], result);
133
+ return result;
134
+ } catch (_) {
135
+ var _error = _, _hasError = true;
136
+ } finally {
137
+ __callDispose(_stack, _error, _hasError);
138
+ }
124
139
  }
125
140
  function scale(shape, factor, center = [0, 0, 0]) {
126
- const oc = getKernel().oc;
127
- const trsf = new oc.gp_Trsf_1();
128
- const pnt = toOcPnt(center);
129
- trsf.SetScale(pnt, factor);
130
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
131
- const result = castShape(transformer.Shape());
132
- propagateOrigins(transformer, [shape], result);
133
- transformer.delete();
134
- trsf.delete();
135
- pnt.delete();
136
- return result;
141
+ var _stack = [];
142
+ try {
143
+ const oc = getKernel().oc;
144
+ const scope = __using(_stack, new DisposalScope());
145
+ const trsf = scope.register(new oc.gp_Trsf_1());
146
+ const pnt = scope.register(toOcPnt(center));
147
+ trsf.SetScale(pnt, factor);
148
+ const transformer = scope.register(new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true));
149
+ const result = castShape(transformer.Shape());
150
+ propagateOrigins(transformer, [shape], result);
151
+ return result;
152
+ } catch (_) {
153
+ var _error = _, _hasError = true;
154
+ } finally {
155
+ __callDispose(_stack, _error, _hasError);
156
+ }
137
157
  }
138
158
  function resize(shape, dimensions, options) {
139
159
  const bbox = getKernel().boundingBox(shape.wrapped);
@@ -212,27 +232,35 @@ function applyMatrix(shape, matrix) {
212
232
  const oc = getKernel().oc;
213
233
  const orthogonal = isOrthogonalMatrix(linear);
214
234
  if (orthogonal) {
215
- const trsf = new oc.gp_Trsf_1();
216
- trsf.SetValues(
217
- linear[0],
218
- linear[1],
219
- linear[2],
220
- translation[0],
221
- linear[3],
222
- linear[4],
223
- linear[5],
224
- translation[1],
225
- linear[6],
226
- linear[7],
227
- linear[8],
228
- translation[2]
229
- );
230
- const transformer2 = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
231
- const result2 = castShape(transformer2.Shape());
232
- propagateOrigins(transformer2, [shape], result2);
233
- transformer2.delete();
234
- trsf.delete();
235
- return result2;
235
+ var _stack = [];
236
+ try {
237
+ const scope = __using(_stack, new DisposalScope());
238
+ const trsf = scope.register(new oc.gp_Trsf_1());
239
+ trsf.SetValues(
240
+ linear[0],
241
+ linear[1],
242
+ linear[2],
243
+ translation[0],
244
+ linear[3],
245
+ linear[4],
246
+ linear[5],
247
+ translation[1],
248
+ linear[6],
249
+ linear[7],
250
+ linear[8],
251
+ translation[2]
252
+ );
253
+ const transformer2 = scope.register(
254
+ new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true)
255
+ );
256
+ const result2 = castShape(transformer2.Shape());
257
+ propagateOrigins(transformer2, [shape], result2);
258
+ return result2;
259
+ } catch (_) {
260
+ var _error = _, _hasError = true;
261
+ } finally {
262
+ __callDispose(_stack, _error, _hasError);
263
+ }
236
264
  }
237
265
  const gtrsf = new oc.gp_GTrsf_1();
238
266
  for (let row = 0; row < 3; row++) {
@@ -270,12 +298,21 @@ function composeTransforms(ops) {
270
298
  return { trsf: result, cleanup: () => result.delete() };
271
299
  }
272
300
  function transformCopy(shape, composed) {
273
- const oc = getKernel().oc;
274
- const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, composed.trsf, true);
275
- const result = castShape(transformer.Shape());
276
- propagateOrigins(transformer, [shape], result);
277
- transformer.delete();
278
- return result;
301
+ var _stack = [];
302
+ try {
303
+ const oc = getKernel().oc;
304
+ const scope = __using(_stack, new DisposalScope());
305
+ const transformer = scope.register(
306
+ new oc.BRepBuilderAPI_Transform_2(shape.wrapped, composed.trsf, true)
307
+ );
308
+ const result = castShape(transformer.Shape());
309
+ propagateOrigins(transformer, [shape], result);
310
+ return result;
311
+ } catch (_) {
312
+ var _error = _, _hasError = true;
313
+ } finally {
314
+ __callDispose(_stack, _error, _hasError);
315
+ }
279
316
  }
280
317
  const topoCache = /* @__PURE__ */ new WeakMap();
281
318
  function getOrCreateCache(shape) {
@@ -435,25 +472,32 @@ function* iterVertices(shape) {
435
472
  }
436
473
  }
437
474
  function getBounds(shape) {
438
- const oc = getKernel().oc;
439
- const bbox = new oc.Bnd_Box_1();
440
- oc.BRepBndLib.Add(shape.wrapped, bbox, true);
441
- const xMin = { current: 0 };
442
- const yMin = { current: 0 };
443
- const zMin = { current: 0 };
444
- const xMax = { current: 0 };
445
- const yMax = { current: 0 };
446
- const zMax = { current: 0 };
447
- bbox.Get(xMin, yMin, zMin, xMax, yMax, zMax);
448
- bbox.delete();
449
- return {
450
- xMin: xMin.current,
451
- xMax: xMax.current,
452
- yMin: yMin.current,
453
- yMax: yMax.current,
454
- zMin: zMin.current,
455
- zMax: zMax.current
456
- };
475
+ var _stack = [];
476
+ try {
477
+ const oc = getKernel().oc;
478
+ const scope = __using(_stack, new DisposalScope());
479
+ const bbox = scope.register(new oc.Bnd_Box_1());
480
+ oc.BRepBndLib.Add(shape.wrapped, bbox, true);
481
+ const xMin = { current: 0 };
482
+ const yMin = { current: 0 };
483
+ const zMin = { current: 0 };
484
+ const xMax = { current: 0 };
485
+ const yMax = { current: 0 };
486
+ const zMax = { current: 0 };
487
+ bbox.Get(xMin, yMin, zMin, xMax, yMax, zMax);
488
+ return {
489
+ xMin: xMin.current,
490
+ xMax: xMax.current,
491
+ yMin: yMin.current,
492
+ yMax: yMax.current,
493
+ zMin: zMin.current,
494
+ zMax: zMax.current
495
+ };
496
+ } catch (_) {
497
+ var _error = _, _hasError = true;
498
+ } finally {
499
+ __callDispose(_stack, _error, _hasError);
500
+ }
457
501
  }
458
502
  function describe(shape) {
459
503
  return {
@@ -467,11 +511,17 @@ function describe(shape) {
467
511
  };
468
512
  }
469
513
  function vertexPosition(vertex) {
470
- const oc = getKernel().oc;
471
- const pnt = oc.BRep_Tool.Pnt(vertex.wrapped);
472
- const result = [pnt.X(), pnt.Y(), pnt.Z()];
473
- pnt.delete();
474
- return result;
514
+ var _stack = [];
515
+ try {
516
+ const oc = getKernel().oc;
517
+ const scope = __using(_stack, new DisposalScope());
518
+ const pnt = scope.register(oc.BRep_Tool.Pnt(vertex.wrapped));
519
+ return [pnt.X(), pnt.Y(), pnt.Z()];
520
+ } catch (_) {
521
+ var _error = _, _hasError = true;
522
+ } finally {
523
+ __callDispose(_stack, _error, _hasError);
524
+ }
475
525
  }
476
526
  export {
477
527
  iterFaces as A,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const drawFns = require("./drawFns-BGGYhul8.cjs");
4
- const boolean2D = require("./boolean2D-Bs_OdV2_.cjs");
3
+ const drawFns = require("./drawFns-ibZFQZkt.cjs");
4
+ const boolean2D = require("./boolean2D-KvkerCI-.cjs");
5
5
  exports.CompoundSketch = drawFns.CompoundSketch;
6
6
  exports.Drawing = drawFns.Drawing;
7
7
  exports.DrawingPen = drawFns.DrawingPen;
package/dist/sketching.js CHANGED
@@ -1,5 +1,5 @@
1
- import { C, D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W } from "./drawFns-Df_AbW16.js";
2
- import { B as B2, a as a2, F as F2, S as S2 } from "./boolean2D-BG9wtSKz.js";
1
+ import { C, D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W } from "./drawFns-BY9W9rPP.js";
2
+ import { B as B2, a as a2, F as F2, S as S2 } from "./boolean2D-CypPzZM1.js";
3
3
  export {
4
4
  B2 as BaseSketcher2d,
5
5
  a2 as BlueprintSketcher,
@@ -46,7 +46,7 @@ var __callDispose = (stack, error, hasError) => {
46
46
  import { g as getKernel, d as toOcPnt, b as toOcVec, c as makeOcAx2, e as makeOcAx3 } from "./occtBoundary-Ct0tN8cs.js";
47
47
  import { e as err, o as occtError, l as ok, x as validationError, a as andThen } from "./errors-CHfaHQSt.js";
48
48
  import { D as DisposalScope, d as isEdge, n as isWire, q as createWire, r as createEdge, s as createFace, e as isFace } from "./shapeTypes-D34s68Xi.js";
49
- import { d as getEdges } from "./shapeFns-5HlS8wvc.js";
49
+ import { d as getEdges } from "./shapeFns-DNxuGWvV.js";
50
50
  import { o as outerWire, c as cast } from "./faceFns-DG4bu-QB.js";
51
51
  function range(len) {
52
52
  return Array.from(Array(len).keys());