brepjs 8.4.0 → 8.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +13 -13
  3. package/dist/{Blueprint-Bp45tnh0.js → Blueprint-BihoXiSm.js} +29 -117
  4. package/dist/{Blueprint-zgFe_5Qj.cjs → Blueprint-DEhjUTv4.cjs} +11 -99
  5. package/dist/{boolean2D-DN6ETTCq.js → boolean2D-B7MAHWWy.js} +23 -24
  6. package/dist/{boolean2D-CfEbRMPF.cjs → boolean2D-BMw-2GRS.cjs} +24 -25
  7. package/dist/{booleanFns-5dDG0jpA.cjs → booleanFns-BOrYk5DW.cjs} +303 -5
  8. package/dist/booleanFns-CxU6z_LD.js +600 -0
  9. package/dist/brepjs.cjs +1619 -71
  10. package/dist/brepjs.js +1880 -333
  11. package/dist/core/errors.d.ts +18 -0
  12. package/dist/core/errors.d.ts.map +1 -1
  13. package/dist/core.cjs +4 -4
  14. package/dist/core.js +4 -4
  15. package/dist/{cornerFinder-CC_MunIh.js → cornerFinder-Dh6RKiNy.js} +1 -1
  16. package/dist/{cornerFinder-BQ-_VJx0.cjs → cornerFinder-DilC5fiE.cjs} +1 -1
  17. package/dist/{curveFns-ZuQUBZvd.js → curveFns-BJG6oqMt.js} +19 -17
  18. package/dist/{curveFns-VMxgfkqw.cjs → curveFns-BT8cTVDA.cjs} +6 -4
  19. package/dist/{drawFns-CKaHgGSK.cjs → drawFns-DcEDgZzq.cjs} +63 -37
  20. package/dist/{drawFns-BbhX1IUq.js → drawFns-aKd56G2a.js} +47 -21
  21. package/dist/{errors-CSYOlCCR.js → errors-Coh_5_19.js} +26 -1
  22. package/dist/{errors-D13q2HCk.cjs → errors-eRQu29oc.cjs} +26 -1
  23. package/dist/{faceFns-es3GENII.cjs → faceFns-B8fGirMy.cjs} +103 -6
  24. package/dist/{faceFns-CfJIbHY3.js → faceFns-C8ye0H_K.js} +109 -12
  25. package/dist/{helpers-CmVkMubc.js → helpers-8QToWU3Q.js} +16 -17
  26. package/dist/{helpers-C0q_FVxq.cjs → helpers-MiJaYJMA.cjs} +8 -9
  27. package/dist/index.d.ts +18 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/io/dxfImportFns.d.ts +17 -0
  30. package/dist/io/dxfImportFns.d.ts.map +1 -0
  31. package/dist/io/objImportFns.d.ts +19 -0
  32. package/dist/io/objImportFns.d.ts.map +1 -0
  33. package/dist/io/threemfImportFns.d.ts +19 -0
  34. package/dist/io/threemfImportFns.d.ts.map +1 -0
  35. package/dist/io.cjs +13 -11
  36. package/dist/io.js +13 -11
  37. package/dist/kernel/booleanOps.d.ts.map +1 -1
  38. package/dist/kernel/hullOps.d.ts +1 -0
  39. package/dist/kernel/hullOps.d.ts.map +1 -1
  40. package/dist/kernel/occtAdapter.d.ts +5 -0
  41. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  42. package/dist/kernel/solverAdapter.d.ts +39 -0
  43. package/dist/kernel/solverAdapter.d.ts.map +1 -0
  44. package/dist/kernel/types.d.ts +5 -0
  45. package/dist/kernel/types.d.ts.map +1 -1
  46. package/dist/{loft-oJq2OD3A.js → loft-C810lPN5.js} +16 -16
  47. package/dist/{loft-B-UCPW9P.cjs → loft-DCEZpu53.cjs} +28 -28
  48. package/dist/measurement/measureCache.d.ts +11 -0
  49. package/dist/measurement/measureCache.d.ts.map +1 -0
  50. package/dist/measurement/measureFns.d.ts.map +1 -1
  51. package/dist/{measurement-CYmT-C77.cjs → measurement-BFotSPr0.cjs} +30 -6
  52. package/dist/{measurement-Cf_SoIiR.js → measurement-BT2jlvKC.js} +30 -6
  53. package/dist/measurement.cjs +1 -1
  54. package/dist/measurement.js +1 -1
  55. package/dist/{meshFns-DDC_2U81.cjs → meshFns-CxYud6A4.cjs} +4 -4
  56. package/dist/{meshFns-CqNwW0PO.js → meshFns-DPbSUo0q.js} +4 -4
  57. package/dist/{occtBoundary-CocN2VKx.cjs → occtBoundary-ChEJsbOT.cjs} +18 -0
  58. package/dist/{occtBoundary-D_gjqgzo.js → occtBoundary-DC1yVJex.js} +23 -5
  59. package/dist/operations/assemblyFns.d.ts +1 -0
  60. package/dist/operations/assemblyFns.d.ts.map +1 -1
  61. package/dist/operations/guidedSweepFns.d.ts +25 -0
  62. package/dist/operations/guidedSweepFns.d.ts.map +1 -0
  63. package/dist/operations/mateFns.d.ts +50 -0
  64. package/dist/operations/mateFns.d.ts.map +1 -0
  65. package/dist/operations/multiSweepFns.d.ts +32 -0
  66. package/dist/operations/multiSweepFns.d.ts.map +1 -0
  67. package/dist/operations/roofFns.d.ts +16 -0
  68. package/dist/operations/roofFns.d.ts.map +1 -0
  69. package/dist/operations/straightSkeleton.d.ts +28 -0
  70. package/dist/operations/straightSkeleton.d.ts.map +1 -0
  71. package/dist/{operations-BQeW_DSM.cjs → operations-CckDdRJ0.cjs} +7 -7
  72. package/dist/{operations-6hdpuYmY.js → operations-IFpeXZme.js} +15 -15
  73. package/dist/operations.cjs +2 -2
  74. package/dist/operations.js +13 -13
  75. package/dist/query.cjs +5 -5
  76. package/dist/query.js +7 -7
  77. package/dist/result.cjs +1 -1
  78. package/dist/result.js +1 -1
  79. package/dist/{shapeFns-k1YHFwmB.js → shapeFns-BTnqah-6.js} +52 -19
  80. package/dist/{shapeFns-B0zSdO9c.cjs → shapeFns-CQWvvjmd.cjs} +54 -21
  81. package/dist/{shapeTypes-c-_pgYCx.js → shapeTypes-BVd0rRNe.js} +13 -13
  82. package/dist/{shapeTypes-BxVxLdiD.cjs → shapeTypes-MK0PKst9.cjs} +1 -1
  83. package/dist/sketching.cjs +2 -2
  84. package/dist/sketching.js +2 -2
  85. package/dist/{curveBuilders-BkEJ-RVn.cjs → surfaceBuilders-5Ci2Du77.cjs} +96 -3
  86. package/dist/{curveBuilders-BREwqvuc.js → surfaceBuilders-nuWe3gns.js} +106 -13
  87. package/dist/text/textBlueprints.d.ts +38 -0
  88. package/dist/text/textBlueprints.d.ts.map +1 -1
  89. package/dist/topology/api.d.ts +5 -0
  90. package/dist/topology/api.d.ts.map +1 -1
  91. package/dist/topology/booleanFns.d.ts +10 -1
  92. package/dist/topology/booleanFns.d.ts.map +1 -1
  93. package/dist/topology/colorFns.d.ts +38 -0
  94. package/dist/topology/colorFns.d.ts.map +1 -0
  95. package/dist/topology/curveFns.d.ts +1 -1
  96. package/dist/topology/curveFns.d.ts.map +1 -1
  97. package/dist/topology/faceTagFns.d.ts +44 -0
  98. package/dist/topology/faceTagFns.d.ts.map +1 -0
  99. package/dist/topology/meshFns.d.ts +1 -1
  100. package/dist/topology/meshFns.d.ts.map +1 -1
  101. package/dist/topology/modifierFns.d.ts.map +1 -1
  102. package/dist/topology/polyhedronFns.d.ts +8 -0
  103. package/dist/topology/polyhedronFns.d.ts.map +1 -0
  104. package/dist/topology/shapeFns.d.ts +4 -0
  105. package/dist/topology/shapeFns.d.ts.map +1 -1
  106. package/dist/topology/surfaceBuilders.d.ts +7 -0
  107. package/dist/topology/surfaceBuilders.d.ts.map +1 -1
  108. package/dist/topology/surfaceFns.d.ts +38 -0
  109. package/dist/topology/surfaceFns.d.ts.map +1 -0
  110. package/dist/{topology-CycEc6Oe.cjs → topology-C06jndeV.cjs} +20 -21
  111. package/dist/{topology-tMKHJgw2.js → topology-P-u0NDwX.js} +9 -10
  112. package/dist/topology.cjs +13 -14
  113. package/dist/topology.js +51 -52
  114. package/dist/{vectors-DE0XriuQ.js → vectors-Dp17lKnm.js} +2 -2
  115. package/dist/{vectors-DVmHF4zt.cjs → vectors-DrAMMsHl.cjs} +2 -2
  116. package/dist/vectors.cjs +2 -2
  117. package/dist/vectors.js +2 -2
  118. package/package.json +4 -3
  119. package/dist/booleanFns-C-M6qqvB.js +0 -302
  120. package/dist/cast-CPNOTNFm.cjs +0 -102
  121. package/dist/cast-Cerqtxtb.js +0 -103
package/dist/2d.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
4
- const boolean2D = require("./boolean2D-CfEbRMPF.cjs");
3
+ const Blueprint = require("./Blueprint-DEhjUTv4.cjs");
4
+ const boolean2D = require("./boolean2D-BMw-2GRS.cjs");
5
5
  function reverseCurve(curve) {
6
6
  const cloned = curve.clone();
7
7
  cloned.reverse();
package/dist/2d.js CHANGED
@@ -1,6 +1,6 @@
1
- import { B as Blueprint } from "./Blueprint-Bp45tnh0.js";
2
- import { e, C, f } from "./Blueprint-Bp45tnh0.js";
3
- import { b, C as C2, c, d, f as f2, e as e2, i, g, o, p, r } from "./boolean2D-DN6ETTCq.js";
1
+ import { B as Blueprint } from "./Blueprint-BihoXiSm.js";
2
+ import { d, C, r } from "./Blueprint-BihoXiSm.js";
3
+ import { e, C as C2, f, l, g, n, k, q, o, p, r as r2 } from "./boolean2D-B7MAHWWy.js";
4
4
  function reverseCurve(curve) {
5
5
  const cloned = curve.clone();
6
6
  cloned.reverse();
@@ -68,11 +68,11 @@ function sketch2DOnFace(bp, face, scaleMode) {
68
68
  }
69
69
  export {
70
70
  Blueprint,
71
- b as Blueprints,
72
- e as BoundingBox2d,
71
+ e as Blueprints,
72
+ d as BoundingBox2d,
73
73
  C2 as CompoundBlueprint,
74
74
  C as Curve2D,
75
- f as axis2d,
75
+ r as axis2d,
76
76
  createBlueprint,
77
77
  curve2dBoundingBox,
78
78
  curve2dDistanceFrom,
@@ -82,21 +82,21 @@ export {
82
82
  curve2dParameter,
83
83
  curve2dSplitAt,
84
84
  curve2dTangentAt,
85
- c as cut2D,
86
- d as cutBlueprints,
87
- f2 as fuse2D,
88
- e2 as fuseBlueprints,
85
+ f as cut2D,
86
+ l as cutBlueprints,
87
+ g as fuse2D,
88
+ n as fuseBlueprints,
89
89
  getBounds2D,
90
90
  getOrientation2D,
91
- i as intersect2D,
92
- g as intersectBlueprints,
91
+ k as intersect2D,
92
+ q as intersectBlueprints,
93
93
  isInside2D,
94
94
  mirror2D,
95
95
  o as organiseBlueprints,
96
96
  p as polysidesBlueprint,
97
97
  reverseCurve,
98
98
  rotate2D,
99
- r as roundedRectangleBlueprint,
99
+ r2 as roundedRectangleBlueprint,
100
100
  scale2D,
101
101
  sketch2DOnFace,
102
102
  sketch2DOnPlane,
@@ -1,14 +1,12 @@
1
- import { r as resolvePlane } from "./vectors-DE0XriuQ.js";
2
- import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-D_gjqgzo.js";
3
- import { t as localGC, u as createFace, e as isFace, y as registerForCleanup, z as unregisterFromCleanup, p as gcWithScope, o as createEdge, n as createWire } from "./shapeTypes-c-_pgYCx.js";
4
- import { u as uvBounds, a as faceGeomType, f as faceCenter, h as uvCoordinates } from "./faceFns-CfJIbHY3.js";
5
- import { j as findCurveType, m as getOrientation } from "./curveFns-ZuQUBZvd.js";
6
- import { e as err, o as occtError, l as ok, a as andThen, x as validationError, u as unwrap, b as computationError } from "./errors-CSYOlCCR.js";
7
- import { d as distance2d, s as samePoint, k as scalarMultiply2d, i as add2d, n as normalize2d, h as subtract2d, g as getSingleFace } from "./helpers-CmVkMubc.js";
8
- import { c as cast } from "./cast-Cerqtxtb.js";
1
+ import { r as resolvePlane } from "./vectors-Dp17lKnm.js";
2
+ import { g as getKernel, a as toVec3, c as makeOcAx2 } from "./occtBoundary-DC1yVJex.js";
3
+ import { r as localGC, v as registerForCleanup, x as unregisterFromCleanup, n as gcWithScope, p as createEdge, o as createWire } from "./shapeTypes-BVd0rRNe.js";
4
+ import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-C8ye0H_K.js";
5
+ import { f as findCurveType, g as getOrientation } from "./curveFns-BJG6oqMt.js";
6
+ import { u as unwrap, l as ok, e as err, b as computationError, x as validationError } from "./errors-Coh_5_19.js";
7
+ import { z as zip, m as makeFace } from "./surfaceBuilders-nuWe3gns.js";
8
+ import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-8QToWU3Q.js";
9
9
  import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
10
- import { e as getEdges } from "./shapeFns-k1YHFwmB.js";
11
- import { m as makeLine, a as assembleWire$1 } from "./curveBuilders-BREwqvuc.js";
12
10
  import { bug } from "./result.js";
13
11
  function makePlane(plane, origin) {
14
12
  if (plane && typeof plane !== "string") {
@@ -45,86 +43,6 @@ function mirror(shape, inputPlane, origin) {
45
43
  gc();
46
44
  return newShape;
47
45
  }
48
- function range(len) {
49
- return Array.from(Array(len).keys());
50
- }
51
- function zip(arrays) {
52
- const minLength = Math.min(...arrays.map((arr) => arr.length));
53
- return range(minLength).map((i) => arrays.map((arr) => arr[i]));
54
- }
55
- function makeFace(wire, holes) {
56
- const oc = getKernel().oc;
57
- const faceBuilder = new oc.BRepBuilderAPI_MakeFace_15(wire.wrapped, false);
58
- holes?.forEach((hole) => {
59
- faceBuilder.Add(hole.wrapped);
60
- });
61
- if (!faceBuilder.IsDone()) {
62
- faceBuilder.delete();
63
- return err(
64
- occtError("FACE_BUILD_FAILED", "Failed to build the face. Your wire might be non planar.")
65
- );
66
- }
67
- const face = faceBuilder.Face();
68
- faceBuilder.delete();
69
- return ok(createFace(face));
70
- }
71
- function makeNewFaceWithinFace(originFace, wire) {
72
- const oc = getKernel().oc;
73
- const [r, gc] = localGC();
74
- const surface = r(oc.BRep_Tool.Surface_2(originFace.wrapped));
75
- const faceBuilder = r(new oc.BRepBuilderAPI_MakeFace_21(surface, wire.wrapped, true));
76
- const face = faceBuilder.Face();
77
- gc();
78
- return createFace(face);
79
- }
80
- function makeNonPlanarFace(wire) {
81
- const oc = getKernel().oc;
82
- const [r, gc] = localGC();
83
- const faceBuilder = r(
84
- new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
85
- );
86
- getEdges(wire).forEach((edge) => {
87
- faceBuilder.Add_1(
88
- edge.wrapped,
89
- oc.GeomAbs_Shape.GeomAbs_C0,
90
- true
91
- );
92
- });
93
- const progress = r(new oc.Message_ProgressRange_1());
94
- faceBuilder.Build(progress);
95
- return andThen(cast(faceBuilder.Shape()), (newFace) => {
96
- gc();
97
- if (!isFace(newFace)) {
98
- return err(occtError("FACE_BUILD_FAILED", "Failed to create a face"));
99
- }
100
- return ok(newFace);
101
- });
102
- }
103
- function addHolesInFace(face, holes) {
104
- const oc = getKernel().oc;
105
- const [r, gc] = localGC();
106
- const faceMaker = r(new oc.BRepBuilderAPI_MakeFace_2(face.wrapped));
107
- holes.forEach((wire) => {
108
- faceMaker.Add(wire.wrapped);
109
- });
110
- const builtFace = r(faceMaker.Face());
111
- const fixer = r(new oc.ShapeFix_Face_2(builtFace));
112
- fixer.FixOrientation_1();
113
- const newFace = fixer.Face();
114
- gc();
115
- return createFace(newFace);
116
- }
117
- function makePolygon(points) {
118
- if (points.length < 3)
119
- return err(
120
- validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon")
121
- );
122
- const edges = zip([points, [...points.slice(1), points[0]]]).map(
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- zip returns untyped pairs
124
- ([p1, p2]) => makeLine(p1, p2)
125
- );
126
- return andThen(assembleWire$1(edges), (wire) => makeFace(wire));
127
- }
128
46
  function isPoint2D(point) {
129
47
  return Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number";
130
48
  }
@@ -1242,33 +1160,27 @@ class Blueprint {
1242
1160
  }
1243
1161
  }
1244
1162
  export {
1245
- removeDuplicatePoints as A,
1246
1163
  Blueprint as B,
1247
1164
  Curve2D as C,
1248
- addHolesInFace as a,
1249
- makeNonPlanarFace as b,
1250
- makePolygon as c,
1251
- makeNewFaceWithinFace as d,
1252
- BoundingBox2d as e,
1253
- axis2d as f,
1254
- makePlane as g,
1255
- mirror as h,
1256
- make2dSegmentCurve as i,
1257
- make2dArcFromCenter as j,
1258
- approximateAsSvgCompatibleCurve as k,
1259
- edgeToCurve as l,
1260
- makeFace as m,
1261
- make2dInerpolatedBSplineCurve as n,
1262
- make2dCircle as o,
1263
- make2dEllipse as p,
1264
- deserializeCurve2D as q,
1265
- approximateAsBSpline as r,
1266
- isPoint2D as s,
1267
- make2dThreePointArc as t,
1268
- asSVG as u,
1269
- viewbox as v,
1270
- make2dEllipseArc as w,
1271
- make2dTangentArc as x,
1272
- make2dBezierCurve as y,
1273
- zip as z
1165
+ make2dSegmentCurve as a,
1166
+ make2dArcFromCenter as b,
1167
+ approximateAsSvgCompatibleCurve as c,
1168
+ BoundingBox2d as d,
1169
+ edgeToCurve as e,
1170
+ make2dInerpolatedBSplineCurve as f,
1171
+ make2dCircle as g,
1172
+ make2dEllipse as h,
1173
+ deserializeCurve2D as i,
1174
+ approximateAsBSpline as j,
1175
+ isPoint2D as k,
1176
+ make2dThreePointArc as l,
1177
+ mirror as m,
1178
+ asSVG as n,
1179
+ make2dEllipseArc as o,
1180
+ make2dTangentArc as p,
1181
+ make2dBezierCurve as q,
1182
+ axis2d as r,
1183
+ removeDuplicatePoints as s,
1184
+ makePlane as t,
1185
+ viewbox as v
1274
1186
  };
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-DVmHF4zt.cjs");
3
- const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
4
- const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
5
- const faceFns = require("./faceFns-es3GENII.cjs");
6
- const curveFns = require("./curveFns-VMxgfkqw.cjs");
7
- const errors = require("./errors-D13q2HCk.cjs");
8
- const helpers = require("./helpers-C0q_FVxq.cjs");
9
- const cast = require("./cast-CPNOTNFm.cjs");
2
+ const vectors = require("./vectors-DrAMMsHl.cjs");
3
+ const occtBoundary = require("./occtBoundary-ChEJsbOT.cjs");
4
+ const shapeTypes = require("./shapeTypes-MK0PKst9.cjs");
5
+ const faceFns = require("./faceFns-B8fGirMy.cjs");
6
+ const curveFns = require("./curveFns-BT8cTVDA.cjs");
7
+ const errors = require("./errors-eRQu29oc.cjs");
8
+ const surfaceBuilders = require("./surfaceBuilders-5Ci2Du77.cjs");
9
+ const helpers = require("./helpers-MiJaYJMA.cjs");
10
10
  const vecOps = require("./vecOps-CjRL1jau.cjs");
11
- const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
12
- const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
13
11
  const result = require("./result.cjs");
14
12
  function makePlane(plane, origin) {
15
13
  if (plane && typeof plane !== "string") {
@@ -46,86 +44,6 @@ function mirror(shape, inputPlane, origin) {
46
44
  gc();
47
45
  return newShape;
48
46
  }
49
- function range(len) {
50
- return Array.from(Array(len).keys());
51
- }
52
- function zip(arrays) {
53
- const minLength = Math.min(...arrays.map((arr) => arr.length));
54
- return range(minLength).map((i) => arrays.map((arr) => arr[i]));
55
- }
56
- function makeFace(wire, holes) {
57
- const oc = occtBoundary.getKernel().oc;
58
- const faceBuilder = new oc.BRepBuilderAPI_MakeFace_15(wire.wrapped, false);
59
- holes?.forEach((hole) => {
60
- faceBuilder.Add(hole.wrapped);
61
- });
62
- if (!faceBuilder.IsDone()) {
63
- faceBuilder.delete();
64
- return errors.err(
65
- errors.occtError("FACE_BUILD_FAILED", "Failed to build the face. Your wire might be non planar.")
66
- );
67
- }
68
- const face = faceBuilder.Face();
69
- faceBuilder.delete();
70
- return errors.ok(shapeTypes.createFace(face));
71
- }
72
- function makeNewFaceWithinFace(originFace, wire) {
73
- const oc = occtBoundary.getKernel().oc;
74
- const [r, gc] = shapeTypes.localGC();
75
- const surface = r(oc.BRep_Tool.Surface_2(originFace.wrapped));
76
- const faceBuilder = r(new oc.BRepBuilderAPI_MakeFace_21(surface, wire.wrapped, true));
77
- const face = faceBuilder.Face();
78
- gc();
79
- return shapeTypes.createFace(face);
80
- }
81
- function makeNonPlanarFace(wire) {
82
- const oc = occtBoundary.getKernel().oc;
83
- const [r, gc] = shapeTypes.localGC();
84
- const faceBuilder = r(
85
- new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
86
- );
87
- shapeFns.getEdges(wire).forEach((edge) => {
88
- faceBuilder.Add_1(
89
- edge.wrapped,
90
- oc.GeomAbs_Shape.GeomAbs_C0,
91
- true
92
- );
93
- });
94
- const progress = r(new oc.Message_ProgressRange_1());
95
- faceBuilder.Build(progress);
96
- return errors.andThen(cast.cast(faceBuilder.Shape()), (newFace) => {
97
- gc();
98
- if (!shapeTypes.isFace(newFace)) {
99
- return errors.err(errors.occtError("FACE_BUILD_FAILED", "Failed to create a face"));
100
- }
101
- return errors.ok(newFace);
102
- });
103
- }
104
- function addHolesInFace(face, holes) {
105
- const oc = occtBoundary.getKernel().oc;
106
- const [r, gc] = shapeTypes.localGC();
107
- const faceMaker = r(new oc.BRepBuilderAPI_MakeFace_2(face.wrapped));
108
- holes.forEach((wire) => {
109
- faceMaker.Add(wire.wrapped);
110
- });
111
- const builtFace = r(faceMaker.Face());
112
- const fixer = r(new oc.ShapeFix_Face_2(builtFace));
113
- fixer.FixOrientation_1();
114
- const newFace = fixer.Face();
115
- gc();
116
- return shapeTypes.createFace(newFace);
117
- }
118
- function makePolygon(points) {
119
- if (points.length < 3)
120
- return errors.err(
121
- errors.validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon")
122
- );
123
- const edges = zip([points, [...points.slice(1), points[0]]]).map(
124
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- zip returns untyped pairs
125
- ([p1, p2]) => curveBuilders.makeLine(p1, p2)
126
- );
127
- return errors.andThen(curveBuilders.assembleWire(edges), (wire) => makeFace(wire));
128
- }
129
47
  function isPoint2D(point) {
130
48
  return Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number";
131
49
  }
@@ -493,7 +411,7 @@ class Curve2D {
493
411
  )
494
412
  parameters = parameters.slice(0, -1);
495
413
  if (!parameters.length) return [this];
496
- return zip([
414
+ return surfaceBuilders.zip([
497
415
  [firstParam, ...parameters],
498
416
  [...parameters, lastParam]
499
417
  ]).map(([first, last]) => {
@@ -1105,7 +1023,7 @@ class Blueprint {
1105
1023
  const originPoint = origin || [...faceFns.faceCenter(face)];
1106
1024
  const originVec3 = occtBoundary.toVec3(originPoint);
1107
1025
  const sketch = this.translate(faceFns.uvCoordinates(face, originVec3)).sketchOnFace(face, "original");
1108
- return errors.unwrap(makeFace(sketch.wire));
1026
+ return errors.unwrap(surfaceBuilders.makeFace(sketch.wire));
1109
1027
  }
1110
1028
  /**
1111
1029
  * Cut a prism-shaped hole through a solid along a face using this blueprint.
@@ -1142,7 +1060,7 @@ class Blueprint {
1142
1060
  } else {
1143
1061
  maker.PerformThruAll();
1144
1062
  }
1145
- return errors.unwrap(cast.cast(maker.Shape()));
1063
+ return errors.unwrap(faceFns.cast(maker.Shape()));
1146
1064
  }
1147
1065
  /** Convert the blueprint to an SVG path `d` attribute string. */
1148
1066
  toSVGPathD() {
@@ -1245,7 +1163,6 @@ class Blueprint {
1245
1163
  exports.Blueprint = Blueprint;
1246
1164
  exports.BoundingBox2d = BoundingBox2d;
1247
1165
  exports.Curve2D = Curve2D;
1248
- exports.addHolesInFace = addHolesInFace;
1249
1166
  exports.approximateAsBSpline = approximateAsBSpline;
1250
1167
  exports.approximateAsSvgCompatibleCurve = approximateAsSvgCompatibleCurve;
1251
1168
  exports.asSVG = asSVG;
@@ -1262,12 +1179,7 @@ exports.make2dInerpolatedBSplineCurve = make2dInerpolatedBSplineCurve;
1262
1179
  exports.make2dSegmentCurve = make2dSegmentCurve;
1263
1180
  exports.make2dTangentArc = make2dTangentArc;
1264
1181
  exports.make2dThreePointArc = make2dThreePointArc;
1265
- exports.makeFace = makeFace;
1266
- exports.makeNewFaceWithinFace = makeNewFaceWithinFace;
1267
- exports.makeNonPlanarFace = makeNonPlanarFace;
1268
1182
  exports.makePlane = makePlane;
1269
- exports.makePolygon = makePolygon;
1270
1183
  exports.mirror = mirror;
1271
1184
  exports.removeDuplicatePoints = removeDuplicatePoints;
1272
1185
  exports.viewbox = viewbox;
1273
- exports.zip = zip;
@@ -1,16 +1,15 @@
1
- import { a as createPlane } from "./vectors-DE0XriuQ.js";
2
- import { l as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-CSYOlCCR.js";
3
- import { d as downcast } from "./cast-Cerqtxtb.js";
4
- import { g as getKernel, a as toVec3 } from "./occtBoundary-D_gjqgzo.js";
1
+ import { a as createPlane } from "./vectors-Dp17lKnm.js";
2
+ import { l as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-Coh_5_19.js";
3
+ import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-C8ye0H_K.js";
4
+ import { g as getKernel, a as toVec3 } from "./occtBoundary-DC1yVJex.js";
5
5
  import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
6
- import { r as revolution, k as complexExtrude, t as twistExtrude, i as basicFaceExtrusion, j as genericSweep, l as loft } from "./loft-oJq2OD3A.js";
7
- import { p as gcWithScope, u as createFace, n as createWire, t as localGC, o as createEdge } from "./shapeTypes-c-_pgYCx.js";
8
- import { e as curveStartPoint, a as curveTangentAt, c as curveIsClosed } from "./curveFns-ZuQUBZvd.js";
9
- import { C as Curve2D, i as make2dSegmentCurve, r as approximateAsBSpline, j as make2dArcFromCenter, s as isPoint2D, o as make2dCircle, t as make2dThreePointArc, e as BoundingBox2d, v as viewbox, u as asSVG, B as Blueprint, m as makeFace, d as makeNewFaceWithinFace, w as make2dEllipseArc, x as make2dTangentArc, y as make2dBezierCurve, f as axis2d, z as zip, A as removeDuplicatePoints } from "./Blueprint-Bp45tnh0.js";
10
- import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-CfJIbHY3.js";
6
+ import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-C810lPN5.js";
7
+ import { n as gcWithScope, q as createFace, o as createWire, r as localGC, p as createEdge } from "./shapeTypes-BVd0rRNe.js";
8
+ import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-BJG6oqMt.js";
9
+ import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-nuWe3gns.js";
11
10
  import { bug } from "./result.js";
12
- import { s as samePoint$1, n as normalize2d, h as subtract2d, i as add2d, j as crossProduct2d, k as scalarMultiply2d, b as polarToCartesian, r as rotate2d, l as cartesianToPolar, d as distance2d, p as polarAngle2d, m as PRECISION_INTERSECTION } from "./helpers-CmVkMubc.js";
13
- import { a as assembleWire } from "./curveBuilders-BREwqvuc.js";
11
+ import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-8QToWU3Q.js";
12
+ import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as axis2d, s as removeDuplicatePoints } from "./Blueprint-BihoXiSm.js";
14
13
  function* pointsIteration(intersector) {
15
14
  const nPoints = intersector.NbPoints();
16
15
  if (!nPoints) return;
@@ -2441,21 +2440,21 @@ export {
2441
2440
  FaceSketcher as F,
2442
2441
  Sketch as S,
2443
2442
  BlueprintSketcher as a,
2444
- Blueprints as b,
2445
- cut2D as c,
2446
- cutBlueprints as d,
2447
- fuseBlueprints as e,
2448
- fuse2D as f,
2449
- intersectBlueprints as g,
2450
- Flatbush as h,
2451
- intersect2D as i,
2452
- convertSvgEllipseParams as j,
2453
- defaultsSplineOptions as k,
2454
- intersectCurves as l,
2443
+ Flatbush as b,
2444
+ convertSvgEllipseParams as c,
2445
+ defaultsSplineOptions as d,
2446
+ Blueprints as e,
2447
+ cut2D as f,
2448
+ fuse2D as g,
2449
+ filletCurves as h,
2450
+ intersectCurves as i,
2451
+ chamferCurves as j,
2452
+ intersect2D as k,
2453
+ cutBlueprints as l,
2455
2454
  make2dOffset as m,
2456
- filletCurves as n,
2455
+ fuseBlueprints as n,
2457
2456
  organiseBlueprints as o,
2458
2457
  polysidesBlueprint as p,
2459
- chamferCurves as q,
2458
+ intersectBlueprints as q,
2460
2459
  roundedRectangleBlueprint as r
2461
2460
  };
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-DVmHF4zt.cjs");
3
- const errors = require("./errors-D13q2HCk.cjs");
4
- const cast = require("./cast-CPNOTNFm.cjs");
5
- const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
2
+ const vectors = require("./vectors-DrAMMsHl.cjs");
3
+ const errors = require("./errors-eRQu29oc.cjs");
4
+ const faceFns = require("./faceFns-B8fGirMy.cjs");
5
+ const occtBoundary = require("./occtBoundary-ChEJsbOT.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const loft = require("./loft-B-UCPW9P.cjs");
8
- const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
9
- const curveFns = require("./curveFns-VMxgfkqw.cjs");
10
- const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
11
- const faceFns = require("./faceFns-es3GENII.cjs");
7
+ const loft = require("./loft-DCEZpu53.cjs");
8
+ const shapeTypes = require("./shapeTypes-MK0PKst9.cjs");
9
+ const curveFns = require("./curveFns-BT8cTVDA.cjs");
10
+ const surfaceBuilders = require("./surfaceBuilders-5Ci2Du77.cjs");
12
11
  const result = require("./result.cjs");
13
- const helpers = require("./helpers-C0q_FVxq.cjs");
14
- const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
12
+ const helpers = require("./helpers-MiJaYJMA.cjs");
13
+ const Blueprint = require("./Blueprint-DEhjUTv4.cjs");
15
14
  function* pointsIteration(intersector) {
16
15
  const nPoints = intersector.NbPoints();
17
16
  if (!nPoints) return;
@@ -959,7 +958,7 @@ class Sketch {
959
958
  }
960
959
  set baseFace(newFace) {
961
960
  if (this._baseFace) this._baseFace.delete();
962
- this._baseFace = newFace ? shapeTypes.createFace(errors.unwrap(cast.downcast(newFace.wrapped))) : newFace;
961
+ this._baseFace = newFace ? shapeTypes.createFace(errors.unwrap(faceFns.downcast(newFace.wrapped))) : newFace;
963
962
  }
964
963
  /** Release all OCCT resources held by this sketch. */
965
964
  delete() {
@@ -968,11 +967,11 @@ class Sketch {
968
967
  }
969
968
  /** Create an independent deep copy of this sketch. */
970
969
  clone() {
971
- const sketch = new Sketch(shapeTypes.createWire(errors.unwrap(cast.downcast(this.wire.wrapped))), {
970
+ const sketch = new Sketch(shapeTypes.createWire(errors.unwrap(faceFns.downcast(this.wire.wrapped))), {
972
971
  defaultOrigin: this.defaultOrigin,
973
972
  defaultDirection: this.defaultDirection
974
973
  });
975
- if (this.baseFace) sketch.baseFace = shapeTypes.createFace(errors.unwrap(cast.downcast(this.baseFace.wrapped)));
974
+ if (this.baseFace) sketch.baseFace = shapeTypes.createFace(errors.unwrap(faceFns.downcast(this.baseFace.wrapped)));
976
975
  return sketch;
977
976
  }
978
977
  /** Get the 3D origin used as default for extrusion and revolution. */
@@ -997,15 +996,15 @@ class Sketch {
997
996
  face() {
998
997
  let face;
999
998
  if (!this.baseFace) {
1000
- face = errors.unwrap(Blueprint.makeFace(this.wire));
999
+ face = errors.unwrap(surfaceBuilders.makeFace(this.wire));
1001
1000
  } else {
1002
- face = Blueprint.makeNewFaceWithinFace(this.baseFace, this.wire);
1001
+ face = surfaceBuilders.makeNewFaceWithinFace(this.baseFace, this.wire);
1003
1002
  }
1004
1003
  return face;
1005
1004
  }
1006
1005
  /** Return a clone of the underlying wire. */
1007
1006
  wires() {
1008
- return shapeTypes.createWire(errors.unwrap(cast.downcast(this.wire.wrapped)));
1007
+ return shapeTypes.createWire(errors.unwrap(faceFns.downcast(this.wire.wrapped)));
1009
1008
  }
1010
1009
  /** Alias for {@link Sketch.face}. */
1011
1010
  faces() {
@@ -1016,7 +1015,7 @@ class Sketch {
1016
1015
  * (defaults to the sketch origin)
1017
1016
  */
1018
1017
  revolve(revolutionAxis, { origin } = {}) {
1019
- const face = errors.unwrap(Blueprint.makeFace(this.wire));
1018
+ const face = errors.unwrap(surfaceBuilders.makeFace(this.wire));
1020
1019
  const solid = errors.unwrap(loft.revolution(face, origin || this.defaultOrigin, revolutionAxis));
1021
1020
  face.delete();
1022
1021
  this.delete();
@@ -1058,7 +1057,7 @@ class Sketch {
1058
1057
  this.delete();
1059
1058
  return solid2;
1060
1059
  }
1061
- const face = errors.unwrap(Blueprint.makeFace(this.wire));
1060
+ const face = errors.unwrap(surfaceBuilders.makeFace(this.wire));
1062
1061
  const solid = loft.basicFaceExtrusion(face, [...extrusionVec]);
1063
1062
  gc();
1064
1063
  this.delete();
@@ -1631,7 +1630,7 @@ class FaceSketcher extends BaseSketcher2d {
1631
1630
  _bounds;
1632
1631
  constructor(face, origin = [0, 0]) {
1633
1632
  super(origin);
1634
- this.face = shapeTypes.createFace(errors.unwrap(cast.downcast(face.wrapped)));
1633
+ this.face = shapeTypes.createFace(errors.unwrap(faceFns.downcast(face.wrapped)));
1635
1634
  this._bounds = faceFns.uvBounds(face);
1636
1635
  }
1637
1636
  _convertToUV([x, y]) {
@@ -1656,7 +1655,7 @@ class FaceSketcher extends BaseSketcher2d {
1656
1655
  const edges = this.pendingCurves.map((curve) => {
1657
1656
  return r(shapeTypes.createEdge(r(new oc.BRepBuilderAPI_MakeEdge_30(curve.wrapped, geomSurf)).Edge()));
1658
1657
  });
1659
- const wire = errors.unwrap(curveBuilders.assembleWire(edges));
1658
+ const wire = errors.unwrap(surfaceBuilders.assembleWire(edges));
1660
1659
  oc.BRepLib.BuildCurves3d_2(wire.wrapped);
1661
1660
  gc();
1662
1661
  return wire;
@@ -1942,7 +1941,7 @@ function findAllIntersections(first, second) {
1942
1941
  };
1943
1942
  }
1944
1943
  function splitCurvesAtIntersections(curves, curvePoints) {
1945
- return Blueprint.zip([curves, curvePoints]).flatMap(
1944
+ return surfaceBuilders.zip([curves, curvePoints]).flatMap(
1946
1945
  ([curve, intersections]) => {
1947
1946
  if (intersections.length === 0) return [curve];
1948
1947
  return curve.splitAt(intersections, helpers.PRECISION_INTERSECTION / 100);
@@ -1994,7 +1993,7 @@ function blueprintsIntersectionSegments(first, second) {
1994
1993
  secondIntersectedSegments = reverseSegments(secondIntersectedSegments);
1995
1994
  }
1996
1995
  }
1997
- return Blueprint.zip([firstIntersectedSegments, secondIntersectedSegments]).map(
1996
+ return surfaceBuilders.zip([firstIntersectedSegments, secondIntersectedSegments]).map(
1998
1997
  ([first2, second2]) => {
1999
1998
  if (first2 === void 0 || second2 === void 0) {
2000
1999
  result.bug("blueprintsIntersectionSegments", "Mismatched segment counts between blueprints");
@@ -2012,12 +2011,12 @@ function splitPaths(curves) {
2012
2011
  const startPoints = curves.map((c) => c.firstPoint);
2013
2012
  const shiftedEndPoints = curves.map((c) => c.lastPoint);
2014
2013
  const endPoints = shiftedEndPoints.slice(-1).concat(shiftedEndPoints.slice(0, -1));
2015
- const discontinuities = Blueprint.zip([startPoints, endPoints]).map(([startPoint, endPoint], index) => {
2014
+ const discontinuities = surfaceBuilders.zip([startPoints, endPoints]).map(([startPoint, endPoint], index) => {
2016
2015
  if (startPoint === void 0 || endPoint === void 0) return null;
2017
2016
  return samePoint(startPoint, endPoint) ? null : index;
2018
2017
  }).filter((f) => f !== null);
2019
2018
  if (discontinuities.length === 0) return [curves];
2020
- const paths = Blueprint.zip([discontinuities.slice(0, -1), discontinuities.slice(1)]).map(
2019
+ const paths = surfaceBuilders.zip([discontinuities.slice(0, -1), discontinuities.slice(1)]).map(
2021
2020
  ([start, end]) => curves.slice(start, end)
2022
2021
  );
2023
2022
  let lastPath = curves.slice(discontinuities[discontinuities.length - 1]);