brepjs 18.82.3 → 18.82.5

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 (55) hide show
  1. package/dist/2d.cjs +4 -4
  2. package/dist/2d.js +4 -4
  3. package/dist/{blueprint-BWb1b-R_.cjs → blueprint-BBUOweQy.cjs} +1 -1
  4. package/dist/{blueprint-BBSt1k_F.js → blueprint-DjzevNhB.js} +1 -1
  5. package/dist/{blueprintFns-oFr-O71P.cjs → blueprintFns-CRES_5vP.cjs} +2 -2
  6. package/dist/{blueprintFns-DWji-hqn.js → blueprintFns-CxSMnMfl.js} +2 -2
  7. package/dist/{blueprintSketcher-CMKW8gMH.cjs → blueprintSketcher-CFa32JZU.cjs} +2 -2
  8. package/dist/{blueprintSketcher-BJn6P9IX.js → blueprintSketcher-CIydRzRr.js} +2 -2
  9. package/dist/{boolean2D-DaOXyVXh.js → boolean2D-BRWPIJhe.js} +3 -3
  10. package/dist/{boolean2D-M3i4os2c.cjs → boolean2D-Z0KE98a4.cjs} +3 -3
  11. package/dist/brepjs.cjs +40 -40
  12. package/dist/brepjs.js +15 -15
  13. package/dist/{cornerFinder-Cc1KSYKs.js → cornerFinder-BRYZAgdE.js} +1 -1
  14. package/dist/{cornerFinder-CG2Pgp7d.cjs → cornerFinder-BuYpqGO8.cjs} +1 -1
  15. package/dist/{drawFns-tHcBGNpE.js → drawFns-C5Mdr0iH.js} +6 -6
  16. package/dist/{drawFns-t-ro78FP.cjs → drawFns-DK3DGHku.cjs} +6 -6
  17. package/dist/{healingFns-Ct_-O3yk.js → healingFns-C4JZHv8K.js} +1 -1
  18. package/dist/{healingFns-MxlhdTIc.cjs → healingFns-D3BkAVML.cjs} +5 -5
  19. package/dist/{helpers-BGoSvX_s.js → helpers-CTc8ZbY8.js} +1 -1
  20. package/dist/{helpers-B0uqRA6z.cjs → helpers-DN6s-TLC.cjs} +1 -1
  21. package/dist/{importFns-DA_iBX9K.cjs → importFns-Cb-cmpGG.cjs} +1 -1
  22. package/dist/{importFns-D8lE2Bou.js → importFns-D4Xet5aD.js} +1 -1
  23. package/dist/io.cjs +1 -1
  24. package/dist/io.js +1 -1
  25. package/dist/{measureFns-Ck2YGGfE.js → measureFns-7Nz5JklM.js} +14 -0
  26. package/dist/{measureFns-CynnLMdY.cjs → measureFns-BNHvjShh.cjs} +14 -0
  27. package/dist/measurement.cjs +1 -1
  28. package/dist/measurement.js +1 -1
  29. package/dist/operations.cjs +1 -1
  30. package/dist/operations.js +1 -1
  31. package/dist/primitiveFns-BPfYb_t5.cjs +461 -0
  32. package/dist/primitiveFns-DkuLOFkI.js +300 -0
  33. package/dist/query.cjs +2 -2
  34. package/dist/query.js +2 -2
  35. package/dist/shapeRef.cjs +1 -1
  36. package/dist/shapeRef.js +1 -1
  37. package/dist/{shapeRefFns-Botsp7SL.cjs → shapeRefFns-Bb0aQZWz.cjs} +1 -1
  38. package/dist/{shapeRefFns-DS9FldJc.js → shapeRefFns-NdQvPa5J.js} +1 -1
  39. package/dist/sketching.cjs +3 -3
  40. package/dist/sketching.js +3 -3
  41. package/dist/{primitiveFns-CjL5bygY.js → solidBuilders-QUpJdbiK.js} +99 -256
  42. package/dist/{primitiveFns-LWkd7M2f.cjs → solidBuilders-lDXPwoCz.cjs} +120 -379
  43. package/dist/text.cjs +2 -2
  44. package/dist/text.js +2 -2
  45. package/dist/{textBlueprints-C2INf1kF.cjs → textBlueprints-D4pLmVno.cjs} +26 -43
  46. package/dist/{textBlueprints-C03mB6SZ.js → textBlueprints-f8cgx9vi.js} +29 -46
  47. package/dist/{textMetrics-DgGJ3bZP.js → textMetrics-CQtQI4vF.js} +1 -1
  48. package/dist/{textMetrics-B1eg4u4V.cjs → textMetrics-DTRuXeXr.cjs} +1 -1
  49. package/dist/{threadFns-DqMbjyxZ.js → threadFns-CvLvKdwB.js} +2 -1
  50. package/dist/{threadFns-CX9l8sRv.cjs → threadFns-DvSdQiRw.cjs} +4 -3
  51. package/dist/topology.cjs +5 -4
  52. package/dist/topology.js +3 -2
  53. package/package.json +1 -1
  54. package/dist/solidBuilders-CgPOdC3Q.js +0 -140
  55. package/dist/solidBuilders-mxHbGDW6.cjs +0 -199
@@ -38,8 +38,8 @@ const require_faceFns = require("./faceFns-6AarivqH.cjs");
38
38
  const require_curveFns = require("./curveFns-BA5zsoce.cjs");
39
39
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
40
40
  const require_surfaceBuilders = require("./surfaceBuilders-R4DKNFkI.cjs");
41
- const require_blueprintSketcher = require("./blueprintSketcher-CMKW8gMH.cjs");
42
- const require_solidBuilders = require("./solidBuilders-mxHbGDW6.cjs");
41
+ const require_solidBuilders = require("./solidBuilders-lDXPwoCz.cjs");
42
+ const require_blueprintSketcher = require("./blueprintSketcher-CFa32JZU.cjs");
43
43
  const require_loftFns = require("./loftFns-DxhcdpAu.cjs");
44
44
  let opentype_js = require("opentype.js");
45
45
  opentype_js = __toESM(opentype_js, 1);
@@ -214,45 +214,28 @@ function sketchLoft(sketch, otherSketches, loftConfig = {}, returnShell = false)
214
214
  });
215
215
  return shape;
216
216
  }
217
- var guessFaceFromWires = (wires) => {
218
- const wireShapes = wires.map((w) => w.wrapped);
219
- const newFace = require_errors.unwrap(require_faceFns.cast(require_shapeTypes.getKernel().fillSurface(wireShapes)));
220
- if (!require_shapeTypes.isFace(newFace)) require_errors.bug("guessFaceFromWires", "Failed to create a face");
221
- return newFace;
222
- };
223
- var fixWire = (wire, baseFace) => {
224
- return require_shapeTypes.createWire(require_shapeTypes.getKernel().fixWireOnFace(wire.wrapped, baseFace.wrapped, 1e-9));
225
- };
226
- var faceFromWires = (wires) => {
227
- let baseFace;
228
- let holeWires;
229
- const faceResult = require_surfaceBuilders.makeFace(require_arrayAccess.firstOrThrow(wires));
230
- if (require_errors.isOk(faceResult)) {
231
- baseFace = faceResult.value;
232
- holeWires = wires.slice(1);
233
- } else {
234
- baseFace = guessFaceFromWires(wires);
235
- holeWires = wires.slice(1).map((w) => fixWire(w, baseFace));
236
- }
237
- return require_surfaceBuilders.addHolesInFace(baseFace, holeWires);
238
- };
239
- var solidFromShellGenerator = (sketches, shellGenerator) => {
240
- const shells = [];
241
- const startWires = [];
242
- const endWires = [];
243
- sketches.forEach((sketch) => {
244
- const [shell, startWire, endWire] = require_errors.unwrap(shellGenerator(sketch));
245
- shells.push(shell);
246
- startWires.push(startWire);
247
- endWires.push(endWire);
248
- });
249
- const startFace = faceFromWires(startWires);
250
- const endFace = faceFromWires(endWires);
251
- return require_errors.unwrap(require_solidBuilders.makeSolid([
252
- startFace,
253
- ...shells,
254
- endFace
255
- ]));
217
+ /**
218
+ * Build a holed twist/profile-extruded solid by extruding the outer boundary
219
+ * and each hole wire as independent solids, then boolean-subtracting the holes.
220
+ *
221
+ * A single-wire twist/profile sweep already yields a valid, consistently-
222
+ * oriented solid. The previous approach assembled the per-wire lateral *shells*
223
+ * plus shared caps into one solid, which produced an inconsistently-oriented
224
+ * (invalid) result whose signed volume even flipped sign between occt-wasm
225
+ * versions — the cause of the #1366 twist/profile compound-extrude failure
226
+ * under occt-wasm 3.3.0. Subtracting valid solids is robust to kernel
227
+ * orientation conventions.
228
+ */
229
+ var holedSweptSolid = (sketches, solidGenerator) => {
230
+ const outer = require_errors.unwrap(solidGenerator(require_arrayAccess.firstOrThrow(sketches)));
231
+ const holes = sketches.slice(1).map((s) => require_errors.unwrap(solidGenerator(s)));
232
+ if (holes.length === 0) return outer;
233
+ try {
234
+ return require_errors.unwrap(require_solidBuilders.cutAll(outer, holes, { unsafe: true }));
235
+ } finally {
236
+ outer.delete();
237
+ for (const h of holes) h.delete();
238
+ }
256
239
  };
257
240
  /** Build a face from a compound sketch (outer boundary with holes). */
258
241
  function compoundSketchFace(sketch) {
@@ -270,8 +253,8 @@ function compoundSketchWires(sketch) {
270
253
  */
271
254
  function compoundSketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
272
255
  const extrusionVec = require_vecOps.vecScale(require_vecOps.vecNormalize(extrusionDirection ? require_types.toVec3(extrusionDirection) : sketch.outerSketch.defaultDirection), extrusionDistance);
273
- if (extrusionProfile && !twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => require_loftFns.complexExtrude(s.wire, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
274
- if (twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => require_loftFns.twistExtrude(s.wire, twistAngle, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
256
+ if (extrusionProfile && !twistAngle) return holedSweptSolid(sketch.sketches, (s) => require_loftFns.complexExtrude(s.wire, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
257
+ if (twistAngle) return holedSweptSolid(sketch.sketches, (s) => require_loftFns.twistExtrude(s.wire, twistAngle, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
275
258
  return require_errors.unwrap(require_loftFns.extrude(compoundSketchFace(sketch), extrusionVec));
276
259
  }
277
260
  /** Revolve a compound sketch (outer + holes) around an axis. */
@@ -1,14 +1,14 @@
1
- import { Z as getKernel, o as createFace, p as isFace, u as createWire } from "./shapeTypes-D4Evnmz_.js";
2
- import { A as ok, R as unwrap, T as isOk, b as err, h as bug, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
1
+ import { o as createFace, u as createWire } from "./shapeTypes-D4Evnmz_.js";
2
+ import { A as ok, R as unwrap, b as err, h as bug, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
3
3
  import { r as toVec3 } from "./types-D24Y27N0.js";
4
4
  import { d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-SKPRvPH-.js";
5
5
  import { n as createPlane } from "./planeOps-DSjjtrjg.js";
6
- import { _ as cast, v as downcast } from "./faceFns-BO8IXhhf.js";
6
+ import { v as downcast } from "./faceFns-BO8IXhhf.js";
7
7
  import { l as curveStartPoint, u as curveTangentAt } from "./curveFns-XSz4F9j3.js";
8
8
  import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
9
9
  import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-CLMyFimy.js";
10
- import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-BJn6P9IX.js";
11
- import { o as makeSolid, t as makeCompound } from "./solidBuilders-CgPOdC3Q.js";
10
+ import { o as makeSolid, p as cutAll, t as makeCompound } from "./solidBuilders-QUpJdbiK.js";
11
+ import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CIydRzRr.js";
12
12
  import { a as revolve, d as twistExtrude, o as complexExtrude, r as extrude, t as loft, u as sweep } from "./loftFns-BVbzy6gm.js";
13
13
  import opentype from "opentype.js";
14
14
  //#region src/sketching/compoundSketch.ts
@@ -182,45 +182,28 @@ function sketchLoft(sketch, otherSketches, loftConfig = {}, returnShell = false)
182
182
  });
183
183
  return shape;
184
184
  }
185
- var guessFaceFromWires = (wires) => {
186
- const wireShapes = wires.map((w) => w.wrapped);
187
- const newFace = unwrap(cast(getKernel().fillSurface(wireShapes)));
188
- if (!isFace(newFace)) bug("guessFaceFromWires", "Failed to create a face");
189
- return newFace;
190
- };
191
- var fixWire = (wire, baseFace) => {
192
- return createWire(getKernel().fixWireOnFace(wire.wrapped, baseFace.wrapped, 1e-9));
193
- };
194
- var faceFromWires = (wires) => {
195
- let baseFace;
196
- let holeWires;
197
- const faceResult = makeFace(firstOrThrow(wires));
198
- if (isOk(faceResult)) {
199
- baseFace = faceResult.value;
200
- holeWires = wires.slice(1);
201
- } else {
202
- baseFace = guessFaceFromWires(wires);
203
- holeWires = wires.slice(1).map((w) => fixWire(w, baseFace));
204
- }
205
- return addHolesInFace(baseFace, holeWires);
206
- };
207
- var solidFromShellGenerator = (sketches, shellGenerator) => {
208
- const shells = [];
209
- const startWires = [];
210
- const endWires = [];
211
- sketches.forEach((sketch) => {
212
- const [shell, startWire, endWire] = unwrap(shellGenerator(sketch));
213
- shells.push(shell);
214
- startWires.push(startWire);
215
- endWires.push(endWire);
216
- });
217
- const startFace = faceFromWires(startWires);
218
- const endFace = faceFromWires(endWires);
219
- return unwrap(makeSolid([
220
- startFace,
221
- ...shells,
222
- endFace
223
- ]));
185
+ /**
186
+ * Build a holed twist/profile-extruded solid by extruding the outer boundary
187
+ * and each hole wire as independent solids, then boolean-subtracting the holes.
188
+ *
189
+ * A single-wire twist/profile sweep already yields a valid, consistently-
190
+ * oriented solid. The previous approach assembled the per-wire lateral *shells*
191
+ * plus shared caps into one solid, which produced an inconsistently-oriented
192
+ * (invalid) result whose signed volume even flipped sign between occt-wasm
193
+ * versions — the cause of the #1366 twist/profile compound-extrude failure
194
+ * under occt-wasm 3.3.0. Subtracting valid solids is robust to kernel
195
+ * orientation conventions.
196
+ */
197
+ var holedSweptSolid = (sketches, solidGenerator) => {
198
+ const outer = unwrap(solidGenerator(firstOrThrow(sketches)));
199
+ const holes = sketches.slice(1).map((s) => unwrap(solidGenerator(s)));
200
+ if (holes.length === 0) return outer;
201
+ try {
202
+ return unwrap(cutAll(outer, holes, { unsafe: true }));
203
+ } finally {
204
+ outer.delete();
205
+ for (const h of holes) h.delete();
206
+ }
224
207
  };
225
208
  /** Build a face from a compound sketch (outer boundary with holes). */
226
209
  function compoundSketchFace(sketch) {
@@ -238,8 +221,8 @@ function compoundSketchWires(sketch) {
238
221
  */
239
222
  function compoundSketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
240
223
  const extrusionVec = vecScale(vecNormalize(extrusionDirection ? toVec3(extrusionDirection) : sketch.outerSketch.defaultDirection), extrusionDistance);
241
- if (extrusionProfile && !twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => complexExtrude(s.wire, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
242
- if (twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => twistExtrude(s.wire, twistAngle, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
224
+ if (extrusionProfile && !twistAngle) return holedSweptSolid(sketch.sketches, (s) => complexExtrude(s.wire, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
225
+ if (twistAngle) return holedSweptSolid(sketch.sketches, (s) => twistExtrude(s.wire, twistAngle, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
243
226
  return unwrap(extrude(compoundSketchFace(sketch), extrusionVec));
244
227
  }
245
228
  /** Revolve a compound sketch (outer + holes) around an axis. */
@@ -1,5 +1,5 @@
1
1
  import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
2
- import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-C03mB6SZ.js";
2
+ import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-f8cgx9vi.js";
3
3
  //#region src/text/sketchText.ts
4
4
  /**
5
5
  * Render text as 3D sketch outlines on a plane.
@@ -1,4 +1,4 @@
1
- const require_textBlueprints = require("./textBlueprints-C2INf1kF.cjs");
1
+ const require_textBlueprints = require("./textBlueprints-D4pLmVno.cjs");
2
2
  const require_errors = require("./errors-CXJtc4I7.cjs");
3
3
  //#region src/text/sketchText.ts
4
4
  /**
@@ -3,8 +3,9 @@ import { A as ok, T as isOk, b as err, d as validationError, n as computationErr
3
3
  import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
4
4
  import { y as fromBREP } from "./faceFns-BO8IXhhf.js";
5
5
  import { s as toBREP } from "./shapeFns-B6UAiYAx.js";
6
- import { E as wire, M as fuseAll, h as line } from "./primitiveFns-CjL5bygY.js";
6
+ import { h as fuseAll } from "./solidBuilders-QUpJdbiK.js";
7
7
  import { t as loft } from "./loftFns-BVbzy6gm.js";
8
+ import { E as wire, h as line } from "./primitiveFns-DkuLOFkI.js";
8
9
  //#region src/utils/uuid.ts
9
10
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
10
11
  function uuidv() {
@@ -3,8 +3,9 @@ const require_errors = require("./errors-CXJtc4I7.cjs");
3
3
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
4
4
  const require_faceFns = require("./faceFns-6AarivqH.cjs");
5
5
  const require_shapeFns = require("./shapeFns-sF0x5Zhj.cjs");
6
- const require_primitiveFns = require("./primitiveFns-LWkd7M2f.cjs");
6
+ const require_solidBuilders = require("./solidBuilders-lDXPwoCz.cjs");
7
7
  const require_loftFns = require("./loftFns-DxhcdpAu.cjs");
8
+ const require_primitiveFns = require("./primitiveFns-BPfYb_t5.cjs");
8
9
  //#region src/utils/uuid.ts
9
10
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
10
11
  function uuidv() {
@@ -128,7 +129,7 @@ function linearPattern(shape, direction, count, spacing, options) {
128
129
  if (count === 1) return require_errors.ok(shape);
129
130
  if (require_vecOps.vecIsZero(direction)) return require_errors.err(require_errors.validationError("PATTERN_ZERO_DIRECTION", "Pattern direction cannot be zero"));
130
131
  const dir = require_vecOps.vecNormalize(direction);
131
- return require_primitiveFns.fuseAll(require_shapeTypes.getKernel().linearPattern(shape.wrapped, [...dir], spacing, count).map((s) => require_shapeTypes.castShape(s)), {
132
+ return require_solidBuilders.fuseAll(require_shapeTypes.getKernel().linearPattern(shape.wrapped, [...dir], spacing, count).map((s) => require_shapeTypes.castShape(s)), {
132
133
  optimisation: "sameFace",
133
134
  ...options,
134
135
  unsafe: true
@@ -154,7 +155,7 @@ function circularPattern(shape, axis, count, fullAngle = 360, center = [
154
155
  if (count === 1) return require_errors.ok(shape);
155
156
  if (require_vecOps.vecIsZero(axis)) return require_errors.err(require_errors.validationError("PATTERN_ZERO_AXIS", "Pattern axis cannot be zero"));
156
157
  const angleStep = fullAngle / count;
157
- return require_primitiveFns.fuseAll(require_shapeTypes.getKernel().circularPattern(shape.wrapped, [...center], [...axis], angleStep, count).map((s) => require_shapeTypes.castShape(s)), {
158
+ return require_solidBuilders.fuseAll(require_shapeTypes.getKernel().circularPattern(shape.wrapped, [...center], [...axis], angleStep, count).map((s) => require_shapeTypes.castShape(s)), {
158
159
  optimisation: "sameFace",
159
160
  ...options,
160
161
  unsafe: true
package/dist/topology.cjs CHANGED
@@ -4,8 +4,9 @@ const require_faceFns = require("./faceFns-6AarivqH.cjs");
4
4
  const require_shapeFns = require("./shapeFns-sF0x5Zhj.cjs");
5
5
  const require_curveFns = require("./curveFns-BA5zsoce.cjs");
6
6
  const require_meshFns = require("./meshFns-YXFipjjx.cjs");
7
- const require_primitiveFns = require("./primitiveFns-LWkd7M2f.cjs");
8
- const require_healingFns = require("./healingFns-MxlhdTIc.cjs");
7
+ const require_solidBuilders = require("./solidBuilders-lDXPwoCz.cjs");
8
+ const require_healingFns = require("./healingFns-D3BkAVML.cjs");
9
+ const require_primitiveFns = require("./primitiveFns-BPfYb_t5.cjs");
9
10
  exports.addHoles = require_primitiveFns.addHoles;
10
11
  exports.adjacentFaces = require_healingFns.adjacentFaces;
11
12
  exports.approximateCurve = require_curveFns.approximateCurve;
@@ -33,7 +34,7 @@ exports.curvePeriod = require_curveFns.curvePeriod;
33
34
  exports.curvePointAt = require_curveFns.curvePointAt;
34
35
  exports.curveStartPoint = require_curveFns.curveStartPoint;
35
36
  exports.curveTangentAt = require_curveFns.curveTangentAt;
36
- exports.cutAll = require_primitiveFns.cutAll;
37
+ exports.cutAll = require_solidBuilders.cutAll;
37
38
  exports.cutAllBisect = require_healingFns.cutAllBisect;
38
39
  exports.cutWithEvolution = require_healingFns.cutWithEvolution;
39
40
  exports.cylinder = require_primitiveFns.cylinder;
@@ -58,7 +59,7 @@ exports.fixSelfIntersection = require_healingFns.fixSelfIntersection;
58
59
  exports.fixShape = require_healingFns.fixShape;
59
60
  exports.flipFaceOrientation = require_faceFns.flipFaceOrientation;
60
61
  exports.flipOrientation = require_curveFns.flipOrientation;
61
- exports.fuseAll = require_primitiveFns.fuseAll;
62
+ exports.fuseAll = require_solidBuilders.fuseAll;
62
63
  exports.fuseAllBisect = require_healingFns.fuseAllBisect;
63
64
  exports.fuseWithEvolution = require_healingFns.fuseWithEvolution;
64
65
  exports.getBounds = require_topologyQueryFns.getBounds;
package/dist/topology.js CHANGED
@@ -3,6 +3,7 @@ import { S as shapeType, _ as cast, a as faceOrientation, b as isCompSolid, c as
3
3
  import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-B6UAiYAx.js";
4
4
  import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-XSz4F9j3.js";
5
5
  import { c as createMeshCache, n as exportSTEP, r as exportSTL, s as clearMeshCache, t as exportIGES } from "./meshFns-CWwOpBlM.js";
6
- import { A as cutAll, C as threePointArc, D as wireLoop, E as wire, M as fuseAll, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-CjL5bygY.js";
7
- import { A as edgesOfFace, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as chamferDistAngle, I as toBufferGeometryData, L as toGroupedBufferGeometryData, M as sharedEdges, N as verticesOfEdge, O as getNurbsSurfaceData, P as wiresOfFace, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-Ct_-O3yk.js";
6
+ import { h as fuseAll, p as cutAll } from "./solidBuilders-QUpJdbiK.js";
7
+ import { A as edgesOfFace, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as chamferDistAngle, I as toBufferGeometryData, L as toGroupedBufferGeometryData, M as sharedEdges, N as verticesOfEdge, O as getNurbsSurfaceData, P as wiresOfFace, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-C4JZHv8K.js";
8
+ import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-DkuLOFkI.js";
8
9
  export { addHoles, adjacentFaces, approximateCurve, asTopo, autoHeal, bezier, box, bsplineApprox, cast, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkBoolean, circle, classifyPointOnFace, clearMeshCache, compound, cone, createMeshCache, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cutAll, cutAllBisect, cutWithEvolution, cylinder, fromBREP as deserializeShape, downcast, edgesOfFace, ellipse, ellipseArc, ellipsoid, exportIGES, exportSTEP, exportSTL, face, faceAxis, faceCenter, faceGeomType, faceOrientation, facesOfEdge, filledFace, filletWithEvolution, fixSelfIntersection, fixShape, flipFaceOrientation, flipOrientation, fuseAll, fuseAllBisect, fuseWithEvolution, getBounds, getCurveType, getEdges, getFaces, getHashCode, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getSurfaceType, getVertices, getWires, healFace, healSolid, healWire, helix, innerWires, interpolateCurve, intersectWithEvolution, invalidateShapeCache, isCompSolid, isEqualShape, isSameShape, iterEdges, iterFaces, iterTopo, iterVertices, iterWires, line, normalAt, offsetFace, offsetWire2D, outerWire, pointOnSurface, polygon, positionOnCurve, projectPointOnFace, sewShells, shapeType, sharedEdges, shellWithEvolution, solid, solidFromShell, sphere, subFace, tangentArc, threePointArc, toBufferGeometryData, toGroupedBufferGeometryData, toLineGeometryData, torus, uvBounds, uvCoordinates, variableFillet, vertex, vertexPosition, verticesOfEdge, wire, wireLoop, wiresOfFace };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs",
3
- "version": "18.82.3",
3
+ "version": "18.82.5",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",
@@ -1,140 +0,0 @@
1
- import { Z as getKernel, _ as isSolid, c as createSolid, g as isShell, h as isShape3D, i as createCompound, l as createVertex } from "./shapeTypes-D4Evnmz_.js";
2
- import { A as ok, R as unwrap, b as err, l as typeCastError, v as andThen } from "./errors-DNWJsfVU.js";
3
- import { _ as cast, v as downcast } from "./faceFns-BO8IXhhf.js";
4
- //#region src/topology/shapeUtils.ts
5
- /**
6
- * Shape assembly utilities — welding and sewing operations.
7
- */
8
- /** Sew faces/shells into a single shape using the kernel's sewing algorithm. */
9
- function weldShapes(facesOrShells) {
10
- return unwrap(cast(unwrap(downcast(getKernel().sew(facesOrShells.map((s) => s.wrapped))))));
11
- }
12
- /**
13
- * Welds faces and shells into a single shell.
14
- *
15
- * @param facesOrShells - An array of faces and shells to be welded.
16
- * @param ignoreType - If true, the function will not check if the result is a shell.
17
- * @returns A shell that contains all the faces and shells.
18
- */
19
- function weldShellsAndFaces(facesOrShells, ignoreType = false) {
20
- const shell = weldShapes(facesOrShells);
21
- if (!ignoreType && !isShell(shell)) return err(typeCastError("WELD_NOT_SHELL", "Could not make a shell from faces and shells"));
22
- return ok(shell);
23
- }
24
- //#endregion
25
- //#region src/topology/solidBuilders.ts
26
- /**
27
- * Solid and primitive construction helpers — boxes, cylinders, spheres, cones,
28
- * tori, ellipsoids, vertices, compounds, and offsets.
29
- */
30
- /**
31
- * Creates a cylinder with the given radius and height.
32
- *
33
- * @category Solids
34
- */
35
- function makeCylinder(radius, height, location = [
36
- 0,
37
- 0,
38
- 0
39
- ], direction = [
40
- 0,
41
- 0,
42
- 1
43
- ]) {
44
- return createSolid(getKernel().makeCylinder(radius, height, [...location], [...direction]));
45
- }
46
- /**
47
- * Creates a sphere with the given radius.
48
- *
49
- * @category Solids
50
- */
51
- function makeSphere(radius) {
52
- return createSolid(getKernel().makeSphere(radius));
53
- }
54
- /**
55
- * Creates a cone (or frustum) with the given radii and height.
56
- *
57
- * @category Solids
58
- */
59
- function makeCone(radius1, radius2, height, location = [
60
- 0,
61
- 0,
62
- 0
63
- ], direction = [
64
- 0,
65
- 0,
66
- 1
67
- ]) {
68
- return createSolid(getKernel().makeCone(radius1, radius2, height, [...location], [...direction]));
69
- }
70
- /**
71
- * Creates a torus with the given major and minor radii.
72
- *
73
- * @category Solids
74
- */
75
- function makeTorus(majorRadius, minorRadius, location = [
76
- 0,
77
- 0,
78
- 0
79
- ], direction = [
80
- 0,
81
- 0,
82
- 1
83
- ]) {
84
- return createSolid(getKernel().makeTorus(majorRadius, minorRadius, [...location], [...direction]));
85
- }
86
- /**
87
- * Creates an ellipsoid with the given axis lengths.
88
- *
89
- * The algorithm creates a unit BSpline sphere surface, transforms its
90
- * control-point poles with an affinity matrix to match the requested
91
- * axis half-lengths, then sews the result into a solid.
92
- *
93
- * @category Solids
94
- */
95
- function makeEllipsoid(aLength, bLength, cLength) {
96
- return createSolid(getKernel().makeEllipsoid(aLength, bLength, cLength));
97
- }
98
- /** Create a vertex at a 3D point. */
99
- function makeVertex(point) {
100
- return createVertex(getKernel().makeVertex(point[0], point[1], point[2]));
101
- }
102
- /**
103
- * Create an offset shape from a face.
104
- *
105
- * @param offset - Signed offset distance (positive = outward).
106
- * @param tolerance - Geometric tolerance for the offset algorithm.
107
- * @returns An error if the result is not a valid 3D shape.
108
- */
109
- function makeOffset(face, offset, tolerance = 1e-6) {
110
- return andThen(downcast(getKernel().offset(face.wrapped, offset, tolerance)), (downcasted) => andThen(cast(downcasted), (newShape) => {
111
- if (!isShape3D(newShape)) return err(typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
112
- return ok(newShape);
113
- }));
114
- }
115
- /**
116
- * Build a compound from multiple shapes.
117
- *
118
- * @param shapeArray - Shapes to group into a single compound.
119
- * @returns A new Compound containing all input shapes.
120
- */
121
- function makeCompound(shapeArray) {
122
- return createCompound(getKernel().makeCompound(shapeArray.map((s) => s.wrapped)));
123
- }
124
- /**
125
- * Welds faces and shells into a single shell and then makes a solid.
126
- *
127
- * @param facesOrShells - An array of faces and shells to be welded.
128
- * @returns A solid that contains all the faces and shells.
129
- *
130
- * @category Solids
131
- */
132
- function makeSolid(facesOrShells) {
133
- const shell = weldShapes(facesOrShells);
134
- return andThen(cast(getKernel().solidFromShell(shell.wrapped)), (solid) => {
135
- if (!isSolid(solid)) return err(typeCastError("SOLID_BUILD_FAILED", "Could not make a solid of faces and shells"));
136
- return ok(solid);
137
- });
138
- }
139
- //#endregion
140
- export { makeOffset as a, makeTorus as c, makeEllipsoid as i, makeVertex as l, makeCone as n, makeSolid as o, makeCylinder as r, makeSphere as s, makeCompound as t, weldShellsAndFaces as u };
@@ -1,199 +0,0 @@
1
- const require_shapeTypes = require("./shapeTypes-D1eUDuzl.cjs");
2
- const require_errors = require("./errors-CXJtc4I7.cjs");
3
- const require_faceFns = require("./faceFns-6AarivqH.cjs");
4
- //#region src/topology/shapeUtils.ts
5
- /**
6
- * Shape assembly utilities — welding and sewing operations.
7
- */
8
- /** Sew faces/shells into a single shape using the kernel's sewing algorithm. */
9
- function weldShapes(facesOrShells) {
10
- return require_errors.unwrap(require_faceFns.cast(require_errors.unwrap(require_faceFns.downcast(require_shapeTypes.getKernel().sew(facesOrShells.map((s) => s.wrapped))))));
11
- }
12
- /**
13
- * Welds faces and shells into a single shell.
14
- *
15
- * @param facesOrShells - An array of faces and shells to be welded.
16
- * @param ignoreType - If true, the function will not check if the result is a shell.
17
- * @returns A shell that contains all the faces and shells.
18
- */
19
- function weldShellsAndFaces(facesOrShells, ignoreType = false) {
20
- const shell = weldShapes(facesOrShells);
21
- if (!ignoreType && !require_shapeTypes.isShell(shell)) return require_errors.err(require_errors.typeCastError("WELD_NOT_SHELL", "Could not make a shell from faces and shells"));
22
- return require_errors.ok(shell);
23
- }
24
- //#endregion
25
- //#region src/topology/solidBuilders.ts
26
- /**
27
- * Solid and primitive construction helpers — boxes, cylinders, spheres, cones,
28
- * tori, ellipsoids, vertices, compounds, and offsets.
29
- */
30
- /**
31
- * Creates a cylinder with the given radius and height.
32
- *
33
- * @category Solids
34
- */
35
- function makeCylinder(radius, height, location = [
36
- 0,
37
- 0,
38
- 0
39
- ], direction = [
40
- 0,
41
- 0,
42
- 1
43
- ]) {
44
- return require_shapeTypes.createSolid(require_shapeTypes.getKernel().makeCylinder(radius, height, [...location], [...direction]));
45
- }
46
- /**
47
- * Creates a sphere with the given radius.
48
- *
49
- * @category Solids
50
- */
51
- function makeSphere(radius) {
52
- return require_shapeTypes.createSolid(require_shapeTypes.getKernel().makeSphere(radius));
53
- }
54
- /**
55
- * Creates a cone (or frustum) with the given radii and height.
56
- *
57
- * @category Solids
58
- */
59
- function makeCone(radius1, radius2, height, location = [
60
- 0,
61
- 0,
62
- 0
63
- ], direction = [
64
- 0,
65
- 0,
66
- 1
67
- ]) {
68
- return require_shapeTypes.createSolid(require_shapeTypes.getKernel().makeCone(radius1, radius2, height, [...location], [...direction]));
69
- }
70
- /**
71
- * Creates a torus with the given major and minor radii.
72
- *
73
- * @category Solids
74
- */
75
- function makeTorus(majorRadius, minorRadius, location = [
76
- 0,
77
- 0,
78
- 0
79
- ], direction = [
80
- 0,
81
- 0,
82
- 1
83
- ]) {
84
- return require_shapeTypes.createSolid(require_shapeTypes.getKernel().makeTorus(majorRadius, minorRadius, [...location], [...direction]));
85
- }
86
- /**
87
- * Creates an ellipsoid with the given axis lengths.
88
- *
89
- * The algorithm creates a unit BSpline sphere surface, transforms its
90
- * control-point poles with an affinity matrix to match the requested
91
- * axis half-lengths, then sews the result into a solid.
92
- *
93
- * @category Solids
94
- */
95
- function makeEllipsoid(aLength, bLength, cLength) {
96
- return require_shapeTypes.createSolid(require_shapeTypes.getKernel().makeEllipsoid(aLength, bLength, cLength));
97
- }
98
- /** Create a vertex at a 3D point. */
99
- function makeVertex(point) {
100
- return require_shapeTypes.createVertex(require_shapeTypes.getKernel().makeVertex(point[0], point[1], point[2]));
101
- }
102
- /**
103
- * Create an offset shape from a face.
104
- *
105
- * @param offset - Signed offset distance (positive = outward).
106
- * @param tolerance - Geometric tolerance for the offset algorithm.
107
- * @returns An error if the result is not a valid 3D shape.
108
- */
109
- function makeOffset(face, offset, tolerance = 1e-6) {
110
- return require_errors.andThen(require_faceFns.downcast(require_shapeTypes.getKernel().offset(face.wrapped, offset, tolerance)), (downcasted) => require_errors.andThen(require_faceFns.cast(downcasted), (newShape) => {
111
- if (!require_shapeTypes.isShape3D(newShape)) return require_errors.err(require_errors.typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
112
- return require_errors.ok(newShape);
113
- }));
114
- }
115
- /**
116
- * Build a compound from multiple shapes.
117
- *
118
- * @param shapeArray - Shapes to group into a single compound.
119
- * @returns A new Compound containing all input shapes.
120
- */
121
- function makeCompound(shapeArray) {
122
- return require_shapeTypes.createCompound(require_shapeTypes.getKernel().makeCompound(shapeArray.map((s) => s.wrapped)));
123
- }
124
- /**
125
- * Welds faces and shells into a single shell and then makes a solid.
126
- *
127
- * @param facesOrShells - An array of faces and shells to be welded.
128
- * @returns A solid that contains all the faces and shells.
129
- *
130
- * @category Solids
131
- */
132
- function makeSolid(facesOrShells) {
133
- const shell = weldShapes(facesOrShells);
134
- return require_errors.andThen(require_faceFns.cast(require_shapeTypes.getKernel().solidFromShell(shell.wrapped)), (solid) => {
135
- if (!require_shapeTypes.isSolid(solid)) return require_errors.err(require_errors.typeCastError("SOLID_BUILD_FAILED", "Could not make a solid of faces and shells"));
136
- return require_errors.ok(solid);
137
- });
138
- }
139
- //#endregion
140
- Object.defineProperty(exports, "makeCompound", {
141
- enumerable: true,
142
- get: function() {
143
- return makeCompound;
144
- }
145
- });
146
- Object.defineProperty(exports, "makeCone", {
147
- enumerable: true,
148
- get: function() {
149
- return makeCone;
150
- }
151
- });
152
- Object.defineProperty(exports, "makeCylinder", {
153
- enumerable: true,
154
- get: function() {
155
- return makeCylinder;
156
- }
157
- });
158
- Object.defineProperty(exports, "makeEllipsoid", {
159
- enumerable: true,
160
- get: function() {
161
- return makeEllipsoid;
162
- }
163
- });
164
- Object.defineProperty(exports, "makeOffset", {
165
- enumerable: true,
166
- get: function() {
167
- return makeOffset;
168
- }
169
- });
170
- Object.defineProperty(exports, "makeSolid", {
171
- enumerable: true,
172
- get: function() {
173
- return makeSolid;
174
- }
175
- });
176
- Object.defineProperty(exports, "makeSphere", {
177
- enumerable: true,
178
- get: function() {
179
- return makeSphere;
180
- }
181
- });
182
- Object.defineProperty(exports, "makeTorus", {
183
- enumerable: true,
184
- get: function() {
185
- return makeTorus;
186
- }
187
- });
188
- Object.defineProperty(exports, "makeVertex", {
189
- enumerable: true,
190
- get: function() {
191
- return makeVertex;
192
- }
193
- });
194
- Object.defineProperty(exports, "weldShellsAndFaces", {
195
- enumerable: true,
196
- get: function() {
197
- return weldShellsAndFaces;
198
- }
199
- });