brepjs 7.4.2 → 8.0.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 (106) hide show
  1. package/README.md +179 -17
  2. package/dist/2d/blueprints/blueprintFns.d.ts +0 -22
  3. package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
  4. package/dist/2d/blueprints/boolean2D.d.ts +3 -3
  5. package/dist/2d.cjs +2 -58
  6. package/dist/2d.d.ts +1 -2
  7. package/dist/2d.d.ts.map +1 -1
  8. package/dist/2d.js +7 -64
  9. package/dist/{Blueprint-3Dyu0OL6.cjs → Blueprint-CVctc41Z.cjs} +4 -4
  10. package/dist/{Blueprint-DSHD89bZ.js → Blueprint-D3JfGJTz.js} +4 -4
  11. package/dist/{boolean2D-BwOpOv6L.cjs → boolean2D-BdZATaHs.cjs} +9 -9
  12. package/dist/{boolean2D-CtyE2hK5.js → boolean2D-hOw5Qay5.js} +9 -9
  13. package/dist/{booleanFns-5KSbtLBU.cjs → booleanFns-BBSVKhL2.cjs} +27 -31
  14. package/dist/{booleanFns-DcxqLQSG.js → booleanFns-CqehfzcK.js} +27 -31
  15. package/dist/brepjs.cjs +95 -106
  16. package/dist/brepjs.js +129 -140
  17. package/dist/{cast-D1s7Im9E.js → cast-DQaUibmm.js} +3 -3
  18. package/dist/{cast-DsxJk_F0.cjs → cast-DkB0GKmQ.cjs} +2 -2
  19. package/dist/{drawFns-CSbH7uoI.js → drawFns-921SkhDL.js} +9 -9
  20. package/dist/{drawFns-C6KQjmQj.cjs → drawFns-CUyx50gi.cjs} +9 -9
  21. package/dist/{faceFns-B9if-FPW.cjs → faceFns-BwK7FP7N.cjs} +1 -1
  22. package/dist/{faceFns-Bl6HHbqO.js → faceFns-DHu-2JpA.js} +1 -1
  23. package/dist/index.d.ts +9 -11
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/io.cjs +2 -2
  26. package/dist/io.js +2 -2
  27. package/dist/{loft-Cc5E5pAf.cjs → loft-BzWFokmC.cjs} +2 -2
  28. package/dist/{loft-BlNndTOR.js → loft-CtG5nMq5.js} +2 -2
  29. package/dist/{measurement-D75pyJi1.js → measurement-C5JGCuUP.js} +1 -1
  30. package/dist/{measurement-BVdZ9cG3.cjs → measurement-fxm_pW7x.cjs} +1 -1
  31. package/dist/measurement.cjs +1 -1
  32. package/dist/measurement.js +1 -1
  33. package/dist/{meshFns-p_kv--PW.js → meshFns-AqAjTTVl.js} +11 -11
  34. package/dist/{meshFns-mVlogI3J.cjs → meshFns-BhrZGi6w.cjs} +11 -11
  35. package/dist/operations/api.d.ts +4 -6
  36. package/dist/operations/api.d.ts.map +1 -1
  37. package/dist/operations/exporterFns.d.ts +0 -2
  38. package/dist/operations/exporterFns.d.ts.map +1 -1
  39. package/dist/operations/extrude.d.ts +2 -4
  40. package/dist/operations/extrude.d.ts.map +1 -1
  41. package/dist/operations/extrudeFns.d.ts +4 -4
  42. package/dist/operations/extrudeFns.d.ts.map +1 -1
  43. package/dist/operations/extrudeUtils.d.ts +0 -2
  44. package/dist/operations/extrudeUtils.d.ts.map +1 -1
  45. package/dist/operations/loft.d.ts +1 -1
  46. package/dist/operations/loftFns.d.ts +2 -4
  47. package/dist/operations/loftFns.d.ts.map +1 -1
  48. package/dist/{operations-SRN-mfTx.cjs → operations-BP1wVDw0.cjs} +14 -20
  49. package/dist/{operations-CEV-gqkX.js → operations-C1rWoba2.js} +14 -20
  50. package/dist/operations.cjs +2 -2
  51. package/dist/operations.d.ts +3 -3
  52. package/dist/operations.d.ts.map +1 -1
  53. package/dist/operations.js +2 -2
  54. package/dist/{query-D7XclvBZ.js → query-V6nV-VfL.js} +4 -4
  55. package/dist/{query-DkcMfh6j.cjs → query-hMSmOWJP.cjs} +4 -4
  56. package/dist/query.cjs +1 -1
  57. package/dist/query.js +1 -1
  58. package/dist/{shapeFns-BpCPVHFT.js → shapeFns-BrF97sKt.js} +19 -19
  59. package/dist/{shapeFns-DjsWo98C.cjs → shapeFns-BvOndshS.cjs} +19 -19
  60. package/dist/{shapeHelpers-BBSVHPGk.cjs → shapeHelpers-B2SXz1p4.cjs} +2 -2
  61. package/dist/{shapeHelpers-C4QIp7u5.js → shapeHelpers-BcoZf2N9.js} +2 -2
  62. package/dist/sketching/sketcherlib.d.ts +2 -4
  63. package/dist/sketching/sketcherlib.d.ts.map +1 -1
  64. package/dist/sketching.cjs +2 -2
  65. package/dist/sketching.d.ts +2 -2
  66. package/dist/sketching.d.ts.map +1 -1
  67. package/dist/sketching.js +2 -2
  68. package/dist/topology/api.d.ts +11 -15
  69. package/dist/topology/api.d.ts.map +1 -1
  70. package/dist/topology/apiTypes.d.ts +0 -2
  71. package/dist/topology/apiTypes.d.ts.map +1 -1
  72. package/dist/topology/booleanFns.d.ts +9 -9
  73. package/dist/topology/booleanFns.d.ts.map +1 -1
  74. package/dist/topology/cast.d.ts +2 -2
  75. package/dist/topology/cast.d.ts.map +1 -1
  76. package/dist/topology/chamferAngleFns.d.ts +1 -1
  77. package/dist/topology/chamferAngleFns.d.ts.map +1 -1
  78. package/dist/topology/healingFns.d.ts +2 -2
  79. package/dist/topology/healingFns.d.ts.map +1 -1
  80. package/dist/topology/index.d.ts +2 -2
  81. package/dist/topology/index.d.ts.map +1 -1
  82. package/dist/topology/meshCache.d.ts +2 -4
  83. package/dist/topology/meshCache.d.ts.map +1 -1
  84. package/dist/topology/meshFns.d.ts +2 -2
  85. package/dist/topology/meshFns.d.ts.map +1 -1
  86. package/dist/topology/modifierFns.d.ts +5 -5
  87. package/dist/topology/modifierFns.d.ts.map +1 -1
  88. package/dist/topology/primitiveFns.d.ts +4 -8
  89. package/dist/topology/primitiveFns.d.ts.map +1 -1
  90. package/dist/topology/shapeFns.d.ts +9 -9
  91. package/dist/topology/shapeFns.d.ts.map +1 -1
  92. package/dist/topology/shapeModifiers.d.ts +0 -2
  93. package/dist/topology/shapeModifiers.d.ts.map +1 -1
  94. package/dist/topology/wrapperFns.d.ts +3 -3
  95. package/dist/topology/wrapperFns.d.ts.map +1 -1
  96. package/dist/{topology-Bb1W3SyF.cjs → topology-CIooytHH.cjs} +18 -18
  97. package/dist/{topology-BEMrS4WZ.js → topology-tFzqSrGH.js} +18 -18
  98. package/dist/topology.cjs +8 -8
  99. package/dist/topology.d.ts +1 -1
  100. package/dist/topology.d.ts.map +1 -1
  101. package/dist/topology.js +8 -8
  102. package/package.json +3 -3
  103. package/dist/2d/blueprints/boolean2dFns.d.ts +0 -46
  104. package/dist/2d/blueprints/boolean2dFns.d.ts.map +0 -1
  105. package/dist/core/geometry.d.ts +0 -26
  106. package/dist/core/geometry.d.ts.map +0 -1
@@ -51,11 +51,11 @@ function castToShape3D(shape, errorCode, errorMsg) {
51
51
  }
52
52
  return errors.ok(wrapped);
53
53
  }
54
- function fuseShape(a, b, { optimisation = "none", simplify = false, signal } = {}) {
54
+ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
55
55
  if (signal?.aborted) throw signal.reason;
56
- const checkA = validateShape3D(a, "fuseShape: first operand");
56
+ const checkA = validateShape3D(a, "fuse: first operand");
57
57
  if (errors.isErr(checkA)) return checkA;
58
- const checkB = validateShape3D(b, "fuseShape: second operand");
58
+ const checkB = validateShape3D(b, "fuse: second operand");
59
59
  if (errors.isErr(checkB)) return checkB;
60
60
  const oc = occtBoundary.getKernel().oc;
61
61
  const r = shapeTypes.gcWithScope();
@@ -66,11 +66,11 @@ function fuseShape(a, b, { optimisation = "none", simplify = false, signal } = {
66
66
  if (simplify) fuseOp.SimplifyResult(true, true, 1e-3);
67
67
  return castToShape3D(fuseOp.Shape(), "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
68
68
  }
69
- function cutShape(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
69
+ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
70
70
  if (signal?.aborted) throw signal.reason;
71
- const checkBase = validateShape3D(base, "cutShape: base");
71
+ const checkBase = validateShape3D(base, "cut: base");
72
72
  if (errors.isErr(checkBase)) return checkBase;
73
- const checkTool = validateShape3D(tool, "cutShape: tool");
73
+ const checkTool = validateShape3D(tool, "cut: tool");
74
74
  if (errors.isErr(checkTool)) return checkTool;
75
75
  const oc = occtBoundary.getKernel().oc;
76
76
  const r = shapeTypes.gcWithScope();
@@ -81,11 +81,11 @@ function cutShape(base, tool, { optimisation = "none", simplify = false, signal
81
81
  if (simplify) cutOp.SimplifyResult(true, true, 1e-3);
82
82
  return castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
83
83
  }
84
- function intersectShape(a, b, { simplify = false, signal } = {}) {
84
+ function intersect(a, b, { simplify = false, signal } = {}) {
85
85
  if (signal?.aborted) throw signal.reason;
86
- const checkA = validateShape3D(a, "intersectShape: first operand");
86
+ const checkA = validateShape3D(a, "intersect: first operand");
87
87
  if (errors.isErr(checkA)) return checkA;
88
- const checkB = validateShape3D(b, "intersectShape: second operand");
88
+ const checkB = validateShape3D(b, "intersect: second operand");
89
89
  if (errors.isErr(checkB)) return checkB;
90
90
  const oc = occtBoundary.getKernel().oc;
91
91
  const r = shapeTypes.gcWithScope();
@@ -100,7 +100,7 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel,
100
100
  const count = end - start;
101
101
  if (count === 1) return errors.ok(shapes[start]);
102
102
  if (count === 2) {
103
- return fuseShape(shapes[start], shapes[start + 1], {
103
+ return fuse(shapes[start], shapes[start + 1], {
104
104
  optimisation,
105
105
  simplify: isTopLevel ? simplify : false,
106
106
  ...signal ? { signal } : {}
@@ -111,7 +111,7 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel,
111
111
  if (errors.isErr(leftResult)) return leftResult;
112
112
  const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, signal);
113
113
  if (errors.isErr(rightResult)) return rightResult;
114
- return fuseShape(leftResult.value, rightResult.value, {
114
+ return fuse(leftResult.value, rightResult.value, {
115
115
  optimisation,
116
116
  simplify: isTopLevel ? simplify : false,
117
117
  ...signal ? { signal } : {}
@@ -193,11 +193,9 @@ function makeSectionFace(plane, size) {
193
193
  for (const p of pts) p.delete();
194
194
  return face;
195
195
  }
196
- function sectionShape(shape, plane, { approximation = true, planeSize = 1e4 } = {}) {
196
+ function section(shape, plane, { approximation = true, planeSize = 1e4 } = {}) {
197
197
  if (shape.wrapped.IsNull()) {
198
- return errors.err(
199
- errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, "sectionShape: shape is a null shape")
200
- );
198
+ return errors.err(errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, "section: shape is a null shape"));
201
199
  }
202
200
  const resolvedPlane = typeof plane === "string" ? vectors.resolvePlane(plane) : plane;
203
201
  const sectionFace = makeSectionFace(resolvedPlane, planeSize);
@@ -211,7 +209,7 @@ function sectionShape(shape, plane, { approximation = true, planeSize = 1e4 } =
211
209
  const planeName = typeof plane === "string" ? plane : "custom";
212
210
  return errors.err(
213
211
  errors.occtError("SECTION_FAILED", `Section with ${planeName} plane failed: ${raw}`, e, {
214
- operation: "sectionShape",
212
+ operation: "section",
215
213
  plane: planeName
216
214
  })
217
215
  );
@@ -219,12 +217,10 @@ function sectionShape(shape, plane, { approximation = true, planeSize = 1e4 } =
219
217
  sectionFace.delete();
220
218
  }
221
219
  }
222
- function splitShape(shape, tools) {
220
+ function split(shape, tools) {
223
221
  if (tools.length === 0) return errors.ok(shape);
224
222
  if (shape.wrapped.IsNull()) {
225
- return errors.err(
226
- errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, "splitShape: shape is a null shape")
227
- );
223
+ return errors.err(errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
228
224
  }
229
225
  for (let i = 0; i < tools.length; i++) {
230
226
  if (tools[i].wrapped.IsNull()) {
@@ -246,27 +242,27 @@ function splitShape(shape, tools) {
246
242
  const raw = e instanceof Error ? e.message : String(e);
247
243
  return errors.err(
248
244
  errors.occtError("SPLIT_FAILED", `Split operation failed on ${tools.length} tool(s): ${raw}`, e, {
249
- operation: "splitShape",
245
+ operation: "split",
250
246
  toolCount: tools.length
251
247
  })
252
248
  );
253
249
  }
254
250
  }
255
- function sliceShape(shape, planes, options = {}) {
251
+ function slice(shape, planes, options = {}) {
256
252
  const results = [];
257
253
  for (const plane of planes) {
258
- const section = sectionShape(shape, plane, options);
259
- if (errors.isErr(section)) return section;
260
- results.push(section.value);
254
+ const result = section(shape, plane, options);
255
+ if (errors.isErr(result)) return result;
256
+ results.push(result.value);
261
257
  }
262
258
  return errors.ok(results);
263
259
  }
264
260
  exports.applyGlue = applyGlue;
261
+ exports.cut = cut;
265
262
  exports.cutAll = cutAll;
266
- exports.cutShape = cutShape;
263
+ exports.fuse = fuse;
267
264
  exports.fuseAll = fuseAll;
268
- exports.fuseShape = fuseShape;
269
- exports.intersectShape = intersectShape;
270
- exports.sectionShape = sectionShape;
271
- exports.sliceShape = sliceShape;
272
- exports.splitShape = splitShape;
265
+ exports.intersect = intersect;
266
+ exports.section = section;
267
+ exports.slice = slice;
268
+ exports.split = split;
@@ -50,11 +50,11 @@ function castToShape3D(shape, errorCode, errorMsg) {
50
50
  }
51
51
  return ok(wrapped);
52
52
  }
53
- function fuseShape(a, b, { optimisation = "none", simplify = false, signal } = {}) {
53
+ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
54
54
  if (signal?.aborted) throw signal.reason;
55
- const checkA = validateShape3D(a, "fuseShape: first operand");
55
+ const checkA = validateShape3D(a, "fuse: first operand");
56
56
  if (isErr(checkA)) return checkA;
57
- const checkB = validateShape3D(b, "fuseShape: second operand");
57
+ const checkB = validateShape3D(b, "fuse: second operand");
58
58
  if (isErr(checkB)) return checkB;
59
59
  const oc = getKernel().oc;
60
60
  const r = gcWithScope();
@@ -65,11 +65,11 @@ function fuseShape(a, b, { optimisation = "none", simplify = false, signal } = {
65
65
  if (simplify) fuseOp.SimplifyResult(true, true, 1e-3);
66
66
  return castToShape3D(fuseOp.Shape(), "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
67
67
  }
68
- function cutShape(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
68
+ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
69
69
  if (signal?.aborted) throw signal.reason;
70
- const checkBase = validateShape3D(base, "cutShape: base");
70
+ const checkBase = validateShape3D(base, "cut: base");
71
71
  if (isErr(checkBase)) return checkBase;
72
- const checkTool = validateShape3D(tool, "cutShape: tool");
72
+ const checkTool = validateShape3D(tool, "cut: tool");
73
73
  if (isErr(checkTool)) return checkTool;
74
74
  const oc = getKernel().oc;
75
75
  const r = gcWithScope();
@@ -80,11 +80,11 @@ function cutShape(base, tool, { optimisation = "none", simplify = false, signal
80
80
  if (simplify) cutOp.SimplifyResult(true, true, 1e-3);
81
81
  return castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
82
82
  }
83
- function intersectShape(a, b, { simplify = false, signal } = {}) {
83
+ function intersect(a, b, { simplify = false, signal } = {}) {
84
84
  if (signal?.aborted) throw signal.reason;
85
- const checkA = validateShape3D(a, "intersectShape: first operand");
85
+ const checkA = validateShape3D(a, "intersect: first operand");
86
86
  if (isErr(checkA)) return checkA;
87
- const checkB = validateShape3D(b, "intersectShape: second operand");
87
+ const checkB = validateShape3D(b, "intersect: second operand");
88
88
  if (isErr(checkB)) return checkB;
89
89
  const oc = getKernel().oc;
90
90
  const r = gcWithScope();
@@ -99,7 +99,7 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel,
99
99
  const count = end - start;
100
100
  if (count === 1) return ok(shapes[start]);
101
101
  if (count === 2) {
102
- return fuseShape(shapes[start], shapes[start + 1], {
102
+ return fuse(shapes[start], shapes[start + 1], {
103
103
  optimisation,
104
104
  simplify: isTopLevel ? simplify : false,
105
105
  ...signal ? { signal } : {}
@@ -110,7 +110,7 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel,
110
110
  if (isErr(leftResult)) return leftResult;
111
111
  const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, signal);
112
112
  if (isErr(rightResult)) return rightResult;
113
- return fuseShape(leftResult.value, rightResult.value, {
113
+ return fuse(leftResult.value, rightResult.value, {
114
114
  optimisation,
115
115
  simplify: isTopLevel ? simplify : false,
116
116
  ...signal ? { signal } : {}
@@ -192,11 +192,9 @@ function makeSectionFace(plane, size) {
192
192
  for (const p of pts) p.delete();
193
193
  return face;
194
194
  }
195
- function sectionShape(shape, plane, { approximation = true, planeSize = 1e4 } = {}) {
195
+ function section(shape, plane, { approximation = true, planeSize = 1e4 } = {}) {
196
196
  if (shape.wrapped.IsNull()) {
197
- return err(
198
- validationError(BrepErrorCode.NULL_SHAPE_INPUT, "sectionShape: shape is a null shape")
199
- );
197
+ return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "section: shape is a null shape"));
200
198
  }
201
199
  const resolvedPlane = typeof plane === "string" ? resolvePlane(plane) : plane;
202
200
  const sectionFace = makeSectionFace(resolvedPlane, planeSize);
@@ -210,7 +208,7 @@ function sectionShape(shape, plane, { approximation = true, planeSize = 1e4 } =
210
208
  const planeName = typeof plane === "string" ? plane : "custom";
211
209
  return err(
212
210
  occtError("SECTION_FAILED", `Section with ${planeName} plane failed: ${raw}`, e, {
213
- operation: "sectionShape",
211
+ operation: "section",
214
212
  plane: planeName
215
213
  })
216
214
  );
@@ -218,12 +216,10 @@ function sectionShape(shape, plane, { approximation = true, planeSize = 1e4 } =
218
216
  sectionFace.delete();
219
217
  }
220
218
  }
221
- function splitShape(shape, tools) {
219
+ function split(shape, tools) {
222
220
  if (tools.length === 0) return ok(shape);
223
221
  if (shape.wrapped.IsNull()) {
224
- return err(
225
- validationError(BrepErrorCode.NULL_SHAPE_INPUT, "splitShape: shape is a null shape")
226
- );
222
+ return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
227
223
  }
228
224
  for (let i = 0; i < tools.length; i++) {
229
225
  if (tools[i].wrapped.IsNull()) {
@@ -245,29 +241,29 @@ function splitShape(shape, tools) {
245
241
  const raw = e instanceof Error ? e.message : String(e);
246
242
  return err(
247
243
  occtError("SPLIT_FAILED", `Split operation failed on ${tools.length} tool(s): ${raw}`, e, {
248
- operation: "splitShape",
244
+ operation: "split",
249
245
  toolCount: tools.length
250
246
  })
251
247
  );
252
248
  }
253
249
  }
254
- function sliceShape(shape, planes, options = {}) {
250
+ function slice(shape, planes, options = {}) {
255
251
  const results = [];
256
252
  for (const plane of planes) {
257
- const section = sectionShape(shape, plane, options);
258
- if (isErr(section)) return section;
259
- results.push(section.value);
253
+ const result = section(shape, plane, options);
254
+ if (isErr(result)) return result;
255
+ results.push(result.value);
260
256
  }
261
257
  return ok(results);
262
258
  }
263
259
  export {
264
- sliceShape as a,
265
- splitShape as b,
266
- cutShape as c,
260
+ slice as a,
261
+ split as b,
262
+ cut as c,
267
263
  cutAll as d,
268
264
  applyGlue as e,
269
- fuseShape as f,
265
+ fuse as f,
270
266
  fuseAll as g,
271
- intersectShape as i,
272
- sectionShape as s
267
+ intersect as i,
268
+ section as s
273
269
  };