brepjs 18.118.27 → 18.118.28

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 (29) hide show
  1. package/dist/brepjs.cjs +13 -11
  2. package/dist/brepjs.js +13 -11
  3. package/dist/{drawFns-BfV2OJo2.js → drawFns-CDBjUHVb.js} +1 -1
  4. package/dist/{drawFns-C0X-tUUn.cjs → drawFns-DOY9mr5Z.cjs} +1 -1
  5. package/dist/{healingFns-BsVhf71B.js → healingFns-CotWNIRj.js} +17 -5
  6. package/dist/{healingFns-DWxiSNvM.cjs → healingFns-l6bwWSeW.cjs} +17 -5
  7. package/dist/{importFns-BxxISnBH.cjs → importFns-Bd3Gbhns.cjs} +11 -3
  8. package/dist/{importFns-DeYLnFtg.js → importFns-BogytVsi.js} +12 -4
  9. package/dist/io.cjs +1 -1
  10. package/dist/io.js +1 -1
  11. package/dist/operations.cjs +1 -1
  12. package/dist/operations.js +1 -1
  13. package/dist/{primitiveFns-lDxs8cQj.js → primitiveFns-CFsKqdgs.js} +1 -1
  14. package/dist/{primitiveFns-88hMNirE.cjs → primitiveFns-K6hrkt3N.cjs} +1 -1
  15. package/dist/sketching.cjs +2 -2
  16. package/dist/sketching.js +2 -2
  17. package/dist/{solidBuilders-Dbvfcb5n.cjs → solidBuilders-CmZoQG9B.cjs} +40 -14
  18. package/dist/{solidBuilders-DDJPSm_r.js → solidBuilders-Du0AWYAo.js} +40 -14
  19. package/dist/text.cjs +2 -2
  20. package/dist/text.js +2 -2
  21. package/dist/{textBlueprints-CBs85Hp1.js → textBlueprints-C7mPkR_V.js} +1 -1
  22. package/dist/{textBlueprints-CAEJrQNw.cjs → textBlueprints-DKmwMA8f.cjs} +1 -1
  23. package/dist/{textMetrics-CyftuV1-.js → textMetrics-BfcRSP3_.js} +1 -1
  24. package/dist/{textMetrics-ButioWqV.cjs → textMetrics-DnsFQg5k.cjs} +1 -1
  25. package/dist/{threadFns-ClqTSJHJ.cjs → threadFns-82vx0u7T.cjs} +2 -2
  26. package/dist/{threadFns-DJjHonF8.js → threadFns-DohGvjbS.js} +2 -2
  27. package/dist/topology.cjs +3 -3
  28. package/dist/topology.js +3 -3
  29. package/package.json +1 -1
package/dist/brepjs.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_textBlueprints = require("./textBlueprints-CAEJrQNw.cjs");
2
+ const require_textBlueprints = require("./textBlueprints-DKmwMA8f.cjs");
3
3
  const require_shapeTypes = require("./shapeTypes-CIbdFdRS.cjs");
4
4
  const require_occtWasmAdapter = require("./occtWasmAdapter-Hkzb95Fy.cjs");
5
5
  const require_bug = require("./bug-O02CsAmt.cjs");
@@ -15,24 +15,24 @@ const require_curveFns = require("./curveFns-CRs4VDhr.cjs");
15
15
  const require_meshFns = require("./meshFns-C7DDfJw0.cjs");
16
16
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
17
17
  const require_surfaceBuilders = require("./surfaceBuilders-DOFKdphI.cjs");
18
- const require_solidBuilders = require("./solidBuilders-Dbvfcb5n.cjs");
19
- const require_healingFns = require("./healingFns-DWxiSNvM.cjs");
20
- const require_threadFns = require("./threadFns-ClqTSJHJ.cjs");
18
+ const require_solidBuilders = require("./solidBuilders-CmZoQG9B.cjs");
19
+ const require_healingFns = require("./healingFns-l6bwWSeW.cjs");
20
+ const require_threadFns = require("./threadFns-82vx0u7T.cjs");
21
21
  const require_blueprintSketcher = require("./blueprintSketcher-BSo04hhn.cjs");
22
22
  const require_helpers = require("./helpers-CPSIFLtb.cjs");
23
- const require_drawFns = require("./drawFns-C0X-tUUn.cjs");
23
+ const require_drawFns = require("./drawFns-DOY9mr5Z.cjs");
24
24
  const require_measureFns = require("./measureFns-fWkCTxyQ.cjs");
25
25
  const require_cornerFinder = require("./cornerFinder-2ET6TfY3.cjs");
26
26
  const require_boolean2D = require("./boolean2D-HvEktvx_.cjs");
27
27
  const require_blueprintFns = require("./blueprintFns-dNGzyZoB.cjs");
28
- const require_importFns = require("./importFns-BxxISnBH.cjs");
28
+ const require_importFns = require("./importFns-Bd3Gbhns.cjs");
29
29
  const require_loftFns = require("./loftFns-Imv8iEGt.cjs");
30
30
  const require_cameraFns = require("./cameraFns-BWgU6410.cjs");
31
- const require_textMetrics = require("./textMetrics-ButioWqV.cjs");
31
+ const require_textMetrics = require("./textMetrics-DnsFQg5k.cjs");
32
32
  const require_adjacencyFns = require("./adjacencyFns-einnpj1f.cjs");
33
33
  const require_refResolveFns = require("./refResolveFns-B_iE18HK.cjs");
34
34
  const require_workerPool = require("./workerPool-D30NsiIW.cjs");
35
- const require_primitiveFns = require("./primitiveFns-88hMNirE.cjs");
35
+ const require_primitiveFns = require("./primitiveFns-K6hrkt3N.cjs");
36
36
  //#region src/topology/shapeBooleans.ts
37
37
  var BOPAlgo_GlueShift = 1;
38
38
  var BOPAlgo_GlueFull = 2;
@@ -3041,7 +3041,9 @@ function sewMeshToSolid(triangles, errorCode, tolerance = 1e-6) {
3041
3041
  }
3042
3042
  if (triFaces.length === 0) return require_errors.err(require_errors.ioError(errorCode, "No valid triangular faces could be built"));
3043
3043
  try {
3044
- return require_errors.ok(require_shapeTypes.castShape(kernel.sewAndSolidify(triFaces, tolerance)));
3044
+ const cast = require_shapeTypes.castResultShape(kernel.sewAndSolidify(triFaces, tolerance));
3045
+ for (const triFace of triFaces) kernel.dispose(triFace);
3046
+ return require_errors.ok(cast);
3045
3047
  } catch {
3046
3048
  try {
3047
3049
  return require_errors.ok(require_shapeTypes.castShape(kernel.sew(triFaces, tolerance)));
@@ -3352,7 +3354,7 @@ function buildSolidFromMesh(mesh) {
3352
3354
  }));
3353
3355
  const faces = mesh.triangles;
3354
3356
  try {
3355
- return require_errors.ok(require_shapeTypes.castShape(kernel.buildSolidFromFaces(points, faces, 1e-6)));
3357
+ return require_errors.ok(require_shapeTypes.castResultShape(kernel.buildSolidFromFaces(points, faces, 1e-6)));
3356
3358
  } catch {
3357
3359
  const triangles = [];
3358
3360
  for (const [v1, v2, v3] of mesh.triangles) {
@@ -3424,7 +3426,7 @@ async function importThreeMF(blob) {
3424
3426
  async function importGLB(blob) {
3425
3427
  try {
3426
3428
  const data = await blob.arrayBuffer();
3427
- return require_errors.ok(require_shapeTypes.castShape(require_shapeTypes.getKernel().importGLB(data)));
3429
+ return require_errors.ok(require_shapeTypes.castResultShape(require_shapeTypes.getKernel().importGLB(data)));
3428
3430
  } catch (e) {
3429
3431
  const msg = e instanceof Error ? e.message : String(e);
3430
3432
  return require_errors.err(require_errors.ioError(require_errors.BrepErrorCode.GLB_IMPORT_FAILED, `Failed to import GLB: ${msg}`, e));
package/dist/brepjs.js CHANGED
@@ -13,25 +13,25 @@ import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as get
13
13
  import { a as meshEdges$1, c as meshMultiLOD, d as createMeshCache, i as mesh$1, l as buildMeshCacheKey, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as clearMeshCache } from "./meshFns-BwMrdyFV.js";
14
14
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
15
15
  import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-PnbuNC6X.js";
16
- import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-DDJPSm_r.js";
17
- import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, M as toLODGeometryData, N as toLODGeometryLevels, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as toGroupedBufferGeometryData, k as chamferDistAngle, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-BsVhf71B.js";
18
- import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatMultiply, G as circularPattern, H as removeChild, I as quatRotate, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-DJjHonF8.js";
16
+ import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-Du0AWYAo.js";
17
+ import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, M as toLODGeometryData, N as toLODGeometryLevels, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as toGroupedBufferGeometryData, k as chamferDistAngle, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-CotWNIRj.js";
18
+ import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatMultiply, G as circularPattern, H as removeChild, I as quatRotate, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-DohGvjbS.js";
19
19
  import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-9hdFqAKq.js";
20
20
  import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-D2e6tjMb.js";
21
- import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-BfV2OJo2.js";
21
+ import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-CDBjUHVb.js";
22
22
  import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-ByHzc8J2.js";
23
23
  import { t as cornerFinder } from "./cornerFinder-j6mm48kY.js";
24
24
  import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-hkBchHCX.js";
25
25
  import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-Dfw1xSJB.js";
26
- import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-DeYLnFtg.js";
26
+ import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-BogytVsi.js";
27
27
  import { a as revolve$1, c as multiSectionSweep, d as twistExtrude, i as extrudeAll, l as supportExtrude, n as loftAll, o as complexExtrude, r as extrude$1, s as guidedSweep, t as loft$1, u as sweep$1 } from "./loftFns-DPVVYGdV.js";
28
- import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-CBs85Hp1.js";
28
+ import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-C7mPkR_V.js";
29
29
  import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-tiRxjxGd.js";
30
- import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CyftuV1-.js";
30
+ import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-BfcRSP3_.js";
31
31
  import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-BkTS3Exp.js";
32
32
  import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-BOiwaoR6.js";
33
33
  import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
34
- import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, 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$1, x as subFace, y as solid } from "./primitiveFns-lDxs8cQj.js";
34
+ import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, 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$1, x as subFace, y as solid } from "./primitiveFns-CFsKqdgs.js";
35
35
  //#region \0rolldown/runtime.js
36
36
  var __defProp = Object.defineProperty;
37
37
  var __exportAll = (all, no_symbols) => {
@@ -3052,7 +3052,9 @@ function sewMeshToSolid(triangles, errorCode, tolerance = 1e-6) {
3052
3052
  }
3053
3053
  if (triFaces.length === 0) return err(ioError(errorCode, "No valid triangular faces could be built"));
3054
3054
  try {
3055
- return ok(castShape(kernel.sewAndSolidify(triFaces, tolerance)));
3055
+ const cast = castResultShape(kernel.sewAndSolidify(triFaces, tolerance));
3056
+ for (const triFace of triFaces) kernel.dispose(triFace);
3057
+ return ok(cast);
3056
3058
  } catch {
3057
3059
  try {
3058
3060
  return ok(castShape(kernel.sew(triFaces, tolerance)));
@@ -3363,7 +3365,7 @@ function buildSolidFromMesh(mesh) {
3363
3365
  }));
3364
3366
  const faces = mesh.triangles;
3365
3367
  try {
3366
- return ok(castShape(kernel.buildSolidFromFaces(points, faces, 1e-6)));
3368
+ return ok(castResultShape(kernel.buildSolidFromFaces(points, faces, 1e-6)));
3367
3369
  } catch {
3368
3370
  const triangles = [];
3369
3371
  for (const [v1, v2, v3] of mesh.triangles) {
@@ -3435,7 +3437,7 @@ async function importThreeMF(blob) {
3435
3437
  async function importGLB(blob) {
3436
3438
  try {
3437
3439
  const data = await blob.arrayBuffer();
3438
- return ok(castShape(getKernel().importGLB(data)));
3440
+ return ok(castResultShape(getKernel().importGLB(data)));
3439
3441
  } catch (e) {
3440
3442
  const msg = e instanceof Error ? e.message : String(e);
3441
3443
  return err(ioError(BrepErrorCode.GLB_IMPORT_FAILED, `Failed to import GLB: ${msg}`, e));
@@ -15,7 +15,7 @@ import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y
15
15
  import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-CQCMv1dT.js";
16
16
  import { t as cornerFinder } from "./cornerFinder-j6mm48kY.js";
17
17
  import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-hkBchHCX.js";
18
- import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-CBs85Hp1.js";
18
+ import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-C7mPkR_V.js";
19
19
  import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-tiRxjxGd.js";
20
20
  //#region src/2d/lib/stitching.ts
21
21
  /**
@@ -1,4 +1,4 @@
1
- const require_textBlueprints = require("./textBlueprints-CAEJrQNw.cjs");
1
+ const require_textBlueprints = require("./textBlueprints-DKmwMA8f.cjs");
2
2
  const require_shapeTypes = require("./shapeTypes-CIbdFdRS.cjs");
3
3
  const require_bug = require("./bug-O02CsAmt.cjs");
4
4
  const require_errors = require("./errors-CJU8CHng.cjs");
@@ -5,7 +5,7 @@ import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
5
5
  import { y as downcast } from "./faceFns-C0IqnONT.js";
6
6
  import { _ as collectInputFaceHashes, y as propagateAllMetadata } from "./shapeFns-tTkC3Ry7.js";
7
7
  import { t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
8
- import { f as cut, h as fuseAll, m as fuse, p as cutAll } from "./solidBuilders-DDJPSm_r.js";
8
+ import { f as cut, h as fuseAll, m as fuse, p as cutAll } from "./solidBuilders-Du0AWYAo.js";
9
9
  //#region src/topology/threeHelpers.ts
10
10
  /**
11
11
  * Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
@@ -747,7 +747,10 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
747
747
  const edgeShapes = filteredEdges.map((e) => e.wrapped);
748
748
  if (!trackEvolution) {
749
749
  const cast = castResultShape(getKernel().fillet(shape.wrapped, edgeShapes, kernelRadius));
750
- if (!isShape3D(cast)) return err(kernelError(BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
750
+ if (!isShape3D(cast)) {
751
+ disposeResultShape(cast);
752
+ return err(kernelError(BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
753
+ }
751
754
  return ok(cast);
752
755
  }
753
756
  const inputFaceHashes = collectInputFaceHashes([shape]);
@@ -820,13 +823,19 @@ function shell(shape, faces, thickness, tolerance = .001, { trackEvolution = tru
820
823
  try {
821
824
  if (!trackEvolution) {
822
825
  const cast = castResultShape(getKernel().shell(shape.wrapped, faces.map((f) => f.wrapped), thickness, tolerance));
823
- if (!isShape3D(cast)) return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
826
+ if (!isShape3D(cast)) {
827
+ disposeResultShape(cast);
828
+ return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
829
+ }
824
830
  return ok(cast);
825
831
  }
826
832
  const inputFaceHashes = collectInputFaceHashes([shape]);
827
833
  const { shape: resultShape, evolution } = getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, HASH_CODE_MAX, tolerance);
828
834
  const cast = castResultShape(resultShape);
829
- if (!isShape3D(cast)) return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
835
+ if (!isShape3D(cast)) {
836
+ disposeResultShape(cast);
837
+ return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
838
+ }
830
839
  propagateAllMetadata(evolution, [shape], cast);
831
840
  return ok(cast);
832
841
  } catch (e) {
@@ -852,7 +861,10 @@ function offset(shape, distance, tolerance = 1e-6) {
852
861
  const inputFaceHashes = collectInputFaceHashes([shape]);
853
862
  const { shape: resultShape, evolution } = getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, HASH_CODE_MAX, tolerance);
854
863
  const cast = castResultShape(resultShape);
855
- if (!isShape3D(cast)) return err(kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
864
+ if (!isShape3D(cast)) {
865
+ disposeResultShape(cast);
866
+ return err(kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
867
+ }
856
868
  propagateAllMetadata(evolution, [shape], cast);
857
869
  return ok(cast);
858
870
  } catch (e) {
@@ -5,7 +5,7 @@ const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  const require_faceFns = require("./faceFns-5_JXMBDb.cjs");
6
6
  const require_shapeFns = require("./shapeFns-BZu0MAZ5.cjs");
7
7
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
8
- const require_solidBuilders = require("./solidBuilders-Dbvfcb5n.cjs");
8
+ const require_solidBuilders = require("./solidBuilders-CmZoQG9B.cjs");
9
9
  //#region src/topology/threeHelpers.ts
10
10
  /**
11
11
  * Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
@@ -747,7 +747,10 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
747
747
  const edgeShapes = filteredEdges.map((e) => e.wrapped);
748
748
  if (!trackEvolution) {
749
749
  const cast = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().fillet(shape.wrapped, edgeShapes, kernelRadius));
750
- if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
750
+ if (!require_shapeTypes.isShape3D(cast)) {
751
+ require_shapeTypes.disposeResultShape(cast);
752
+ return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
753
+ }
751
754
  return require_errors.ok(cast);
752
755
  }
753
756
  const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
@@ -820,13 +823,19 @@ function shell(shape, faces, thickness, tolerance = .001, { trackEvolution = tru
820
823
  try {
821
824
  if (!trackEvolution) {
822
825
  const cast = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().shell(shape.wrapped, faces.map((f) => f.wrapped), thickness, tolerance));
823
- if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
826
+ if (!require_shapeTypes.isShape3D(cast)) {
827
+ require_shapeTypes.disposeResultShape(cast);
828
+ return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
829
+ }
824
830
  return require_errors.ok(cast);
825
831
  }
826
832
  const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
827
833
  const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
828
834
  const cast = require_shapeTypes.castResultShape(resultShape);
829
- if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
835
+ if (!require_shapeTypes.isShape3D(cast)) {
836
+ require_shapeTypes.disposeResultShape(cast);
837
+ return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
838
+ }
830
839
  require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
831
840
  return require_errors.ok(cast);
832
841
  } catch (e) {
@@ -852,7 +861,10 @@ function offset(shape, distance, tolerance = 1e-6) {
852
861
  const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
853
862
  const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
854
863
  const cast = require_shapeTypes.castResultShape(resultShape);
855
- if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
864
+ if (!require_shapeTypes.isShape3D(cast)) {
865
+ require_shapeTypes.disposeResultShape(cast);
866
+ return require_errors.err(require_errors.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
867
+ }
856
868
  require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
857
869
  return require_errors.ok(cast);
858
870
  } catch (e) {
@@ -1294,7 +1294,11 @@ async function importSTEP(blob) {
1294
1294
  const data = await blob.arrayBuffer();
1295
1295
  const shapes = require_shapeTypes.getKernel().importSTEP(data);
1296
1296
  if (shapes.length === 0) return require_errors.err(require_errors.ioError("STEP_IMPORT_FAILED", "STEP file contains no valid geometry"));
1297
- return require_errors.ok(require_shapeTypes.castShape(shapes[0]));
1297
+ for (let i = 1; i < shapes.length; i++) {
1298
+ const extra = shapes[i];
1299
+ if (extra) require_shapeTypes.getKernel().dispose(extra);
1300
+ }
1301
+ return require_errors.ok(require_shapeTypes.castResultShape(shapes[0]));
1298
1302
  } catch (e) {
1299
1303
  return require_errors.err(require_errors.ioError("STEP_IMPORT_FAILED", "Failed to load STEP file", e));
1300
1304
  }
@@ -1320,7 +1324,7 @@ async function importSTL(blob) {
1320
1324
  const data = await blob.arrayBuffer();
1321
1325
  const shape = require_shapeTypes.getKernel().importSTL(data);
1322
1326
  if (shape.IsNull()) return require_errors.err(require_errors.ioError("STL_IMPORT_FAILED", "Failed to create solid from STL mesh"));
1323
- return require_errors.ok(require_shapeTypes.castShape(shape));
1327
+ return require_errors.ok(require_shapeTypes.castResultShape(shape));
1324
1328
  } catch (e) {
1325
1329
  return require_errors.err(require_errors.ioError("STL_IMPORT_FAILED", "Failed to load STL file", e));
1326
1330
  }
@@ -1343,7 +1347,11 @@ async function importIGES(blob) {
1343
1347
  const data = await blob.arrayBuffer();
1344
1348
  const shapes = require_shapeTypes.getKernel().importIGES(data);
1345
1349
  if (shapes.length === 0) return require_errors.err(require_errors.ioError("IGES_IMPORT_FAILED", "IGES file contains no valid geometry"));
1346
- return require_errors.ok(require_shapeTypes.castShape(shapes[0]));
1350
+ for (let i = 1; i < shapes.length; i++) {
1351
+ const extra = shapes[i];
1352
+ if (extra) require_shapeTypes.getKernel().dispose(extra);
1353
+ }
1354
+ return require_errors.ok(require_shapeTypes.castResultShape(shapes[0]));
1347
1355
  } catch (e) {
1348
1356
  return require_errors.err(require_errors.ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
1349
1357
  }
@@ -1,4 +1,4 @@
1
- import { i as castShape, it as getKernel } from "./shapeTypes-DUGhC32A.js";
1
+ import { it as getKernel, n as castResultShape } from "./shapeTypes-DUGhC32A.js";
2
2
  import { i as wasmIndex, r as vec3At$1 } from "./bug-BdOHwn_e.js";
3
3
  import { O as ok, r as ioError, t as BrepErrorCode, v as err } from "./errors-B3CDG537.js";
4
4
  import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
@@ -1294,7 +1294,11 @@ async function importSTEP(blob) {
1294
1294
  const data = await blob.arrayBuffer();
1295
1295
  const shapes = getKernel().importSTEP(data);
1296
1296
  if (shapes.length === 0) return err(ioError("STEP_IMPORT_FAILED", "STEP file contains no valid geometry"));
1297
- return ok(castShape(shapes[0]));
1297
+ for (let i = 1; i < shapes.length; i++) {
1298
+ const extra = shapes[i];
1299
+ if (extra) getKernel().dispose(extra);
1300
+ }
1301
+ return ok(castResultShape(shapes[0]));
1298
1302
  } catch (e) {
1299
1303
  return err(ioError("STEP_IMPORT_FAILED", "Failed to load STEP file", e));
1300
1304
  }
@@ -1320,7 +1324,7 @@ async function importSTL(blob) {
1320
1324
  const data = await blob.arrayBuffer();
1321
1325
  const shape = getKernel().importSTL(data);
1322
1326
  if (shape.IsNull()) return err(ioError("STL_IMPORT_FAILED", "Failed to create solid from STL mesh"));
1323
- return ok(castShape(shape));
1327
+ return ok(castResultShape(shape));
1324
1328
  } catch (e) {
1325
1329
  return err(ioError("STL_IMPORT_FAILED", "Failed to load STL file", e));
1326
1330
  }
@@ -1343,7 +1347,11 @@ async function importIGES(blob) {
1343
1347
  const data = await blob.arrayBuffer();
1344
1348
  const shapes = getKernel().importIGES(data);
1345
1349
  if (shapes.length === 0) return err(ioError("IGES_IMPORT_FAILED", "IGES file contains no valid geometry"));
1346
- return ok(castShape(shapes[0]));
1350
+ for (let i = 1; i < shapes.length; i++) {
1351
+ const extra = shapes[i];
1352
+ if (extra) getKernel().dispose(extra);
1353
+ }
1354
+ return ok(castResultShape(shapes[0]));
1347
1355
  } catch (e) {
1348
1356
  return err(ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
1349
1357
  }
package/dist/io.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_meshFns = require("./meshFns-C7DDfJw0.cjs");
3
- const require_importFns = require("./importFns-BxxISnBH.cjs");
3
+ const require_importFns = require("./importFns-Bd3Gbhns.cjs");
4
4
  exports.blueprintToDXF = require_importFns.blueprintToDXF;
5
5
  exports.exportDXF = require_importFns.exportDXF;
6
6
  exports.exportGlb = require_importFns.exportGlb;
package/dist/io.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-BwMrdyFV.js";
2
- import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-DeYLnFtg.js";
2
+ import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-BogytVsi.js";
3
3
  export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_threadFns = require("./threadFns-ClqTSJHJ.cjs");
2
+ const require_threadFns = require("./threadFns-82vx0u7T.cjs");
3
3
  const require_loftFns = require("./loftFns-Imv8iEGt.cjs");
4
4
  exports.addChild = require_threadFns.addChild;
5
5
  exports.addJoint = require_threadFns.addJoint;
@@ -1,3 +1,3 @@
1
- import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as circularPattern, H as removeChild, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, O as prismaticJoint, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-DJjHonF8.js";
1
+ import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as circularPattern, H as removeChild, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, O as prismaticJoint, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-DohGvjbS.js";
2
2
  import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-DPVVYGdV.js";
3
3
  export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, exportURDF, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, importURDF, inverseKinematics, jointTrajectory, jointTransform, jointsFromDH, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
@@ -3,7 +3,7 @@ import { O as ok, d as validationError, g as andThen, v as err } from "./errors-
3
3
  import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
4
4
  import { g as translate } from "./shapeFns-tTkC3Ry7.js";
5
5
  import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-PnbuNC6X.js";
6
- import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-DDJPSm_r.js";
6
+ import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-Du0AWYAo.js";
7
7
  //#region src/topology/primitiveFns.ts
8
8
  /**
9
9
  * Create a box with the given dimensions.
@@ -3,7 +3,7 @@ const require_errors = require("./errors-CJU8CHng.cjs");
3
3
  const require_constants = require("./constants-BOVyEYGH.cjs");
4
4
  const require_shapeFns = require("./shapeFns-BZu0MAZ5.cjs");
5
5
  const require_surfaceBuilders = require("./surfaceBuilders-DOFKdphI.cjs");
6
- const require_solidBuilders = require("./solidBuilders-Dbvfcb5n.cjs");
6
+ const require_solidBuilders = require("./solidBuilders-CmZoQG9B.cjs");
7
7
  //#region src/topology/primitiveFns.ts
8
8
  /**
9
9
  * Create a box with the given dimensions.
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_textBlueprints = require("./textBlueprints-CAEJrQNw.cjs");
2
+ const require_textBlueprints = require("./textBlueprints-DKmwMA8f.cjs");
3
3
  const require_blueprintSketcher = require("./blueprintSketcher-BSo04hhn.cjs");
4
- const require_drawFns = require("./drawFns-C0X-tUUn.cjs");
4
+ const require_drawFns = require("./drawFns-DOY9mr5Z.cjs");
5
5
  //#region src/sketching.ts
6
6
  /**
7
7
  * brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
package/dist/sketching.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-9hdFqAKq.js";
2
- import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-BfV2OJo2.js";
3
- import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-CBs85Hp1.js";
2
+ import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-CDBjUHVb.js";
3
+ import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-C7mPkR_V.js";
4
4
  //#region src/sketching.ts
5
5
  /**
6
6
  * brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
@@ -126,25 +126,42 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
126
126
  }
127
127
  /**
128
128
  * Internal helper for pairwise fuse using index ranges to avoid array allocations.
129
+ *
130
+ * `isFinal` marks the subtree whose output is the overall result; only then does
131
+ * a two-input leaf apply `simplify` (with 3+ inputs the top-level combine already
132
+ * does, but a two-input fuse is a lone leaf with no combine to reapply it).
129
133
  */
130
- function fuseAllPairwise(shapes, start, end, optimisation, simplify, trackEvolution, signal, fuzzyValue) {
134
+ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isFinal, trackEvolution, signal, fuzzyValue) {
131
135
  if (signal?.aborted) throw signal.reason;
132
136
  const count = end - start;
133
- if (count === 1) return require_errors.ok(require_arrayAccess.getAtOrThrow(shapes, start));
134
- if (count === 2) return fuse(require_arrayAccess.getAtOrThrow(shapes, start), require_arrayAccess.getAtOrThrow(shapes, start + 1), {
135
- optimisation,
136
- simplify: false,
137
- trackEvolution,
138
- fuzzyValue,
139
- unsafe: true,
140
- ...signal ? { signal } : {}
137
+ if (count === 1) return require_errors.ok({
138
+ shape: require_arrayAccess.getAtOrThrow(shapes, start),
139
+ owned: false
141
140
  });
141
+ if (count === 2) {
142
+ const pair = fuse(require_arrayAccess.getAtOrThrow(shapes, start), require_arrayAccess.getAtOrThrow(shapes, start + 1), {
143
+ optimisation,
144
+ simplify: isFinal ? simplify : false,
145
+ trackEvolution,
146
+ fuzzyValue,
147
+ unsafe: true,
148
+ ...signal ? { signal } : {}
149
+ });
150
+ if (require_errors.isErr(pair)) return pair;
151
+ return require_errors.ok({
152
+ shape: pair.value,
153
+ owned: true
154
+ });
155
+ }
142
156
  const mid = start + Math.ceil(count / 2);
143
- const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, trackEvolution, signal, fuzzyValue);
157
+ const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
144
158
  if (require_errors.isErr(leftResult)) return leftResult;
145
- const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, trackEvolution, signal, fuzzyValue);
146
- if (require_errors.isErr(rightResult)) return rightResult;
147
- return fuse(leftResult.value, rightResult.value, {
159
+ const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
160
+ if (require_errors.isErr(rightResult)) {
161
+ if (leftResult.value.owned) require_shapeTypes.disposeResultShape(leftResult.value.shape);
162
+ return rightResult;
163
+ }
164
+ const combined = fuse(leftResult.value.shape, rightResult.value.shape, {
148
165
  optimisation,
149
166
  simplify,
150
167
  trackEvolution,
@@ -152,6 +169,13 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, trackEvolut
152
169
  unsafe: true,
153
170
  ...signal ? { signal } : {}
154
171
  });
172
+ if (leftResult.value.owned) require_shapeTypes.disposeResultShape(leftResult.value.shape);
173
+ if (rightResult.value.owned) require_shapeTypes.disposeResultShape(rightResult.value.shape);
174
+ if (require_errors.isErr(combined)) return combined;
175
+ return require_errors.ok({
176
+ shape: combined.value,
177
+ owned: true
178
+ });
155
179
  }
156
180
  function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "native", signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
157
181
  if (signal?.aborted) throw signal.reason;
@@ -172,7 +196,9 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
172
196
  if (fuseAllResult.ok && trackEvolution) require_shapeFns.propagateMetadataByHash(shapes, fuseAllResult.value);
173
197
  return fuseAllResult;
174
198
  }
175
- return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, trackEvolution, signal, fuzzyValue);
199
+ const pairwise = fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, trackEvolution, signal, fuzzyValue);
200
+ if (require_errors.isErr(pairwise)) return pairwise;
201
+ return require_errors.ok(pairwise.value.shape);
176
202
  }
177
203
  function cutAll(base, tools, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
178
204
  if (signal?.aborted) throw signal.reason;
@@ -126,25 +126,42 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
126
126
  }
127
127
  /**
128
128
  * Internal helper for pairwise fuse using index ranges to avoid array allocations.
129
+ *
130
+ * `isFinal` marks the subtree whose output is the overall result; only then does
131
+ * a two-input leaf apply `simplify` (with 3+ inputs the top-level combine already
132
+ * does, but a two-input fuse is a lone leaf with no combine to reapply it).
129
133
  */
130
- function fuseAllPairwise(shapes, start, end, optimisation, simplify, trackEvolution, signal, fuzzyValue) {
134
+ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isFinal, trackEvolution, signal, fuzzyValue) {
131
135
  if (signal?.aborted) throw signal.reason;
132
136
  const count = end - start;
133
- if (count === 1) return ok(getAtOrThrow(shapes, start));
134
- if (count === 2) return fuse(getAtOrThrow(shapes, start), getAtOrThrow(shapes, start + 1), {
135
- optimisation,
136
- simplify: false,
137
- trackEvolution,
138
- fuzzyValue,
139
- unsafe: true,
140
- ...signal ? { signal } : {}
137
+ if (count === 1) return ok({
138
+ shape: getAtOrThrow(shapes, start),
139
+ owned: false
141
140
  });
141
+ if (count === 2) {
142
+ const pair = fuse(getAtOrThrow(shapes, start), getAtOrThrow(shapes, start + 1), {
143
+ optimisation,
144
+ simplify: isFinal ? simplify : false,
145
+ trackEvolution,
146
+ fuzzyValue,
147
+ unsafe: true,
148
+ ...signal ? { signal } : {}
149
+ });
150
+ if (isErr(pair)) return pair;
151
+ return ok({
152
+ shape: pair.value,
153
+ owned: true
154
+ });
155
+ }
142
156
  const mid = start + Math.ceil(count / 2);
143
- const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, trackEvolution, signal, fuzzyValue);
157
+ const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
144
158
  if (isErr(leftResult)) return leftResult;
145
- const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, trackEvolution, signal, fuzzyValue);
146
- if (isErr(rightResult)) return rightResult;
147
- return fuse(leftResult.value, rightResult.value, {
159
+ const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
160
+ if (isErr(rightResult)) {
161
+ if (leftResult.value.owned) disposeResultShape(leftResult.value.shape);
162
+ return rightResult;
163
+ }
164
+ const combined = fuse(leftResult.value.shape, rightResult.value.shape, {
148
165
  optimisation,
149
166
  simplify,
150
167
  trackEvolution,
@@ -152,6 +169,13 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, trackEvolut
152
169
  unsafe: true,
153
170
  ...signal ? { signal } : {}
154
171
  });
172
+ if (leftResult.value.owned) disposeResultShape(leftResult.value.shape);
173
+ if (rightResult.value.owned) disposeResultShape(rightResult.value.shape);
174
+ if (isErr(combined)) return combined;
175
+ return ok({
176
+ shape: combined.value,
177
+ owned: true
178
+ });
155
179
  }
156
180
  function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "native", signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
157
181
  if (signal?.aborted) throw signal.reason;
@@ -172,7 +196,9 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
172
196
  if (fuseAllResult.ok && trackEvolution) propagateMetadataByHash(shapes, fuseAllResult.value);
173
197
  return fuseAllResult;
174
198
  }
175
- return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, trackEvolution, signal, fuzzyValue);
199
+ const pairwise = fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, trackEvolution, signal, fuzzyValue);
200
+ if (isErr(pairwise)) return pairwise;
201
+ return ok(pairwise.value.shape);
176
202
  }
177
203
  function cutAll(base, tools, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
178
204
  if (signal?.aborted) throw signal.reason;
package/dist/text.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_textBlueprints = require("./textBlueprints-CAEJrQNw.cjs");
3
- const require_textMetrics = require("./textMetrics-ButioWqV.cjs");
2
+ const require_textBlueprints = require("./textBlueprints-DKmwMA8f.cjs");
3
+ const require_textMetrics = require("./textMetrics-DnsFQg5k.cjs");
4
4
  exports.fontMetrics = require_textMetrics.fontMetrics;
5
5
  exports.getFont = require_textBlueprints.getFont;
6
6
  exports.loadFont = require_textBlueprints.loadFont;
package/dist/text.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-CBs85Hp1.js";
2
- import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CyftuV1-.js";
1
+ import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-C7mPkR_V.js";
2
+ import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-BfcRSP3_.js";
3
3
  export { fontMetrics, getFont, loadFont, sketchText, textBlueprints, textMetrics };
@@ -8,7 +8,7 @@ import { v as copyShape } from "./faceFns-C0IqnONT.js";
8
8
  import { l as curveStartPoint, u as curveTangentAt } from "./curveFns-DSouEUKA.js";
9
9
  import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
10
10
  import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-PnbuNC6X.js";
11
- import { o as makeSolid, p as cutAll, t as makeCompound } from "./solidBuilders-DDJPSm_r.js";
11
+ import { o as makeSolid, p as cutAll, t as makeCompound } from "./solidBuilders-Du0AWYAo.js";
12
12
  import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-9hdFqAKq.js";
13
13
  import { a as revolve, d as twistExtrude, o as complexExtrude, r as extrude, t as loft, u as sweep } from "./loftFns-DPVVYGdV.js";
14
14
  import opentype from "opentype.js";
@@ -39,7 +39,7 @@ const require_faceFns = require("./faceFns-5_JXMBDb.cjs");
39
39
  const require_curveFns = require("./curveFns-CRs4VDhr.cjs");
40
40
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
41
41
  const require_surfaceBuilders = require("./surfaceBuilders-DOFKdphI.cjs");
42
- const require_solidBuilders = require("./solidBuilders-Dbvfcb5n.cjs");
42
+ const require_solidBuilders = require("./solidBuilders-CmZoQG9B.cjs");
43
43
  const require_blueprintSketcher = require("./blueprintSketcher-BSo04hhn.cjs");
44
44
  const require_loftFns = require("./loftFns-Imv8iEGt.cjs");
45
45
  let opentype_js = require("opentype.js");
@@ -1,5 +1,5 @@
1
1
  import { O as ok, d as validationError, t as BrepErrorCode, v as err } from "./errors-B3CDG537.js";
2
- import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-CBs85Hp1.js";
2
+ import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-C7mPkR_V.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-CAEJrQNw.cjs");
1
+ const require_textBlueprints = require("./textBlueprints-DKmwMA8f.cjs");
2
2
  const require_errors = require("./errors-CJU8CHng.cjs");
3
3
  //#region src/text/sketchText.ts
4
4
  /**
@@ -3,10 +3,10 @@ const require_errors = require("./errors-CJU8CHng.cjs");
3
3
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
4
4
  const require_faceFns = require("./faceFns-5_JXMBDb.cjs");
5
5
  const require_shapeFns = require("./shapeFns-BZu0MAZ5.cjs");
6
- const require_solidBuilders = require("./solidBuilders-Dbvfcb5n.cjs");
6
+ const require_solidBuilders = require("./solidBuilders-CmZoQG9B.cjs");
7
7
  const require_loftFns = require("./loftFns-Imv8iEGt.cjs");
8
8
  const require_refResolveFns = require("./refResolveFns-B_iE18HK.cjs");
9
- const require_primitiveFns = require("./primitiveFns-88hMNirE.cjs");
9
+ const require_primitiveFns = require("./primitiveFns-K6hrkt3N.cjs");
10
10
  //#region src/utils/uuid.ts
11
11
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
12
12
  function uuidv() {
@@ -3,10 +3,10 @@ import { C as isOk, O as ok, d as validationError, n as computationError, r as i
3
3
  import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
4
4
  import { b as fromBREP } from "./faceFns-C0IqnONT.js";
5
5
  import { s as toBREP } from "./shapeFns-tTkC3Ry7.js";
6
- import { h as fuseAll } from "./solidBuilders-DDJPSm_r.js";
6
+ import { h as fuseAll } from "./solidBuilders-Du0AWYAo.js";
7
7
  import { t as loft } from "./loftFns-DPVVYGdV.js";
8
8
  import { c as resolveRefParams } from "./refResolveFns-BOiwaoR6.js";
9
- import { E as wire, h as line } from "./primitiveFns-lDxs8cQj.js";
9
+ import { E as wire, h as line } from "./primitiveFns-CFsKqdgs.js";
10
10
  //#region src/utils/uuid.ts
11
11
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
12
12
  function uuidv() {
package/dist/topology.cjs CHANGED
@@ -4,10 +4,10 @@ const require_faceFns = require("./faceFns-5_JXMBDb.cjs");
4
4
  const require_shapeFns = require("./shapeFns-BZu0MAZ5.cjs");
5
5
  const require_curveFns = require("./curveFns-CRs4VDhr.cjs");
6
6
  const require_meshFns = require("./meshFns-C7DDfJw0.cjs");
7
- const require_solidBuilders = require("./solidBuilders-Dbvfcb5n.cjs");
8
- const require_healingFns = require("./healingFns-DWxiSNvM.cjs");
7
+ const require_solidBuilders = require("./solidBuilders-CmZoQG9B.cjs");
8
+ const require_healingFns = require("./healingFns-l6bwWSeW.cjs");
9
9
  const require_adjacencyFns = require("./adjacencyFns-einnpj1f.cjs");
10
- const require_primitiveFns = require("./primitiveFns-88hMNirE.cjs");
10
+ const require_primitiveFns = require("./primitiveFns-K6hrkt3N.cjs");
11
11
  exports.addHoles = require_primitiveFns.addHoles;
12
12
  exports.adjacentFaces = require_adjacencyFns.adjacentFaces;
13
13
  exports.approximateCurve = require_curveFns.approximateCurve;
package/dist/topology.js CHANGED
@@ -3,8 +3,8 @@ import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fr
3
3
  import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-tTkC3Ry7.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-DSouEUKA.js";
5
5
  import { d as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES, u as clearMeshCache } from "./meshFns-BwMrdyFV.js";
6
- import { h as fuseAll, p as cutAll } from "./solidBuilders-DDJPSm_r.js";
7
- import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as toGroupedBufferGeometryData, k as chamferDistAngle, 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 } from "./healingFns-BsVhf71B.js";
6
+ import { h as fuseAll, p as cutAll } from "./solidBuilders-Du0AWYAo.js";
7
+ import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as toGroupedBufferGeometryData, k as chamferDistAngle, 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 } from "./healingFns-CotWNIRj.js";
8
8
  import { i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-BkTS3Exp.js";
9
- 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-lDxs8cQj.js";
9
+ 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-CFsKqdgs.js";
10
10
  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.118.27",
3
+ "version": "18.118.28",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",