brepjs 20.12.6 → 20.12.8

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 (96) hide show
  1. package/dist/2d/blueprints/booleanHelpers.d.ts +0 -5
  2. package/dist/2d/blueprints/intersectionSegments.d.ts +6 -5
  3. package/dist/2d.cjs +6 -6
  4. package/dist/2d.js +6 -6
  5. package/dist/{adjacencyFns-BFJfaUwX.cjs → adjacencyFns-BfgFo-Rh.cjs} +3 -3
  6. package/dist/{adjacencyFns--KmBIKYJ.js → adjacencyFns-Bl109A3Z.js} +3 -3
  7. package/dist/{blueprint-D83DDDPb.cjs → blueprint-DTDSztfd.cjs} +5 -5
  8. package/dist/{blueprint-BhIk9Pvm.js → blueprint-RqemOtg5.js} +5 -5
  9. package/dist/{blueprintFns-eULVgkq9.js → blueprintFns-B9_PhTr8.js} +2 -2
  10. package/dist/{blueprintFns-C4TQn-x_.cjs → blueprintFns-C7E5R89N.cjs} +2 -2
  11. package/dist/{blueprintSketcher-D_Faf0GO.js → blueprintSketcher-B15522Kr.js} +3 -3
  12. package/dist/{blueprintSketcher-Di376t-0.cjs → blueprintSketcher-Brj4lXjj.cjs} +3 -3
  13. package/dist/{boolean2D-CNZFI_y8.cjs → boolean2D-DZ8aJbI-.cjs} +42 -50
  14. package/dist/{boolean2D-DqpCF72W.js → boolean2D-_eiIiNw1.js} +42 -50
  15. package/dist/{solidBuilders-iS5DDwg8.cjs → booleanFns-D5nQ1nWS.cjs} +11 -217
  16. package/dist/{solidBuilders-DT1gpVWM.js → booleanFns-cNfXGqMX.js} +10 -156
  17. package/dist/brepjs.cjs +325 -168
  18. package/dist/brepjs.js +282 -125
  19. package/dist/{cameraFns-RqraCXIc.cjs → cameraFns-6Er2lhp5.cjs} +3 -3
  20. package/dist/{cameraFns-CrClIkmV.js → cameraFns-YhB7A_Zc.js} +3 -3
  21. package/dist/core.cjs +2 -2
  22. package/dist/core.js +2 -2
  23. package/dist/{cornerFinder-CdOe1Wrb.cjs → cornerFinder-D9Wx3DWu.cjs} +1 -1
  24. package/dist/{cornerFinder-BZuQkRp2.js → cornerFinder-G1WkSkVl.js} +1 -1
  25. package/dist/{curveFns-CyIvQNYT.cjs → curveFns-B5_N-gMj.cjs} +1 -1
  26. package/dist/{curveFns-BP3srCfK.js → curveFns-C4CqthJp.js} +1 -1
  27. package/dist/{drawFns-DxDwJ5zZ.js → drawFns-DU5fewKl.js} +12 -12
  28. package/dist/{drawFns-71cOhWD-.cjs → drawFns-UPbO2heB.cjs} +12 -12
  29. package/dist/{faceFns-iVPbTxki.js → faceFns-BgRNa5vx.js} +2 -2
  30. package/dist/{faceFns-B7MiDYj1.cjs → faceFns-C4NOGZBg.cjs} +2 -2
  31. package/dist/{healingFns-BhP8zfp1.js → healingFns-BzOo0yyz.js} +5 -5
  32. package/dist/{healingFns-DWljGTNR.cjs → healingFns-i5gV3BMG.cjs} +29 -29
  33. package/dist/{helpers-DKEVm6Hu.cjs → helpers-DJQeDf_5.cjs} +6 -6
  34. package/dist/{helpers-D2hANLRu.js → helpers-DPHQt2Kr.js} +6 -6
  35. package/dist/{importFns-KEPAgbjj.cjs → importFns-BiRpt227.cjs} +319 -14
  36. package/dist/{importFns-DUzIkns7.js → importFns-CwrJsNvg.js} +314 -15
  37. package/dist/io/igesSupport.d.ts +6 -0
  38. package/dist/io/importFns.d.ts +15 -5
  39. package/dist/io/ioUtils.d.ts +15 -3
  40. package/dist/io/meshNesting.d.ts +11 -0
  41. package/dist/io/threemfImportFns.d.ts +6 -3
  42. package/dist/io.cjs +2 -2
  43. package/dist/io.js +2 -2
  44. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  45. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  46. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +4 -2
  47. package/dist/{loftFns-D5AvfCGG.cjs → loftFns-DgkK4Kj_.cjs} +1 -1
  48. package/dist/{loftFns-D5NJpHLZ.js → loftFns-lwzTh1fI.js} +1 -1
  49. package/dist/{measureFns-CZHNWkiA.cjs → measureFns-D_RRjCZg.cjs} +3 -3
  50. package/dist/{measureFns-mxBdPiWa.js → measureFns-Q3K25IfN.js} +3 -3
  51. package/dist/measurement.cjs +2 -2
  52. package/dist/measurement.js +2 -2
  53. package/dist/{meshFns-DmjMzNbH.js → meshFns-BGoJU6_P.js} +20 -6
  54. package/dist/{meshFns-Czlt-GBJ.cjs → meshFns-Djbb4PUC.cjs} +25 -5
  55. package/dist/{occtWasmAdapter-B9d0Q0Vl.js → occtWasmAdapter-BCCwaYkq.js} +103 -40
  56. package/dist/{occtWasmAdapter-DVxLkjlJ.cjs → occtWasmAdapter-UcYZRi-w.cjs} +103 -40
  57. package/dist/operations.cjs +2 -2
  58. package/dist/operations.js +2 -2
  59. package/dist/{primitiveFns-BVeBEaa4.cjs → primitiveFns-CfSnex9P.cjs} +19 -18
  60. package/dist/{primitiveFns-DeNl60Rw.js → primitiveFns-D-aYcwt2.js} +5 -4
  61. package/dist/{principalBoxFns-3mW_hA6z.js → principalBoxFns-Dcp9gg5e.js} +3 -3
  62. package/dist/{principalBoxFns-CG6kG7vT.cjs → principalBoxFns-IY8FfPVj.cjs} +3 -3
  63. package/dist/projection.cjs +1 -1
  64. package/dist/projection.js +1 -1
  65. package/dist/query.cjs +2 -2
  66. package/dist/query.js +2 -2
  67. package/dist/{refResolveFns-DHx1Y3GG.js → refResolveFns-BPge7T5w.js} +6 -6
  68. package/dist/{refResolveFns-BAs4p9z7.cjs → refResolveFns-gZQ1o5XK.cjs} +6 -6
  69. package/dist/{shapeFns-C0w8vvfb.cjs → shapeFns-Bs92VrZh.cjs} +2 -2
  70. package/dist/{shapeFns-CgqKICF_.js → shapeFns-TWdr4Dv4.js} +2 -2
  71. package/dist/shapeRef.cjs +1 -1
  72. package/dist/shapeRef.js +1 -1
  73. package/dist/{shapeTypes-DwvQUp9M.js → shapeTypes-CIH-8d_a.js} +1 -1
  74. package/dist/{shapeTypes-Dc7j-MYg.cjs → shapeTypes-DmThK_oa.cjs} +1 -1
  75. package/dist/sketching.cjs +3 -3
  76. package/dist/sketching.js +3 -3
  77. package/dist/{originTrackingFns-CHymOLLm.cjs → solidBuilders-DGskMugU.cjs} +209 -2
  78. package/dist/{originTrackingFns-CBnyKLm7.js → solidBuilders-q_hwYsdo.js} +150 -3
  79. package/dist/{surfaceBuilders-CPLe0bbk.js → surfaceBuilders-DXo4N7wQ.js} +3 -3
  80. package/dist/{surfaceBuilders-BvwSgD3C.cjs → surfaceBuilders-DeSLKg73.cjs} +3 -3
  81. package/dist/text.cjs +2 -2
  82. package/dist/text.js +2 -2
  83. package/dist/{textBlueprints-BU0Rhk54.js → textBlueprints-BYWZho_c.js} +8 -7
  84. package/dist/{textBlueprints-CNPCPJix.cjs → textBlueprints-Dz6wNgve.cjs} +9 -8
  85. package/dist/{textMetrics-C71g4TmO.cjs → textMetrics-bKoFTj3m.cjs} +1 -1
  86. package/dist/{textMetrics-Df9aLYK2.js → textMetrics-k_rGqib2.js} +1 -1
  87. package/dist/{threadFns-DESH7lcs.js → threadFns-BeB8s0tA.js} +7 -7
  88. package/dist/{threadFns-CzXEnnmo.cjs → threadFns-CoGAFHHt.cjs} +9 -9
  89. package/dist/topology/meshFns.d.ts +3 -0
  90. package/dist/topology.cjs +11 -11
  91. package/dist/topology.js +9 -9
  92. package/dist/{topologyQueryFns-5Frx8Y-0.cjs → topologyQueryFns-CXbCFaU2.cjs} +1 -1
  93. package/dist/{topologyQueryFns-LXV1nTaS.js → topologyQueryFns-Cp0yekBh.js} +1 -1
  94. package/dist/{validityTypes-DM-Iwe8N.js → validityTypes-DlrWkrSR.js} +1 -1
  95. package/dist/{validityTypes-C6rROGTP.cjs → validityTypes-m6eLRTYE.cjs} +1 -1
  96. package/package.json +1 -1
package/dist/brepjs.js CHANGED
@@ -1,40 +1,40 @@
1
- import { $ as initFromOC, A as as3D, C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, G as _usingCtx, H as withScope, I as getDisposalStats, J as getKernel2D, K as getActiveKernelId, L as isLive, M as is3D, N as DisposalScope, P as createHandle, Q as initFromManifold, S as isShell, T as isWire, U as withScopeResult, V as withArenaCheckpoint, W as withScopeResultAsync, X as getKernelTier, Y as getKernelCapabilities, Z as init, _ as isCompound, a as castShape3D, at as withTier, b as isShape1D, c as createEdge, ct as resetPerformanceStats, d as createSolid, et as prewarm, f as createVertex, h as disposeResultShape, i as castShape, it as withQuality, j as is2D, k as as2D, l as createFace, lt as currentQuality, n as castResultShape, nt as registerKernelTier, ot as BrepkitAdapter, p as createWire, q as getKernel, rt as withKernel, s as createCompound, st as getPerformanceStats, tt as registerKernel, u as createShell, ut as qualityDeflection, v as isEdge, w as isVertex, x as isShape3D, y as isFace, z as resetDisposalStats } from "./shapeTypes-DwvQUp9M.js";
2
- import { M as DEFAULT_CAPABILITIES, N as EXACT_BREP_CAPABILITIES, t as OcctWasmAdapter } from "./occtWasmAdapter-B9d0Q0Vl.js";
1
+ import { $ as initFromOC, A as as3D, C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, G as _usingCtx, H as withScope, I as getDisposalStats, J as getKernel2D, K as getActiveKernelId, L as isLive, M as is3D, N as DisposalScope, P as createHandle, Q as initFromManifold, S as isShell, T as isWire, U as withScopeResult, V as withArenaCheckpoint, W as withScopeResultAsync, X as getKernelTier, Y as getKernelCapabilities, Z as init, _ as isCompound, a as castShape3D, at as withTier, b as isShape1D, c as createEdge, ct as resetPerformanceStats, d as createSolid, et as prewarm, f as createVertex, h as disposeResultShape, i as castShape, it as withQuality, j as is2D, k as as2D, l as createFace, lt as currentQuality, n as castResultShape, nt as registerKernelTier, ot as BrepkitAdapter, p as createWire, q as getKernel, rt as withKernel, s as createCompound, st as getPerformanceStats, tt as registerKernel, u as createShell, ut as qualityDeflection, v as isEdge, w as isVertex, x as isShape3D, y as isFace, z as resetDisposalStats } from "./shapeTypes-CIH-8d_a.js";
2
+ import { M as DEFAULT_CAPABILITIES, N as EXACT_BREP_CAPABILITIES, t as OcctWasmAdapter } from "./occtWasmAdapter-BCCwaYkq.js";
3
3
  import { i as wasmIndex, n as bug, t as BrepBugError } from "./bug-ClMTAJhe.js";
4
4
  import { A as tap, C as mapBoth, D as or, E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, O as orElse, P as unwrap, R as zip, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, j as tapErr, k as pipeline, l as typeCastError, m as andThen, n as computationError, o as queryError, p as all, r as ioError, t as BrepErrorCode, u as unsupportedError, v as flatten, w as mapErr, x as isOk, y as fromNullable } from "./errors-BTccWbtE.js";
5
- import { D as kernelCallScoped, E as kernelCallRaw, T as kernelCall, _ as iterFaces, a as getCachedSurfaceType, b as iterVertices, c as getFaces, d as getSolids, f as getVertices, g as iterEdges, h as iterCompSolids, m as invalidateShapeCache, n as getBounds, o as getCompSolids, p as getWires, s as getEdges, t as describe$1, u as getShells, v as iterShells, w as vertexPosition, x as iterWires, y as iterSolids } from "./topologyQueryFns-LXV1nTaS.js";
6
- import { a as isPlanarFace, c as manifoldShell, d as planarWire, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, o as isPlanarWire, r as isManifoldShell, s as isValidSolid, t as closedWire, u as planarFace } from "./validityTypes-DM-Iwe8N.js";
5
+ import { D as kernelCallScoped, E as kernelCallRaw, T as kernelCall, _ as iterFaces, a as getCachedSurfaceType, b as iterVertices, c as getFaces, d as getSolids, f as getVertices, g as iterEdges, h as iterCompSolids, m as invalidateShapeCache, n as getBounds, o as getCompSolids, p as getWires, s as getEdges, t as describe$1, u as getShells, v as iterShells, w as vertexPosition, x as iterWires, y as iterSolids } from "./topologyQueryFns-Cp0yekBh.js";
6
+ import { a as isPlanarFace, c as manifoldShell, d as planarWire, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, o as isPlanarWire, r as isManifoldShell, s as isValidSolid, t as closedWire, u as planarFace } from "./validityTypes-DlrWkrSR.js";
7
7
  import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-iraOnb2p.js";
8
8
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-CKXsIm9-.js";
9
9
  import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane, g as vecSub, h as vecScale, i as vecDistance, l as vecLengthSq, m as vecRotate, n as vecAngle, o as vecEquals, p as vecRepr, r as vecCross, s as vecIsZero, t as vecAdd, u as vecNegate } from "./vecOps-S-m9H_fe.js";
10
10
  import { i as pivotPlane, n as createPlane, o as resolvePlane, r as makePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-D3yDuMux.js";
11
- import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, p as removeHolesFromFace, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-iVPbTxki.js";
12
- import { i as setShapeOrigin, t as getFaceOrigins } from "./originTrackingFns-CBnyKLm7.js";
13
- import { A as parseColor, D as colorShape, E as colorFaces, F as tagFaces, M as getFaceTags, N as getTagMetadata, O as getFaceColor, P as setTagMetadata, S as hasAnyMetadata, T as propagateMetadataThroughRelocation, _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, j as findFacesByTag, k as getShapeColor, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-DT1gpVWM.js";
14
- import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, 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, j as mirror$2, k as composeTransforms, 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-DeNl60Rw.js";
15
- import { a as isSameShape, i as isEqualShape, n as getHashCode, o as simplify$1, r as isEmpty$2, s as toBREP$1, t as clone$1 } from "./shapeFns-CgqKICF_.js";
16
- 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-BP3srCfK.js";
17
- import { a as meshEdges$1, c as meshMultiLOD, d as clearMeshCache, f as createMeshCache, i as mesh$1, l as scaleDefaultTolerance, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as buildMeshCacheKey } from "./meshFns-DmjMzNbH.js";
11
+ import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, p as removeHolesFromFace, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-BgRNa5vx.js";
12
+ import { d as getFaceOrigins, m as setShapeOrigin, r as makeCylinder, t as makeCompound } from "./solidBuilders-q_hwYsdo.js";
13
+ import { C as getTagMetadata, S as getFaceTags, T as tagFaces, _ as colorShape, a as fuseAll$2, b as parseColor, c as sectionToFace$1, f as hasAnyMetadata, g as colorFaces, h as propagateMetadataThroughRelocation, i as fuse$2, l as slice$1, n as cut$2, o as intersect$2, r as cutAll$2, s as section$1, t as booleanPipeline, u as split$1, v as getFaceColor, w as setTagMetadata, x as findFacesByTag, y as getShapeColor } from "./booleanFns-cNfXGqMX.js";
14
+ import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, 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, j as mirror$2, k as composeTransforms, 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-D-aYcwt2.js";
15
+ import { a as isSameShape, i as isEqualShape, n as getHashCode, o as simplify$1, r as isEmpty$2, s as toBREP$1, t as clone$1 } from "./shapeFns-TWdr4Dv4.js";
16
+ 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-C4CqthJp.js";
17
+ import { a as meshEdges$1, c as meshMultiLOD, d as buildMeshCacheKey, f as clearMeshCache, i as mesh$1, l as scaleDefaultTolerance, n as exportSTEP, o as meshLODs, p as createMeshCache, r as exportSTL, s as meshLODsProgressive, t as exportIGES } from "./meshFns-BGoJU6_P.js";
18
18
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
19
- import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, p as makeEllipseArc, r as makeFace, s as assembleWire, u as makeBezierCurve } from "./surfaceBuilders-CPLe0bbk.js";
20
- import { A as variableFillet, C as chamfer$2, D as removeFaces$1, E as offset$1, F as toLineGeometryData, M as toGroupedBufferGeometryData, N as toLODGeometryData, O as shell$2, P as toLODGeometryLevels, S as chamferDistAngle, T as fillet$2, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as toBufferGeometryData, k as thicken$1, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as draft$1, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-BhP8zfp1.js";
21
- import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, G as quatFromAxisAngle, H as circularPattern, I as createAssemblyNode, J as quatRotate, K as quatFromTo, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, 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 quatMultiply, 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 updateNode } from "./threadFns-DESH7lcs.js";
22
- import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-D_Faf0GO.js";
23
- import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-D2hANLRu.js";
24
- import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-BhIk9Pvm.js";
25
- 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-DxDwJ5zZ.js";
26
- 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-mxBdPiWa.js";
27
- import { t as cornerFinder } from "./cornerFinder-BZuQkRp2.js";
28
- 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-DqpCF72W.js";
29
- 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-eULVgkq9.js";
30
- 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-DUzIkns7.js";
31
- import { S as revolve$2, a as Sketches, b as extrude$2, c as compoundSketchFace, d as sketchExtrude, f as sketchFace, g as sketchWires, h as sketchSweep, i as setFallbackFont, l as compoundSketchLoft, m as sketchRevolve, n as getFont, o as Sketch, p as sketchLoft, r as loadFont, s as compoundSketchExtrude, t as textBlueprints, u as compoundSketchRevolve, x as extrudeAll, y as CompoundSketch } from "./textBlueprints-BU0Rhk54.js";
32
- import { a as multiSectionSweep, c as twistExtrude, i as guidedSweep, n as loftAll, o as supportExtrude, r as complexExtrude, s as sweep$1, t as loft$2 } from "./loftFns-D5NJpHLZ.js";
33
- 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-DHx1Y3GG.js";
34
- 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--KmBIKYJ.js";
35
- import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-CrClIkmV.js";
36
- import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-Df9aLYK2.js";
37
- import { t as principalBoundingBox } from "./principalBoxFns-3mW_hA6z.js";
19
+ import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, p as makeEllipseArc, r as makeFace, s as assembleWire, u as makeBezierCurve } from "./surfaceBuilders-DXo4N7wQ.js";
20
+ import { A as variableFillet, C as chamfer$2, D as removeFaces$1, E as offset$1, F as toLineGeometryData, M as toGroupedBufferGeometryData, N as toLODGeometryData, O as shell$2, P as toLODGeometryLevels, S as chamferDistAngle, T as fillet$2, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as toBufferGeometryData, k as thicken$1, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as draft$1, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-BzOo0yyz.js";
21
+ import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, G as quatFromAxisAngle, H as circularPattern, I as createAssemblyNode, J as quatRotate, K as quatFromTo, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, 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 quatMultiply, 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 updateNode } from "./threadFns-BeB8s0tA.js";
22
+ import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-B15522Kr.js";
23
+ import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DPHQt2Kr.js";
24
+ import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-RqemOtg5.js";
25
+ 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-DU5fewKl.js";
26
+ 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-Q3K25IfN.js";
27
+ import { t as cornerFinder } from "./cornerFinder-G1WkSkVl.js";
28
+ 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-_eiIiNw1.js";
29
+ 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-B9_PhTr8.js";
30
+ import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, i as sewMeshToSolid, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-CwrJsNvg.js";
31
+ import { S as revolve$2, a as Sketches, b as extrude$2, c as compoundSketchFace, d as sketchExtrude, f as sketchFace, g as sketchWires, h as sketchSweep, i as setFallbackFont, l as compoundSketchLoft, m as sketchRevolve, n as getFont, o as Sketch, p as sketchLoft, r as loadFont, s as compoundSketchExtrude, t as textBlueprints, u as compoundSketchRevolve, x as extrudeAll, y as CompoundSketch } from "./textBlueprints-BYWZho_c.js";
32
+ import { a as multiSectionSweep, c as twistExtrude, i as guidedSweep, n as loftAll, o as supportExtrude, r as complexExtrude, s as sweep$1, t as loft$2 } from "./loftFns-lwzTh1fI.js";
33
+ 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-BPge7T5w.js";
34
+ 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-Bl109A3Z.js";
35
+ import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-YhB7A_Zc.js";
36
+ import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-k_rGqib2.js";
37
+ import { t as principalBoundingBox } from "./principalBoxFns-Dcp9gg5e.js";
38
38
  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-Bc5hmJc4.js";
39
39
  // \0rolldown/runtime.js
40
40
  var __defProp = Object.defineProperty;
@@ -7209,49 +7209,8 @@ async function importDXF(blob, options) {
7209
7209
  for (const edge of edges) kernel.dispose(edge);
7210
7210
  }
7211
7211
  }
7212
- // src/io/ioUtils.ts
7213
- /**
7214
- * Shared mesh-to-solid sewing utilities for mesh importers.
7215
- *
7216
- * Builds triangular B-Rep faces from vertex/index data and sews them into
7217
- * a solid, with a fallback to a shell when solidification fails.
7218
- */
7219
- /**
7220
- * Build triangular B-Rep faces from vertex data and sew them into a solid.
7221
- *
7222
- * For each triple of vertex coordinates, calls `kernel.buildTriFace` to create
7223
- * a planar triangular face, then attempts `sewAndSolidify`. If solidification
7224
- * fails, falls back to `sew` (returning a shell or compound).
7225
- *
7226
- * @param triangles - Array of vertex triples, each triple being three [x,y,z] tuples.
7227
- * @param errorCode - The error code to use in any returned errors.
7228
- * @param tolerance - Sewing tolerance (default 1e-6).
7229
- * @returns A `Result` wrapping the sewn shape, or an error.
7230
- */
7231
- function sewMeshToSolid(triangles, errorCode, tolerance = 1e-6) {
7232
- const kernel = getKernel();
7233
- const triFaces = [];
7234
- for (const [va, vb, vc] of triangles) {
7235
- const triFace = kernel.buildTriFace(va, vb, vc);
7236
- if (triFace !== null) triFaces.push(triFace);
7237
- }
7238
- if (triFaces.length === 0) return err(ioError(errorCode, "No valid triangular faces could be built"));
7239
- try {
7240
- const solid = kernel.sewAndSolidify(triFaces, tolerance);
7241
- const cast = castResultShape(solid);
7242
- for (const triFace of triFaces) kernel.dispose(triFace);
7243
- return ok(cast);
7244
- } catch {
7245
- try {
7246
- return ok(castShape(kernel.sew(triFaces, tolerance)));
7247
- } catch (e) {
7248
- return err(ioError(errorCode, "Failed to sew triangular faces", e));
7249
- }
7250
- }
7251
- }
7252
7212
  // src/io/objImportFns.ts
7253
- function parseVertexLine(line) {
7254
- const parts = line.split(/\s+/);
7213
+ function parseVertex(parts) {
7255
7214
  const x = parseFloat(parts[1] ?? "");
7256
7215
  const y = parseFloat(parts[2] ?? "");
7257
7216
  const z = parseFloat(parts[3] ?? "");
@@ -7262,8 +7221,18 @@ function parseVertexLine(line) {
7262
7221
  z
7263
7222
  ];
7264
7223
  }
7265
- function parseFaceIndices(line) {
7266
- return line.split(/\s+/).slice(1).map((p) => parseInt(p.split("/")[0] ?? "", 10)).filter((idx) => !isNaN(idx));
7224
+ /**
7225
+ * Face corners as 0-based vertex indices. A negative OBJ index counts back from
7226
+ * the vertices defined so far, so it resolves against `vertexCount` at this line.
7227
+ */
7228
+ function parseFaceIndices(parts, vertexCount) {
7229
+ const indices = [];
7230
+ for (const part of parts.slice(1)) {
7231
+ const raw = parseInt(part.split("/")[0] ?? "", 10);
7232
+ if (isNaN(raw)) continue;
7233
+ indices.push(raw > 0 ? raw - 1 : raw < 0 ? vertexCount + raw : -1);
7234
+ }
7235
+ return indices;
7267
7236
  }
7268
7237
  /**
7269
7238
  * Import a Wavefront OBJ file from a Blob.
@@ -7285,12 +7254,12 @@ async function importOBJ(blob) {
7285
7254
  const vertices = [];
7286
7255
  const faces = [];
7287
7256
  for (const raw of lines) {
7288
- const line = raw.trim();
7289
- if (line.startsWith("v ")) {
7290
- const vertex = parseVertexLine(line);
7257
+ const parts = raw.trim().split(/\s+/);
7258
+ if (parts[0] === "v") {
7259
+ const vertex = parseVertex(parts);
7291
7260
  if (vertex) vertices.push(vertex);
7292
- } else if (line.startsWith("f ")) {
7293
- const indices = parseFaceIndices(line);
7261
+ } else if (parts[0] === "f") {
7262
+ const indices = parseFaceIndices(parts, vertices.length);
7294
7263
  if (indices.length >= 3) faces.push(indices);
7295
7264
  }
7296
7265
  }
@@ -7305,15 +7274,9 @@ async function importOBJ(blob) {
7305
7274
  function buildSolidFromMesh$1(vertices, faces) {
7306
7275
  const triangles = [];
7307
7276
  for (const face of faces) for (let i = 1; i < face.length - 1; i++) {
7308
- const rawA = face[0] ?? 0;
7309
- const rawB = face[i] ?? 0;
7310
- const rawC = face[i + 1] ?? 0;
7311
- const ai = rawA > 0 ? rawA - 1 : vertices.length + rawA;
7312
- const bi = rawB > 0 ? rawB - 1 : vertices.length + rawB;
7313
- const ci = rawC > 0 ? rawC - 1 : vertices.length + rawC;
7314
- const va = vertices[ai];
7315
- const vb = vertices[bi];
7316
- const vc = vertices[ci];
7277
+ const va = vertices[face[0] ?? -1];
7278
+ const vb = vertices[face[i] ?? -1];
7279
+ const vc = vertices[face[i + 1] ?? -1];
7317
7280
  if (!va || !vb || !vc) continue;
7318
7281
  triangles.push([
7319
7282
  va,
@@ -7325,7 +7288,7 @@ function buildSolidFromMesh$1(vertices, faces) {
7325
7288
  }
7326
7289
  // src/io/threemfImportFns.ts
7327
7290
  /**
7328
- * 3MF import — parses a 3MF ZIP archive and builds a solid via sewing.
7291
+ * 3MF import: parses a 3MF ZIP archive and builds one solid per placed object via sewing.
7329
7292
  */
7330
7293
  function extractFromZip(data, target) {
7331
7294
  let eocdOffset = -1;
@@ -7357,6 +7320,26 @@ function extractFromZip(data, target) {
7357
7320
  }
7358
7321
  return null;
7359
7322
  }
7323
+ /** Millimeters per model unit, keyed by the values the 3MF `unit` attribute allows. */
7324
+ var MM_PER_UNIT = {
7325
+ micron: .001,
7326
+ millimeter: 1,
7327
+ centimeter: 10,
7328
+ inch: 25.4,
7329
+ foot: 304.8,
7330
+ meter: 1e3
7331
+ };
7332
+ /**
7333
+ * Components nest and repeat, so a few KB of XML can describe billions of
7334
+ * placements; stop expanding long before that exhausts memory.
7335
+ */
7336
+ var MAX_PLACED_OBJECTS = 1e5;
7337
+ /** At roughly 2.5 s per 10,000 sewn triangles, more than this would take hours to build. */
7338
+ var MAX_PLACED_TRIANGLES = 2e6;
7339
+ /** Each placement copies its object's vertices; three per triangle fits any mesh under the triangle limit. */
7340
+ var MAX_PLACED_VERTICES = 3 * MAX_PLACED_TRIANGLES;
7341
+ /** Assemblies nest a few levels deep; a far deeper chain only serves to exhaust the stack. */
7342
+ var MAX_COMPONENT_DEPTH = 64;
7360
7343
  /** Check if a char code is a valid XML attribute name character [a-zA-Z0-9_]. */
7361
7344
  function isAttrChar(code) {
7362
7345
  return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 95;
@@ -7383,13 +7366,27 @@ function parseTagAttrs(tag) {
7383
7366
  }
7384
7367
  return attrs;
7385
7368
  }
7369
+ /** True when `<tagName` at `start` names that exact element (not a longer one like `<vertices`). */
7370
+ function isTagStart(xml, start, tagName) {
7371
+ const next = xml.charCodeAt(start + tagName.length + 1);
7372
+ return next === 32 || next === 9 || next === 10 || next === 13 || next === 47 || next === 62;
7373
+ }
7374
+ /** Index of the next `<tagName` start tag at or after `from`, or -1. */
7375
+ function indexOfTag(xml, tagName, from) {
7376
+ const needle = `<${tagName}`;
7377
+ let pos = from;
7378
+ for (;;) {
7379
+ const start = xml.indexOf(needle, pos);
7380
+ if (start < 0 || isTagStart(xml, start, tagName)) return start;
7381
+ pos = start + needle.length;
7382
+ }
7383
+ }
7386
7384
  /** Collect all tags matching `<tagName ...>` using indexOf (O(n), no regex). */
7387
7385
  function findTags(xml, tagName) {
7388
7386
  const tags = [];
7389
- const needle = `<${tagName} `;
7390
7387
  let pos = 0;
7391
7388
  while (pos < xml.length) {
7392
- const start = xml.indexOf(needle, pos);
7389
+ const start = indexOfTag(xml, tagName, pos);
7393
7390
  if (start < 0) break;
7394
7391
  const end = xml.indexOf(">", start);
7395
7392
  if (end < 0) break;
@@ -7399,15 +7396,36 @@ function findTags(xml, tagName) {
7399
7396
  return tags;
7400
7397
  }
7401
7398
  /**
7402
- * Extract a block `<tagName ...>...</tagName>` from xml.
7403
- * Returns the full block string including open/close tags, or null if not found.
7399
+ * Collect every `<tagName ...>...</tagName>` element as its start tag plus inner
7400
+ * content. A self-closing `<tagName ... />` yields an empty body.
7404
7401
  */
7405
- function findTagBlock(xml, tagName) {
7406
- const open = xml.indexOf(`<${tagName}`);
7407
- if (open < 0) return null;
7408
- const close = xml.indexOf(`</${tagName}>`, open);
7409
- if (close < 0) return null;
7410
- return xml.slice(open, close + tagName.length + 3);
7402
+ function findElements(xml, tagName) {
7403
+ const elements = [];
7404
+ const close = `</${tagName}>`;
7405
+ let pos = 0;
7406
+ while (pos < xml.length) {
7407
+ const start = indexOfTag(xml, tagName, pos);
7408
+ if (start < 0) break;
7409
+ const tagEnd = xml.indexOf(">", start);
7410
+ if (tagEnd < 0) break;
7411
+ const tag = xml.slice(start, tagEnd + 1);
7412
+ if (xml.charCodeAt(tagEnd - 1) === 47) {
7413
+ elements.push({
7414
+ tag,
7415
+ body: ""
7416
+ });
7417
+ pos = tagEnd + 1;
7418
+ continue;
7419
+ }
7420
+ const closeAt = xml.indexOf(close, tagEnd);
7421
+ if (closeAt < 0) break;
7422
+ elements.push({
7423
+ tag,
7424
+ body: xml.slice(tagEnd + 1, closeAt)
7425
+ });
7426
+ pos = closeAt + close.length;
7427
+ }
7428
+ return elements;
7411
7429
  }
7412
7430
  /** Parse a hex color string like #RRGGBB or #RRGGBBAA into [r,g,b,a] floats. */
7413
7431
  function parseHexColor(hex) {
@@ -7473,12 +7491,11 @@ function parseResourceColors(xml) {
7473
7491
  }
7474
7492
  return resources;
7475
7493
  }
7476
- function parseModelXml(xml) {
7494
+ function parseMesh(body, objectAttrs, resourceColors) {
7477
7495
  const vertices = [];
7478
7496
  const triangles = [];
7479
7497
  const triangleColors = [];
7480
- const resourceColors = parseResourceColors(xml);
7481
- for (const tag of findTags(xml, "vertex")) {
7498
+ for (const tag of findTags(body, "vertex")) {
7482
7499
  const a = parseTagAttrs(tag);
7483
7500
  if (a["x"] !== void 0 && a["y"] !== void 0 && a["z"] !== void 0) vertices.push([
7484
7501
  parseFloat(a["x"]),
@@ -7486,18 +7503,7 @@ function parseModelXml(xml) {
7486
7503
  parseFloat(a["z"])
7487
7504
  ]);
7488
7505
  }
7489
- let objectDefaultPid = null;
7490
- let objectDefaultPindex = null;
7491
- const objectBlock = findTagBlock(xml, "object");
7492
- if (objectBlock !== null) {
7493
- const objTagEnd = objectBlock.indexOf(">");
7494
- if (objTagEnd >= 0) {
7495
- const objAttrs = parseTagAttrs(objectBlock.slice(0, objTagEnd + 1));
7496
- if (objAttrs["pid"] !== void 0) objectDefaultPid = parseInt(objAttrs["pid"], 10);
7497
- if (objAttrs["pindex"] !== void 0) objectDefaultPindex = parseInt(objAttrs["pindex"], 10);
7498
- }
7499
- }
7500
- for (const tag of findTags(xml, "triangle")) {
7506
+ for (const tag of findTags(body, "triangle")) {
7501
7507
  const a = parseTagAttrs(tag);
7502
7508
  if (a["v1"] !== void 0 && a["v2"] !== void 0 && a["v3"] !== void 0) {
7503
7509
  triangles.push([
@@ -7506,8 +7512,8 @@ function parseModelXml(xml) {
7506
7512
  parseInt(a["v3"], 10)
7507
7513
  ]);
7508
7514
  let color = null;
7509
- const pidStr = a["pid"] ?? (objectDefaultPid !== null ? String(objectDefaultPid) : void 0);
7510
- const p1Str = a["p1"] ?? (objectDefaultPindex !== null ? String(objectDefaultPindex) : void 0);
7515
+ const pidStr = a["pid"] ?? objectAttrs["pid"];
7516
+ const p1Str = a["p1"] ?? objectAttrs["pindex"];
7511
7517
  if (pidStr !== void 0 && p1Str !== void 0) {
7512
7518
  const pid = parseInt(pidStr, 10);
7513
7519
  const p1 = parseInt(p1Str, 10);
@@ -7523,6 +7529,135 @@ function parseModelXml(xml) {
7523
7529
  triangleColors
7524
7530
  };
7525
7531
  }
7532
+ function parseTransform(value) {
7533
+ if (value === void 0) return null;
7534
+ const m = value.trim().split(/\s+/).map(Number);
7535
+ return m.length === 12 && m.every(Number.isFinite) ? m : null;
7536
+ }
7537
+ function parseObjectRefs(tags) {
7538
+ const refs = [];
7539
+ for (const tag of tags) {
7540
+ const a = parseTagAttrs(tag);
7541
+ const objectId = a["objectid"];
7542
+ if (objectId !== void 0) refs.push({
7543
+ objectId,
7544
+ transform: parseTransform(a["transform"])
7545
+ });
7546
+ }
7547
+ return refs;
7548
+ }
7549
+ /** `inner` then `outer`: with row vectors that is the matrix product inner × outer. */
7550
+ function composeTransforms$1(inner, outer) {
7551
+ if (inner === null) return outer;
7552
+ if (outer === null) return inner;
7553
+ const out = [];
7554
+ for (let row = 0; row < 4; row++) for (let col = 0; col < 3; col++) {
7555
+ let sum = row === 3 ? outer[9 + col] ?? 0 : 0;
7556
+ for (let k = 0; k < 3; k++) sum += (inner[row * 3 + k] ?? 0) * (outer[k * 3 + col] ?? 0);
7557
+ out.push(sum);
7558
+ }
7559
+ return out;
7560
+ }
7561
+ function transformMesh(mesh, m) {
7562
+ if (m === null) return mesh;
7563
+ const [m0 = 0, m1 = 0, m2 = 0, m3 = 0, m4 = 0, m5 = 0, m6 = 0, m7 = 0, m8 = 0] = m;
7564
+ const [m9 = 0, m10 = 0, m11 = 0] = m.slice(9);
7565
+ return {
7566
+ vertices: mesh.vertices.map(([x, y, z]) => [
7567
+ x * m0 + y * m3 + z * m6 + m9,
7568
+ x * m1 + y * m4 + z * m7 + m10,
7569
+ x * m2 + y * m5 + z * m8 + m11
7570
+ ]),
7571
+ triangles: m0 * (m4 * m8 - m5 * m7) - m1 * (m3 * m8 - m5 * m6) + m2 * (m3 * m7 - m4 * m6) < 0 ? mesh.triangles.map(([a, b, c]) => [
7572
+ a,
7573
+ c,
7574
+ b
7575
+ ]) : mesh.triangles,
7576
+ triangleColors: mesh.triangleColors
7577
+ };
7578
+ }
7579
+ /** Place `ref` and its components into `out`; returns why it stopped early, or `null`. */
7580
+ function instantiate(objects, ref, outer, ancestors, out) {
7581
+ const object = objects.get(ref.objectId);
7582
+ if (object === void 0 || ancestors.has(ref.objectId)) return null;
7583
+ if (ancestors.size > MAX_COMPONENT_DEPTH) return `components nest more than ${MAX_COMPONENT_DEPTH} levels deep`;
7584
+ if (++out.objects > MAX_PLACED_OBJECTS) return `the build places more than ${MAX_PLACED_OBJECTS.toLocaleString("en-US")} objects`;
7585
+ const transform = composeTransforms$1(ref.transform, outer);
7586
+ if (object.mesh !== null && object.mesh.triangles.length > 0) {
7587
+ out.triangles += object.mesh.triangles.length;
7588
+ if (out.triangles > MAX_PLACED_TRIANGLES) return `the build places more than ${MAX_PLACED_TRIANGLES.toLocaleString("en-US")} triangles`;
7589
+ out.vertices += object.mesh.vertices.length;
7590
+ if (out.vertices > MAX_PLACED_VERTICES) return `the build places more than ${MAX_PLACED_VERTICES.toLocaleString("en-US")} vertices`;
7591
+ out.meshes.push(transformMesh(object.mesh, transform));
7592
+ }
7593
+ ancestors.add(ref.objectId);
7594
+ try {
7595
+ for (const component of object.components) {
7596
+ const stopped = instantiate(objects, component, transform, ancestors, out);
7597
+ if (stopped !== null) return stopped;
7598
+ }
7599
+ } finally {
7600
+ ancestors.delete(ref.objectId);
7601
+ }
7602
+ return null;
7603
+ }
7604
+ /**
7605
+ * Parse the model XML into one mesh per placed object, in millimeters.
7606
+ *
7607
+ * Each object keeps its own vertex list (triangle indices are per object), build
7608
+ * items and components contribute their transforms, and the model `unit` scales
7609
+ * coordinates to millimeters. Fails once the build expands past
7610
+ * {@link MAX_PLACED_OBJECTS} placements, {@link MAX_PLACED_TRIANGLES} triangles,
7611
+ * or {@link MAX_PLACED_VERTICES} vertices, or nests deeper than
7612
+ * {@link MAX_COMPONENT_DEPTH} levels.
7613
+ */
7614
+ function parseModelXml(xml) {
7615
+ const resourceColors = parseResourceColors(xml);
7616
+ const modelTag = findTags(xml, "model")[0];
7617
+ const mm = MM_PER_UNIT[(modelTag !== void 0 ? parseTagAttrs(modelTag)["unit"] : void 0) ?? "millimeter"] ?? 1;
7618
+ const toMillimeters = mm === 1 ? null : [
7619
+ mm,
7620
+ 0,
7621
+ 0,
7622
+ 0,
7623
+ mm,
7624
+ 0,
7625
+ 0,
7626
+ 0,
7627
+ mm,
7628
+ 0,
7629
+ 0,
7630
+ 0
7631
+ ];
7632
+ const objects = /* @__PURE__ */ new Map();
7633
+ for (const { tag, body } of findElements(xml, "object")) {
7634
+ const attrs = parseTagAttrs(tag);
7635
+ const id = attrs["id"];
7636
+ if (id === void 0) continue;
7637
+ const meshElement = findElements(body, "mesh")[0];
7638
+ objects.set(id, {
7639
+ mesh: meshElement ? parseMesh(meshElement.body, attrs, resourceColors) : null,
7640
+ components: parseObjectRefs(findTags(body, "component"))
7641
+ });
7642
+ }
7643
+ const build = findElements(xml, "build")[0];
7644
+ let items = build ? parseObjectRefs(findTags(build.body, "item")) : [];
7645
+ if (items.length === 0) items = [...objects].filter(([, object]) => object.mesh !== null).map(([objectId]) => ({
7646
+ objectId,
7647
+ transform: null
7648
+ }));
7649
+ const expansion = {
7650
+ meshes: [],
7651
+ objects: 0,
7652
+ triangles: 0,
7653
+ vertices: 0
7654
+ };
7655
+ for (const item of items) {
7656
+ const stopped = instantiate(objects, item, toMillimeters, /* @__PURE__ */ new Set(), expansion);
7657
+ if (stopped !== null) return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, `3MF model is too large to import: ${stopped}`));
7658
+ }
7659
+ return ok(expansion.meshes.filter((m) => m.vertices.length > 0 && m.triangles.length > 0));
7660
+ }
7526
7661
  /** Find the most common non-null color across all triangle colors. */
7527
7662
  function findDominantColor(triangleColors) {
7528
7663
  const counts = /* @__PURE__ */ new Map();
@@ -7567,14 +7702,34 @@ function buildSolidFromMesh(mesh) {
7567
7702
  return sewMeshToSolid(triangles, BrepErrorCode.THREEMF_IMPORT_FAILED);
7568
7703
  }
7569
7704
  }
7705
+ /** One solid per mesh; several are grouped into a compound that takes ownership of them. */
7706
+ function buildShapeFromMeshes(meshes) {
7707
+ const solids = [];
7708
+ for (const mesh of meshes) {
7709
+ const solid = buildSolidFromMesh(mesh);
7710
+ if (!solid.ok) {
7711
+ for (const built of solids) built[Symbol.dispose]();
7712
+ return solid;
7713
+ }
7714
+ solids.push(solid.value);
7715
+ }
7716
+ const [first] = solids;
7717
+ if (solids.length === 1 && first !== void 0) return ok(first);
7718
+ const compound = makeCompound(solids);
7719
+ for (const built of solids) built[Symbol.dispose]();
7720
+ return ok(compound);
7721
+ }
7570
7722
  /**
7571
7723
  * Import a 3MF file from a Blob.
7572
7724
  *
7573
- * Extracts the model XML from the ZIP archive, parses vertices and triangles,
7574
- * and builds a solid by sewing the resulting triangular faces.
7725
+ * Extracts the model XML from the ZIP archive and builds one solid per placed
7726
+ * object by sewing its triangles. Build-item and component transforms are
7727
+ * applied, and coordinates are scaled from the model `unit` to millimeters.
7575
7728
  *
7576
7729
  * @param blob - A Blob or File containing 3MF data (.3mf).
7577
- * @returns A `Result` wrapping the imported solid, or an error if parsing fails.
7730
+ * @returns A `Result` wrapping the imported solid (a `Compound` of solids when the
7731
+ * build places several objects), or an error if parsing fails or the build
7732
+ * expands to more than 100,000 placed objects or 2,000,000 triangles.
7578
7733
  *
7579
7734
  * @example
7580
7735
  * ```ts
@@ -7588,13 +7743,15 @@ async function importThreeMF(blob) {
7588
7743
  const modelData = extractFromZip(new Uint8Array(arrayBuf), "3D/3dmodel.model");
7589
7744
  if (!modelData) return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "3MF archive does not contain 3D/3dmodel.model (or uses unsupported compression)"));
7590
7745
  const parsed = parseModelXml(new TextDecoder().decode(modelData));
7591
- if (parsed.vertices.length === 0 || parsed.triangles.length === 0) return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "3MF model contains no valid geometry"));
7592
- const solid = buildSolidFromMesh(parsed);
7593
- if (solid.ok) {
7594
- const dominantColor = findDominantColor(parsed.triangleColors);
7595
- if (dominantColor !== null) colorShape(solid.value, dominantColor);
7746
+ if (!parsed.ok) return parsed;
7747
+ const meshes = parsed.value;
7748
+ if (meshes.length === 0) return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "3MF model contains no valid geometry"));
7749
+ const shape = buildShapeFromMeshes(meshes);
7750
+ if (shape.ok) {
7751
+ const dominantColor = findDominantColor(meshes.flatMap((m) => m.triangleColors));
7752
+ if (dominantColor !== null) colorShape(shape.value, dominantColor);
7596
7753
  }
7597
- return solid;
7754
+ return shape;
7598
7755
  } catch (e) {
7599
7756
  const msg = e instanceof Error ? e.message : String(e);
7600
7757
  return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, `3MF import failed: ${msg}`, e));
@@ -1,8 +1,8 @@
1
- const require_shapeTypes = require("./shapeTypes-Dc7j-MYg.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DmThK_oa.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-5Frx8Y-0.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-CXbCFaU2.cjs");
4
4
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
5
- const require_shapeFns = require("./shapeFns-C0w8vvfb.cjs");
5
+ const require_shapeFns = require("./shapeFns-Bs92VrZh.cjs");
6
6
  // src/projection/projectionPlanes.ts
7
7
  /** Lookup table mapping each {@link ProjectionPlane} to its camera configuration. */
8
8
  var PROJECTION_PLANES = {
@@ -1,8 +1,8 @@
1
- import { G as _usingCtx, n as castResultShape, q as getKernel } from "./shapeTypes-DwvQUp9M.js";
1
+ import { G as _usingCtx, n as castResultShape, q as getKernel } from "./shapeTypes-CIH-8d_a.js";
2
2
  import { E as ok, P as unwrap, d as validationError, g as err } from "./errors-BTccWbtE.js";
3
- import { s as getEdges } from "./topologyQueryFns-LXV1nTaS.js";
3
+ import { s as getEdges } from "./topologyQueryFns-Cp0yekBh.js";
4
4
  import { c as vecLength, d as vecNormalize, g as vecSub, r as vecCross } from "./vecOps-S-m9H_fe.js";
5
- import { t as clone } from "./shapeFns-CgqKICF_.js";
5
+ import { t as clone } from "./shapeFns-TWdr4Dv4.js";
6
6
  // src/projection/projectionPlanes.ts
7
7
  /** Lookup table mapping each {@link ProjectionPlane} to its camera configuration. */
8
8
  var PROJECTION_PLANES = {
package/dist/core.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeTypes = require("./shapeTypes-Dc7j-MYg.cjs");
2
+ const require_shapeTypes = require("./shapeTypes-DmThK_oa.cjs");
3
3
  const require_bug = require("./bug-CBcpIPuf.cjs");
4
4
  const require_errors = require("./errors-O_blYTWT.cjs");
5
- const require_validityTypes = require("./validityTypes-C6rROGTP.cjs");
5
+ const require_validityTypes = require("./validityTypes-m6eLRTYE.cjs");
6
6
  const require_constants = require("./constants-oee0S_x6.cjs");
7
7
  const require_types = require("./types-CjF9Rofr.cjs");
8
8
  const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
package/dist/core.js CHANGED
@@ -1,7 +1,7 @@
1
- import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, H as withScope, L as isLive, M as is3D, N as DisposalScope, P as createHandle, S as isShell, T as isWire, U as withScopeResult, W as withScopeResultAsync, _ as isCompound, b as isShape1D, i as castShape, j as is2D, v as isEdge, w as isVertex, x as isShape3D, y as isFace } from "./shapeTypes-DwvQUp9M.js";
1
+ import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, H as withScope, L as isLive, M as is3D, N as DisposalScope, P as createHandle, S as isShell, T as isWire, U as withScopeResult, W as withScopeResultAsync, _ as isCompound, b as isShape1D, i as castShape, j as is2D, v as isEdge, w as isVertex, x as isShape3D, y as isFace } from "./shapeTypes-CIH-8d_a.js";
2
2
  import { n as bug, t as BrepBugError } from "./bug-ClMTAJhe.js";
3
3
  import { E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, P as unwrap, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, l as typeCastError, m as andThen, n as computationError, o as queryError, r as ioError, u as unsupportedError, w as mapErr, x as isOk } from "./errors-BTccWbtE.js";
4
- import { c as manifoldShell, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, r as isManifoldShell, s as isValidSolid, t as closedWire } from "./validityTypes-DM-Iwe8N.js";
4
+ import { c as manifoldShell, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, r as isManifoldShell, s as isValidSolid, t as closedWire } from "./validityTypes-DlrWkrSR.js";
5
5
  import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-iraOnb2p.js";
6
6
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-CKXsIm9-.js";
7
7
  import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane, g as vecSub, h as vecScale, i as vecDistance, l as vecLengthSq, m as vecRotate, n as vecAngle, o as vecEquals, p as vecRepr, r as vecCross, s as vecIsZero, t as vecAdd, u as vecNegate } from "./vecOps-S-m9H_fe.js";
@@ -1,6 +1,6 @@
1
1
  const require_constants = require("./constants-oee0S_x6.cjs");
2
2
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
3
- const require_helpers = require("./helpers-DKEVm6Hu.cjs");
3
+ const require_helpers = require("./helpers-DJQeDf_5.cjs");
4
4
  // src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,6 +1,6 @@
1
1
  import { t as DEG2RAD } from "./constants-iraOnb2p.js";
2
2
  import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
3
- import { p as distance2d, u as angle2d, v as samePoint } from "./helpers-D2hANLRu.js";
3
+ import { p as distance2d, u as angle2d, v as samePoint } from "./helpers-DPHQt2Kr.js";
4
4
  // src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,4 +1,4 @@
1
- const require_shapeTypes = require("./shapeTypes-Dc7j-MYg.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DmThK_oa.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
3
  // src/topology/curveFns.ts
4
4
  /**