brepjs 8.4.0 → 8.7.4

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 (114) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +13 -13
  3. package/dist/{Blueprint-zgFe_5Qj.cjs → Blueprint-BcbOBF-9.cjs} +11 -99
  4. package/dist/{Blueprint-Bp45tnh0.js → Blueprint-Cmh8lKc4.js} +29 -117
  5. package/dist/{boolean2D-CfEbRMPF.cjs → boolean2D-CqacqjME.cjs} +24 -25
  6. package/dist/{boolean2D-DN6ETTCq.js → boolean2D-D94Axs3i.js} +23 -24
  7. package/dist/{booleanFns-C-M6qqvB.js → booleanFns-DdjtpcM6.js} +306 -12
  8. package/dist/{booleanFns-5dDG0jpA.cjs → booleanFns-NtKxkiXn.cjs} +299 -5
  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-BBOYfsXl.js} +1 -1
  16. package/dist/{cornerFinder-BQ-_VJx0.cjs → cornerFinder-Bqy8Lw2p.cjs} +1 -1
  17. package/dist/{curveFns-ZuQUBZvd.js → curveFns-B85Glnfo.js} +19 -17
  18. package/dist/{curveFns-VMxgfkqw.cjs → curveFns-BXCbASW-.cjs} +6 -4
  19. package/dist/{drawFns-BbhX1IUq.js → drawFns-B-gJ2WUc.js} +47 -21
  20. package/dist/{drawFns-CKaHgGSK.cjs → drawFns-CAmFEqd1.cjs} +63 -37
  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-CfJIbHY3.js → faceFns-CltrEfOo.js} +109 -12
  24. package/dist/{faceFns-es3GENII.cjs → faceFns-DcndPHWm.cjs} +103 -6
  25. package/dist/{helpers-C0q_FVxq.cjs → helpers-CC21GeAr.cjs} +8 -9
  26. package/dist/{helpers-CmVkMubc.js → helpers-SksQIreB.js} +16 -17
  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 +5 -5
  36. package/dist/io.js +5 -5
  37. package/dist/kernel/hullOps.d.ts +1 -0
  38. package/dist/kernel/hullOps.d.ts.map +1 -1
  39. package/dist/kernel/occtAdapter.d.ts +5 -0
  40. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  41. package/dist/kernel/solverAdapter.d.ts +39 -0
  42. package/dist/kernel/solverAdapter.d.ts.map +1 -0
  43. package/dist/kernel/types.d.ts +5 -0
  44. package/dist/kernel/types.d.ts.map +1 -1
  45. package/dist/{loft-B-UCPW9P.cjs → loft-BcyyvWCj.cjs} +28 -28
  46. package/dist/{loft-oJq2OD3A.js → loft-CJMPx1NQ.js} +16 -16
  47. package/dist/{measurement-Cf_SoIiR.js → measurement-ByOztLxb.js} +3 -3
  48. package/dist/{measurement-CYmT-C77.cjs → measurement-DU3ry-0Q.cjs} +3 -3
  49. package/dist/measurement.cjs +1 -1
  50. package/dist/measurement.js +1 -1
  51. package/dist/{meshFns-CqNwW0PO.js → meshFns-D2gLyLFt.js} +3 -3
  52. package/dist/{meshFns-DDC_2U81.cjs → meshFns-DawUwI3W.cjs} +3 -3
  53. package/dist/{occtBoundary-D_gjqgzo.js → occtBoundary-CWzWqBCm.js} +17 -5
  54. package/dist/{occtBoundary-CocN2VKx.cjs → occtBoundary-DH2VO-rq.cjs} +12 -0
  55. package/dist/operations/assemblyFns.d.ts +1 -0
  56. package/dist/operations/assemblyFns.d.ts.map +1 -1
  57. package/dist/operations/guidedSweepFns.d.ts +25 -0
  58. package/dist/operations/guidedSweepFns.d.ts.map +1 -0
  59. package/dist/operations/mateFns.d.ts +50 -0
  60. package/dist/operations/mateFns.d.ts.map +1 -0
  61. package/dist/operations/multiSweepFns.d.ts +32 -0
  62. package/dist/operations/multiSweepFns.d.ts.map +1 -0
  63. package/dist/operations/roofFns.d.ts +16 -0
  64. package/dist/operations/roofFns.d.ts.map +1 -0
  65. package/dist/operations/straightSkeleton.d.ts +28 -0
  66. package/dist/operations/straightSkeleton.d.ts.map +1 -0
  67. package/dist/{operations-BQeW_DSM.cjs → operations-CdELWxgv.cjs} +7 -7
  68. package/dist/{operations-6hdpuYmY.js → operations-DiXo_4t9.js} +15 -15
  69. package/dist/operations.cjs +2 -2
  70. package/dist/operations.js +13 -13
  71. package/dist/query.cjs +5 -5
  72. package/dist/query.js +7 -7
  73. package/dist/result.cjs +1 -1
  74. package/dist/result.js +1 -1
  75. package/dist/{shapeFns-B0zSdO9c.cjs → shapeFns-3RYtsUVY.cjs} +54 -21
  76. package/dist/{shapeFns-k1YHFwmB.js → shapeFns-4ioRrhih.js} +52 -19
  77. package/dist/{shapeTypes-BxVxLdiD.cjs → shapeTypes-CMjrTv36.cjs} +1 -1
  78. package/dist/{shapeTypes-c-_pgYCx.js → shapeTypes-D0vfRxWb.js} +13 -13
  79. package/dist/sketching.cjs +2 -2
  80. package/dist/sketching.js +2 -2
  81. package/dist/{curveBuilders-BREwqvuc.js → surfaceBuilders-B7Jxob8g.js} +106 -13
  82. package/dist/{curveBuilders-BkEJ-RVn.cjs → surfaceBuilders-Xx9DRRxs.cjs} +96 -3
  83. package/dist/text/textBlueprints.d.ts +38 -0
  84. package/dist/text/textBlueprints.d.ts.map +1 -1
  85. package/dist/topology/api.d.ts +5 -0
  86. package/dist/topology/api.d.ts.map +1 -1
  87. package/dist/topology/booleanFns.d.ts +10 -1
  88. package/dist/topology/booleanFns.d.ts.map +1 -1
  89. package/dist/topology/colorFns.d.ts +38 -0
  90. package/dist/topology/colorFns.d.ts.map +1 -0
  91. package/dist/topology/curveFns.d.ts +1 -1
  92. package/dist/topology/curveFns.d.ts.map +1 -1
  93. package/dist/topology/faceTagFns.d.ts +44 -0
  94. package/dist/topology/faceTagFns.d.ts.map +1 -0
  95. package/dist/topology/modifierFns.d.ts.map +1 -1
  96. package/dist/topology/polyhedronFns.d.ts +8 -0
  97. package/dist/topology/polyhedronFns.d.ts.map +1 -0
  98. package/dist/topology/shapeFns.d.ts +4 -0
  99. package/dist/topology/shapeFns.d.ts.map +1 -1
  100. package/dist/topology/surfaceBuilders.d.ts +7 -0
  101. package/dist/topology/surfaceBuilders.d.ts.map +1 -1
  102. package/dist/topology/surfaceFns.d.ts +38 -0
  103. package/dist/topology/surfaceFns.d.ts.map +1 -0
  104. package/dist/{topology-CycEc6Oe.cjs → topology-D-nGjCzV.cjs} +19 -20
  105. package/dist/{topology-tMKHJgw2.js → topology-DRP9zreU.js} +8 -9
  106. package/dist/topology.cjs +13 -14
  107. package/dist/topology.js +51 -52
  108. package/dist/{vectors-DE0XriuQ.js → vectors-CZV4ZrTz.js} +2 -2
  109. package/dist/{vectors-DVmHF4zt.cjs → vectors-DwFeX0Ja.cjs} +2 -2
  110. package/dist/vectors.cjs +2 -2
  111. package/dist/vectors.js +2 -2
  112. package/package.json +4 -3
  113. package/dist/cast-CPNOTNFm.cjs +0 -102
  114. package/dist/cast-Cerqtxtb.js +0 -103
@@ -70,6 +70,9 @@ export declare const BrepErrorCode: {
70
70
  readonly STL_IMPORT_FAILED: "STL_IMPORT_FAILED";
71
71
  readonly IGES_EXPORT_FAILED: "IGES_EXPORT_FAILED";
72
72
  readonly IGES_IMPORT_FAILED: "IGES_IMPORT_FAILED";
73
+ readonly DXF_IMPORT_FAILED: "DXF_IMPORT_FAILED";
74
+ readonly OBJ_IMPORT_FAILED: "OBJ_IMPORT_FAILED";
75
+ readonly THREEMF_IMPORT_FAILED: "THREEMF_IMPORT_FAILED";
73
76
  readonly PARAMETER_NOT_FOUND: "PARAMETER_NOT_FOUND";
74
77
  readonly INTERSECTION_FAILED: "INTERSECTION_FAILED";
75
78
  readonly SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED";
@@ -81,6 +84,21 @@ export declare const BrepErrorCode: {
81
84
  readonly MINKOWSKI_FAILED: "MINKOWSKI_FAILED";
82
85
  readonly MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL";
83
86
  readonly MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D";
87
+ readonly POLYHEDRON_INSUFFICIENT_POINTS: "POLYHEDRON_INSUFFICIENT_POINTS";
88
+ readonly POLYHEDRON_INSUFFICIENT_FACES: "POLYHEDRON_INSUFFICIENT_FACES";
89
+ readonly POLYHEDRON_INVALID_INDEX: "POLYHEDRON_INVALID_INDEX";
90
+ readonly POLYHEDRON_FAILED: "POLYHEDRON_FAILED";
91
+ readonly ROOF_FAILED: "ROOF_FAILED";
92
+ readonly MULTI_SWEEP_INSUFFICIENT_SECTIONS: "MULTI_SWEEP_INSUFFICIENT_SECTIONS";
93
+ readonly MULTI_SWEEP_FAILED: "MULTI_SWEEP_FAILED";
94
+ readonly GUIDED_SWEEP_FAILED: "GUIDED_SWEEP_FAILED";
95
+ readonly FACE_TAG_INVALID: "FACE_TAG_INVALID";
96
+ readonly SURFACE_GRID_TOO_SMALL: "SURFACE_GRID_TOO_SMALL";
97
+ readonly SURFACE_GRID_JAGGED: "SURFACE_GRID_JAGGED";
98
+ readonly SURFACE_FAILED: "SURFACE_FAILED";
99
+ readonly ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID";
100
+ readonly ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED";
101
+ readonly ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED";
84
102
  };
85
103
  /** Union of all known error code string literals. */
86
104
  export type BrepErrorCode = (typeof BrepErrorCode)[keyof typeof BrepErrorCode];
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAChB,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,IAAI,GACJ,OAAO,CAAC;AAMZ;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFhB,CAAC;AAEX,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAM/E;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD;AAwBD,0DAA0D;AAC1D,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAEX;AAED,oDAAoD;AACpD,wBA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B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAEX;AAED,wDAAwD;AACxD,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAEX;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAEX;AAyED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ9D"}
package/dist/core.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
3
+ const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
4
4
  const vecOps = require("./vecOps-CjRL1jau.cjs");
5
- const errors = require("./errors-D13q2HCk.cjs");
6
- const vectors = require("./vectors-DVmHF4zt.cjs");
7
- const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
5
+ const errors = require("./errors-eRQu29oc.cjs");
6
+ const vectors = require("./vectors-DwFeX0Ja.cjs");
7
+ const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
8
8
  const result = require("./result.cjs");
9
9
  exports.resolveDirection = occtBoundary.resolveDirection;
10
10
  exports.toVec2 = occtBoundary.toVec2;
package/dist/core.js CHANGED
@@ -1,8 +1,8 @@
1
- import { r, t, a } from "./occtBoundary-D_gjqgzo.js";
1
+ import { r, t, a } from "./occtBoundary-CWzWqBCm.js";
2
2
  import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
3
- import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-CSYOlCCR.js";
4
- import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-DE0XriuQ.js";
5
- import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-c-_pgYCx.js";
3
+ import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-Coh_5_19.js";
4
+ import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-CZV4ZrTz.js";
5
+ import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-D0vfRxWb.js";
6
6
  import { BrepBugError, bug } from "./result.js";
7
7
  export {
8
8
  BrepBugError,
@@ -1,4 +1,4 @@
1
- import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-CmVkMubc.js";
1
+ import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-SksQIreB.js";
2
2
  import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
3
3
  const PI_2 = 2 * Math.PI;
4
4
  function positiveHalfAngle(angle) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const helpers = require("./helpers-C0q_FVxq.cjs");
2
+ const helpers = require("./helpers-CC21GeAr.cjs");
3
3
  const vecOps = require("./vecOps-CjRL1jau.cjs");
4
4
  const PI_2 = 2 * Math.PI;
5
5
  function positiveHalfAngle(angle) {
@@ -1,6 +1,6 @@
1
- import { g as getKernel } from "./occtBoundary-D_gjqgzo.js";
2
- import { c as castShape, d as isEdge, m as isWire, p as gcWithScope } from "./shapeTypes-c-_pgYCx.js";
3
- import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-CSYOlCCR.js";
1
+ import { g as getKernel } from "./occtBoundary-CWzWqBCm.js";
2
+ import { c as castShape, d as isEdge, m as isWire, n as gcWithScope } from "./shapeTypes-D0vfRxWb.js";
3
+ import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-Coh_5_19.js";
4
4
  let CURVE_TYPES_MAP = null;
5
5
  const getCurveTypesMap = (refresh) => {
6
6
  if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
@@ -149,7 +149,9 @@ function offsetWire2D(wire, offset, kind = "arc") {
149
149
  const joinTypes = {
150
150
  arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
151
151
  intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
152
- tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
152
+ tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent,
153
+ chamfer: oc.GeomAbs_JoinType.GeomAbs_Intersection
154
+ // sharp/miter corners
153
155
  };
154
156
  const resultShape = getKernel().offsetWire2D(wire.wrapped, offset, joinTypes[kind]);
155
157
  const wrapped = castShape(resultShape);
@@ -160,19 +162,19 @@ function offsetWire2D(wire, offset, kind = "arc") {
160
162
  return ok(wrapped);
161
163
  }
162
164
  export {
163
- curveTangentAt as a,
164
- curvePointAt as b,
165
- curveIsClosed as c,
166
- curveEndPoint as d,
167
- curveStartPoint as e,
168
- curveLength as f,
169
- approximateCurve as g,
170
- curveIsPeriodic as h,
171
- curvePeriod as i,
172
- findCurveType as j,
173
- flipOrientation as k,
174
- getCurveType as l,
175
- getOrientation as m,
165
+ curveEndPoint as a,
166
+ getCurveType as b,
167
+ curveTangentAt as c,
168
+ curveStartPoint as d,
169
+ curveIsClosed as e,
170
+ findCurveType as f,
171
+ getOrientation as g,
172
+ curvePointAt as h,
173
+ curveLength as i,
174
+ approximateCurve as j,
175
+ curveIsPeriodic as k,
176
+ curvePeriod as l,
177
+ flipOrientation as m,
176
178
  interpolateCurve as n,
177
179
  offsetWire2D as o
178
180
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
3
- const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
4
- const errors = require("./errors-D13q2HCk.cjs");
2
+ const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
3
+ const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
4
+ const errors = require("./errors-eRQu29oc.cjs");
5
5
  let CURVE_TYPES_MAP = null;
6
6
  const getCurveTypesMap = (refresh) => {
7
7
  if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
@@ -150,7 +150,9 @@ function offsetWire2D(wire, offset, kind = "arc") {
150
150
  const joinTypes = {
151
151
  arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
152
152
  intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
153
- tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
153
+ tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent,
154
+ chamfer: oc.GeomAbs_JoinType.GeomAbs_Intersection
155
+ // sharp/miter corners
154
156
  };
155
157
  const resultShape = occtBoundary.getKernel().offsetWire2D(wire.wrapped, offset, joinTypes[kind]);
156
158
  const wrapped = shapeTypes.castShape(resultShape);
@@ -1,20 +1,19 @@
1
- import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-CSYOlCCR.js";
2
- import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-DE0XriuQ.js";
3
- import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-D_gjqgzo.js";
1
+ import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-Coh_5_19.js";
2
+ import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-CZV4ZrTz.js";
3
+ import { g as getKernel, a as toVec3, c as makeOcAx2 } from "./occtBoundary-CWzWqBCm.js";
4
4
  import { n as vecScale, j as vecNormalize, v as vecAdd, o as vecSub, b as vecCross, m as vecRotate, R as RAD2DEG, g as vecLength, e as vecEquals, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
5
- import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-DN6ETTCq.js";
6
- import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-CfJIbHY3.js";
7
- import { a as curveTangentAt, d as curveEndPoint, l as getCurveType, o as offsetWire2D } from "./curveFns-ZuQUBZvd.js";
8
- import { m as makeLine, i as makeThreePointArc, h as makeTangentArc, g as makeEllipseArc, c as makeBezierCurve, a as assembleWire, e as makeCircle, f as makeEllipse, b as makeHelix, d as makeBSplineApproximation } from "./curveBuilders-BREwqvuc.js";
9
- import { n as createWire, t as localGC, u as createFace, e as isFace, p as gcWithScope, c as castShape } from "./shapeTypes-c-_pgYCx.js";
10
- import { d as downcast, c as cast } from "./cast-Cerqtxtb.js";
11
- import { h as mirror, a as addHolesInFace, m as makeFace, B as Blueprint, C as Curve2D, i as make2dSegmentCurve, j as make2dArcFromCenter, k as approximateAsSvgCompatibleCurve, e as BoundingBox2d, l as edgeToCurve, n as make2dInerpolatedBSplineCurve, o as make2dCircle, p as make2dEllipse, q as deserializeCurve2D } from "./Blueprint-Bp45tnh0.js";
5
+ import { b as Flatbush, c as convertSvgEllipseParams, d as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, e as Blueprints, C as CompoundBlueprint, f as cut2D, i as intersectCurves, g as fuse2D, m as make2dOffset, h as filletCurves, j as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, k as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-D94Axs3i.js";
6
+ import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-CltrEfOo.js";
7
+ import { c as curveTangentAt, a as curveEndPoint, b as getCurveType, o as offsetWire2D } from "./curveFns-B85Glnfo.js";
8
+ import { a as makeLine, d as makeThreePointArc, e as makeTangentArc, f as makeEllipseArc, g as makeBezierCurve, b as assembleWire, h as addHolesInFace, m as makeFace, i as makeCircle, j as makeEllipse, c as makeHelix, k as makeBSplineApproximation } from "./surfaceBuilders-B7Jxob8g.js";
9
+ import { o as createWire, r as localGC, q as createFace, e as isFace, n as gcWithScope, c as castShape } from "./shapeTypes-D0vfRxWb.js";
10
+ import { m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, c as approximateAsSvgCompatibleCurve, d as BoundingBox2d, e as edgeToCurve, f as make2dInerpolatedBSplineCurve, g as make2dCircle, h as make2dEllipse, i as deserializeCurve2D } from "./Blueprint-Cmh8lKc4.js";
12
11
  import { bug } from "./result.js";
13
- import { d as distance2d, p as polarAngle2d, b as polarToCartesian, P as PRECISION_OFFSET, e as squareDistance2d, s as samePoint$1, h as subtract2d, i as add2d } from "./helpers-CmVkMubc.js";
14
- import { e as getEdges } from "./shapeFns-k1YHFwmB.js";
15
- import { m as makeCompound, i as basicFaceExtrusion, r as revolution, e as makeSolid, k as complexExtrude, t as twistExtrude } from "./loft-oJq2OD3A.js";
12
+ import { d as distance2d, p as polarAngle2d, f as polarToCartesian, P as PRECISION_OFFSET, h as squareDistance2d, s as samePoint$1, e as subtract2d, c as add2d } from "./helpers-SksQIreB.js";
13
+ import { d as getEdges } from "./shapeFns-4ioRrhih.js";
14
+ import { m as makeCompound, b as basicFaceExtrusion, r as revolution, a as makeSolid, c as complexExtrude, t as twistExtrude } from "./loft-CJMPx1NQ.js";
16
15
  import opentype from "opentype.js";
17
- import { c as cornerFinder } from "./cornerFinder-CC_MunIh.js";
16
+ import { c as cornerFinder } from "./cornerFinder-BBOYfsXl.js";
18
17
  const stitchCurves = (curves, precision = 1e-7) => {
19
18
  const startPoints = new Flatbush(curves.length);
20
19
  curves.forEach((c) => {
@@ -1103,6 +1102,31 @@ function sketchText(text, textConfig, planeConfig = {}) {
1103
1102
  )
1104
1103
  );
1105
1104
  }
1105
+ function textMetrics(text, options) {
1106
+ const fontSize = options?.fontSize ?? 1;
1107
+ const font = getFont(options?.fontFamily);
1108
+ if (!font) throw new Error("No font loaded. Call loadFont() first.");
1109
+ const width = font.getAdvanceWidth(text, fontSize);
1110
+ const scale = fontSize / font.unitsPerEm;
1111
+ const ascender = font.ascender * scale;
1112
+ const descender = font.descender * scale;
1113
+ return { width, height: ascender - descender, ascender, descender };
1114
+ }
1115
+ function fontMetrics(options) {
1116
+ const fontSize = options?.fontSize ?? 1;
1117
+ const font = getFont(options?.fontFamily);
1118
+ if (!font) throw new Error("No font loaded. Call loadFont() first.");
1119
+ const scale = fontSize / font.unitsPerEm;
1120
+ const ascender = font.ascender * scale;
1121
+ const descender = font.descender * scale;
1122
+ const lineGap = (font.tables?.os2?.sTypoLineGap ?? 0) * scale;
1123
+ return {
1124
+ ascender,
1125
+ descender,
1126
+ unitsPerEm: font.unitsPerEm,
1127
+ lineHeight: ascender - descender + lineGap
1128
+ };
1129
+ }
1106
1130
  const PROJECTION_PLANES = {
1107
1131
  XY: { dir: [0, 0, 1], xAxis: [1, 0, 0] },
1108
1132
  XZ: { dir: [0, -1, 0], xAxis: [1, 0, 0] },
@@ -1571,7 +1595,7 @@ function mirrorDrawing(drawing, centerOrDirection, origin, mode) {
1571
1595
  return drawing.mirror(centerOrDirection, origin, mode);
1572
1596
  }
1573
1597
  export {
1574
- isProjectionPlane as $,
1598
+ getFont as $,
1575
1599
  makeBaseBox as A,
1576
1600
  mirrorDrawing as B,
1577
1601
  CompoundSketch as C,
@@ -1598,13 +1622,15 @@ export {
1598
1622
  cameraFromPlane as X,
1599
1623
  cameraLookAt as Y,
1600
1624
  createCamera as Z,
1601
- getFont as _,
1625
+ fontMetrics as _,
1602
1626
  DrawingPen as a,
1603
- loadFont as a0,
1604
- makeProjectedEdges as a1,
1605
- projectEdges as a2,
1606
- sketchText as a3,
1607
- textBlueprints as a4,
1627
+ isProjectionPlane as a0,
1628
+ loadFont as a1,
1629
+ makeProjectedEdges as a2,
1630
+ projectEdges as a3,
1631
+ sketchText as a4,
1632
+ textBlueprints as a5,
1633
+ textMetrics as a6,
1608
1634
  Sketches as b,
1609
1635
  compoundSketchExtrude as c,
1610
1636
  compoundSketchFace as d,
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
- const errors = require("./errors-D13q2HCk.cjs");
3
- const vectors = require("./vectors-DVmHF4zt.cjs");
4
- const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
2
+ const errors = require("./errors-eRQu29oc.cjs");
3
+ const vectors = require("./vectors-DwFeX0Ja.cjs");
4
+ const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
5
5
  const vecOps = require("./vecOps-CjRL1jau.cjs");
6
- const boolean2D = require("./boolean2D-CfEbRMPF.cjs");
7
- const faceFns = require("./faceFns-es3GENII.cjs");
8
- const curveFns = require("./curveFns-VMxgfkqw.cjs");
9
- const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
10
- const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
11
- const cast = require("./cast-CPNOTNFm.cjs");
12
- const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
6
+ const boolean2D = require("./boolean2D-CqacqjME.cjs");
7
+ const faceFns = require("./faceFns-DcndPHWm.cjs");
8
+ const curveFns = require("./curveFns-BXCbASW-.cjs");
9
+ const surfaceBuilders = require("./surfaceBuilders-Xx9DRRxs.cjs");
10
+ const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
11
+ const Blueprint = require("./Blueprint-BcbOBF-9.cjs");
13
12
  const result = require("./result.cjs");
14
- const helpers = require("./helpers-C0q_FVxq.cjs");
15
- const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
16
- const loft = require("./loft-B-UCPW9P.cjs");
13
+ const helpers = require("./helpers-CC21GeAr.cjs");
14
+ const shapeFns = require("./shapeFns-3RYtsUVY.cjs");
15
+ const loft = require("./loft-BcyyvWCj.cjs");
17
16
  const opentype = require("opentype.js");
18
- const cornerFinder = require("./cornerFinder-BQ-_VJx0.cjs");
17
+ const cornerFinder = require("./cornerFinder-Bqy8Lw2p.cjs");
19
18
  const stitchCurves = (curves, precision = 1e-7) => {
20
19
  const startPoints = new boolean2D.Flatbush(curves.length);
21
20
  curves.forEach((c) => {
@@ -98,7 +97,7 @@ class Sketcher {
98
97
  /** Draw a straight line to an absolute 2D point on the sketch plane. */
99
98
  lineTo([x, y]) {
100
99
  const endPoint = vectors.planeToWorld(this.plane, [x, y]);
101
- this.pendingEdges.push(curveBuilders.makeLine(this.pointer, endPoint));
100
+ this.pendingEdges.push(surfaceBuilders.makeLine(this.pointer, endPoint));
102
101
  this._updatePointer(endPoint);
103
102
  return this;
104
103
  }
@@ -145,7 +144,7 @@ class Sketcher {
145
144
  const tangent = curveFns.curveTangentAt(previousEdge, 1);
146
145
  const scaledTangent = vecOps.vecScale(vecOps.vecNormalize(tangent), distance);
147
146
  const endPoint = vecOps.vecAdd(scaledTangent, this.pointer);
148
- this.pendingEdges.push(curveBuilders.makeLine(this.pointer, endPoint));
147
+ this.pendingEdges.push(surfaceBuilders.makeLine(this.pointer, endPoint));
149
148
  this._updatePointer(endPoint);
150
149
  return this;
151
150
  }
@@ -153,7 +152,7 @@ class Sketcher {
153
152
  threePointsArcTo(end, innerPoint) {
154
153
  const gpoint1 = vectors.planeToWorld(this.plane, innerPoint);
155
154
  const gpoint2 = vectors.planeToWorld(this.plane, end);
156
- this.pendingEdges.push(curveBuilders.makeThreePointArc(this.pointer, gpoint1, gpoint2));
155
+ this.pendingEdges.push(surfaceBuilders.makeThreePointArc(this.pointer, gpoint1, gpoint2));
157
156
  this._updatePointer(gpoint2);
158
157
  return this;
159
158
  }
@@ -170,7 +169,7 @@ class Sketcher {
170
169
  result.bug("Sketcher.tangentArcTo", "You need a previous edge to create a tangent arc");
171
170
  const prevEnd = curveFns.curveEndPoint(previousEdge);
172
171
  const prevTangent = curveFns.curveTangentAt(previousEdge, 1);
173
- this.pendingEdges.push(curveBuilders.makeTangentArc(prevEnd, prevTangent, endPoint));
172
+ this.pendingEdges.push(surfaceBuilders.makeTangentArc(prevEnd, prevTangent, endPoint));
174
173
  this._updatePointer(endPoint);
175
174
  return this;
176
175
  }
@@ -190,7 +189,7 @@ class Sketcher {
190
189
  const sagDirection = vecOps.vecNormalize(crossResult);
191
190
  const sagVector = vecOps.vecScale(sagDirection, sagitta);
192
191
  const sagPoint = vecOps.vecAdd(midPoint, sagVector);
193
- this.pendingEdges.push(curveBuilders.makeThreePointArc(this.pointer, sagPoint, endPoint));
192
+ this.pendingEdges.push(surfaceBuilders.makeThreePointArc(this.pointer, sagPoint, endPoint));
194
193
  this._updatePointer(endPoint);
195
194
  return this;
196
195
  }
@@ -250,7 +249,7 @@ class Sketcher {
250
249
  );
251
250
  const xDir = vecOps.vecRotate(this.plane.xDir, this.plane.zDir, rotationAngle * vecOps.DEG2RAD);
252
251
  const arc = errors.unwrap(
253
- curveBuilders.makeEllipseArc(
252
+ surfaceBuilders.makeEllipseArc(
254
253
  rx,
255
254
  ry,
256
255
  clockwise ? startAngle : endAngle,
@@ -302,7 +301,7 @@ class Sketcher {
302
301
  }
303
302
  const inWorldPoints = cp.map((p) => vectors.planeToWorld(this.plane, p));
304
303
  const endPoint = vectors.planeToWorld(this.plane, end);
305
- this.pendingEdges.push(errors.unwrap(curveBuilders.makeBezierCurve([this.pointer, ...inWorldPoints, endPoint])));
304
+ this.pendingEdges.push(errors.unwrap(surfaceBuilders.makeBezierCurve([this.pointer, ...inWorldPoints, endPoint])));
306
305
  this._updatePointer(endPoint);
307
306
  return this;
308
307
  }
@@ -351,7 +350,7 @@ class Sketcher {
351
350
  const endPoleDistance = vecOps.vecScale(vecOps.vecNormalize(endPoleDirection), endFactor * defaultDistance);
352
351
  const endControl = vecOps.vecSub(endPoint, endPoleDistance);
353
352
  this.pendingEdges.push(
354
- errors.unwrap(curveBuilders.makeBezierCurve([this.pointer, startControl, endControl, endPoint]))
353
+ errors.unwrap(surfaceBuilders.makeBezierCurve([this.pointer, startControl, endControl, endPoint]))
355
354
  );
356
355
  this._updatePointer(endPoint);
357
356
  return this;
@@ -368,16 +367,16 @@ class Sketcher {
368
367
  const diff = vecOps.vecSub(this.pointer, this.firstPoint);
369
368
  const startToEndVector = vecOps.vecNormalize(diff);
370
369
  const normal = vecOps.vecCross(startToEndVector, this.plane.zDir);
371
- const clonedWrapped = errors.unwrap(cast.downcast(wire.wrapped));
370
+ const clonedWrapped = errors.unwrap(faceFns.downcast(wire.wrapped));
372
371
  const mirroredRaw = Blueprint.mirror(clonedWrapped, normal, this.pointer);
373
- const mirroredWrapped = errors.unwrap(cast.downcast(mirroredRaw));
372
+ const mirroredWrapped = errors.unwrap(faceFns.downcast(mirroredRaw));
374
373
  const mirroredWire = shapeTypes.createWire(mirroredWrapped);
375
- const combinedWire = errors.unwrap(curveBuilders.assembleWire([wire, mirroredWire]));
374
+ const combinedWire = errors.unwrap(surfaceBuilders.assembleWire([wire, mirroredWire]));
376
375
  return combinedWire;
377
376
  }
378
377
  buildWire() {
379
378
  if (!this.pendingEdges.length) result.bug("Sketcher.buildWire", "No lines to convert into a wire");
380
- let wire = errors.unwrap(curveBuilders.assembleWire(this.pendingEdges));
379
+ let wire = errors.unwrap(surfaceBuilders.assembleWire(this.pendingEdges));
381
380
  if (this._mirrorWire) {
382
381
  wire = this._mirrorWireOnStartEnd(wire);
383
382
  }
@@ -421,7 +420,7 @@ const guessFaceFromWires = (wires) => {
421
420
  });
422
421
  const progress = r(new oc.Message_ProgressRange_1());
423
422
  faceBuilder.Build(progress);
424
- const newFace = errors.unwrap(cast.cast(faceBuilder.Shape()));
423
+ const newFace = errors.unwrap(faceFns.cast(faceBuilder.Shape()));
425
424
  gc();
426
425
  if (!shapeTypes.isFace(newFace)) {
427
426
  result.bug("guessFaceFromWires", "Failed to create a face");
@@ -439,7 +438,7 @@ const fixWire = (wire, baseFace) => {
439
438
  const faceFromWires = (wires) => {
440
439
  let baseFace;
441
440
  let holeWires;
442
- const faceResult = Blueprint.makeFace(wires[0]);
441
+ const faceResult = surfaceBuilders.makeFace(wires[0]);
443
442
  if (errors.isOk(faceResult)) {
444
443
  baseFace = faceResult.value;
445
444
  holeWires = wires.slice(1);
@@ -447,7 +446,7 @@ const faceFromWires = (wires) => {
447
446
  baseFace = guessFaceFromWires(wires);
448
447
  holeWires = wires.slice(1).map((w) => fixWire(w, baseFace));
449
448
  }
450
- return Blueprint.addHolesInFace(baseFace, holeWires);
449
+ return surfaceBuilders.addHolesInFace(baseFace, holeWires);
451
450
  };
452
451
  const solidFromShellGenerator = (sketches, shellGenerator) => {
453
452
  const shells = [];
@@ -494,7 +493,7 @@ class CompoundSketch {
494
493
  /** Build a face from the outer boundary with inner wires subtracted as holes. */
495
494
  face() {
496
495
  const baseFace = this.outerSketch.face();
497
- const newFace = Blueprint.addHolesInFace(
496
+ const newFace = surfaceBuilders.addHolesInFace(
498
497
  baseFace,
499
498
  this.innerSketches.map((s) => s.wire)
500
499
  );
@@ -571,7 +570,7 @@ class CompoundSketch {
571
570
  return base.clone().loftWith(outer.clone(), { ruled: loftConfig.ruled }, true);
572
571
  });
573
572
  const baseFaceRaw = this.face();
574
- const baseFace = shapeTypes.createFace(errors.unwrap(cast.downcast(baseFaceRaw.wrapped)));
573
+ const baseFace = shapeTypes.createFace(errors.unwrap(faceFns.downcast(baseFaceRaw.wrapped)));
575
574
  shells.push(baseFace, otherCompound.face());
576
575
  return errors.unwrap(loft.makeSolid(shells));
577
576
  }
@@ -615,7 +614,7 @@ class Sketches {
615
614
  }
616
615
  const sketchCircle = (radius, planeConfig = {}) => {
617
616
  const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : vectors.resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin);
618
- const wire = errors.unwrap(curveBuilders.assembleWire([curveBuilders.makeCircle(radius, plane.origin, plane.zDir)]));
617
+ const wire = errors.unwrap(surfaceBuilders.assembleWire([surfaceBuilders.makeCircle(radius, plane.origin, plane.zDir)]));
619
618
  const sketch = new boolean2D.Sketch(wire, {
620
619
  defaultOrigin: [...plane.origin],
621
620
  defaultDirection: [...plane.zDir]
@@ -633,7 +632,7 @@ const sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
633
632
  minR = xRadius;
634
633
  }
635
634
  const wire = errors.unwrap(
636
- curveBuilders.assembleWire([errors.unwrap(curveBuilders.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir))])
635
+ surfaceBuilders.assembleWire([errors.unwrap(surfaceBuilders.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir))])
637
636
  );
638
637
  const sketch = new boolean2D.Sketch(wire, {
639
638
  defaultOrigin: [...plane.origin],
@@ -695,7 +694,7 @@ const sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, s
695
694
  return vectors.planeToWorld(plane, point);
696
695
  });
697
696
  const wire = errors.unwrap(
698
- curveBuilders.assembleWire([r(errors.unwrap(curveBuilders.makeBSplineApproximation(points, approximationConfig)))])
697
+ surfaceBuilders.assembleWire([r(errors.unwrap(surfaceBuilders.makeBSplineApproximation(points, approximationConfig)))])
699
698
  );
700
699
  const sketch = new boolean2D.Sketch(wire, {
701
700
  defaultOrigin: [...plane.origin],
@@ -708,7 +707,7 @@ const sketchHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1],
708
707
  const centerVec3 = occtBoundary.toVec3(center);
709
708
  const dirVec3 = occtBoundary.toVec3(dir);
710
709
  return new boolean2D.Sketch(
711
- errors.unwrap(curveBuilders.assembleWire([curveBuilders.makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)]))
710
+ errors.unwrap(surfaceBuilders.assembleWire([surfaceBuilders.makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)]))
712
711
  );
713
712
  };
714
713
  const makeBaseBox = (xLength, yLength, zLength) => {
@@ -1104,6 +1103,31 @@ function sketchText(text, textConfig, planeConfig = {}) {
1104
1103
  )
1105
1104
  );
1106
1105
  }
1106
+ function textMetrics(text, options) {
1107
+ const fontSize = options?.fontSize ?? 1;
1108
+ const font = getFont(options?.fontFamily);
1109
+ if (!font) throw new Error("No font loaded. Call loadFont() first.");
1110
+ const width = font.getAdvanceWidth(text, fontSize);
1111
+ const scale = fontSize / font.unitsPerEm;
1112
+ const ascender = font.ascender * scale;
1113
+ const descender = font.descender * scale;
1114
+ return { width, height: ascender - descender, ascender, descender };
1115
+ }
1116
+ function fontMetrics(options) {
1117
+ const fontSize = options?.fontSize ?? 1;
1118
+ const font = getFont(options?.fontFamily);
1119
+ if (!font) throw new Error("No font loaded. Call loadFont() first.");
1120
+ const scale = fontSize / font.unitsPerEm;
1121
+ const ascender = font.ascender * scale;
1122
+ const descender = font.descender * scale;
1123
+ const lineGap = (font.tables?.os2?.sTypoLineGap ?? 0) * scale;
1124
+ return {
1125
+ ascender,
1126
+ descender,
1127
+ unitsPerEm: font.unitsPerEm,
1128
+ lineHeight: ascender - descender + lineGap
1129
+ };
1130
+ }
1107
1131
  const PROJECTION_PLANES = {
1108
1132
  XY: { dir: [0, 0, 1], xAxis: [1, 0, 0] },
1109
1133
  XZ: { dir: [0, -1, 0], xAxis: [1, 0, 0] },
@@ -1476,7 +1500,7 @@ const drawParametricFunction = (func, { pointsCount = 400, start = 0, stop = 1,
1476
1500
  const edgesToDrawing = (edges) => {
1477
1501
  const [r, gc] = shapeTypes.localGC();
1478
1502
  const planeSketch = drawRectangle(1e3, 1e3).sketchOnPlane();
1479
- const planeFace = r(errors.unwrap(Blueprint.makeFace(planeSketch.wire)));
1503
+ const planeFace = r(errors.unwrap(surfaceBuilders.makeFace(planeSketch.wire)));
1480
1504
  const curves = edges.map((e) => Blueprint.edgeToCurve(e, planeFace));
1481
1505
  gc();
1482
1506
  const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
@@ -1499,7 +1523,7 @@ function drawProjection(shape, projectionCamera = "front") {
1499
1523
  }
1500
1524
  function drawFaceOutline(face) {
1501
1525
  const [r, gc] = shapeTypes.localGC();
1502
- const clonedFace = r(shapeTypes.createFace(errors.unwrap(cast.downcast(face.wrapped))));
1526
+ const clonedFace = r(shapeTypes.createFace(errors.unwrap(faceFns.downcast(face.wrapped))));
1503
1527
  const faceOuterWire = r(faceFns.outerWire(clonedFace));
1504
1528
  const curves = shapeFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1505
1529
  gc();
@@ -1603,6 +1627,7 @@ exports.drawingFillet = drawingFillet;
1603
1627
  exports.drawingFuse = drawingFuse;
1604
1628
  exports.drawingIntersect = drawingIntersect;
1605
1629
  exports.drawingToSketchOnPlane = drawingToSketchOnPlane;
1630
+ exports.fontMetrics = fontMetrics;
1606
1631
  exports.getFont = getFont;
1607
1632
  exports.isProjectionPlane = isProjectionPlane;
1608
1633
  exports.loadFont = loadFont;
@@ -1629,4 +1654,5 @@ exports.sketchSweep = sketchSweep;
1629
1654
  exports.sketchText = sketchText;
1630
1655
  exports.sketchWires = sketchWires;
1631
1656
  exports.textBlueprints = textBlueprints;
1657
+ exports.textMetrics = textMetrics;
1632
1658
  exports.translateDrawing = translateDrawing;
@@ -155,6 +155,9 @@ const BrepErrorCode = {
155
155
  STL_IMPORT_FAILED: "STL_IMPORT_FAILED",
156
156
  IGES_EXPORT_FAILED: "IGES_EXPORT_FAILED",
157
157
  IGES_IMPORT_FAILED: "IGES_IMPORT_FAILED",
158
+ DXF_IMPORT_FAILED: "DXF_IMPORT_FAILED",
159
+ OBJ_IMPORT_FAILED: "OBJ_IMPORT_FAILED",
160
+ THREEMF_IMPORT_FAILED: "THREEMF_IMPORT_FAILED",
158
161
  // Computation errors
159
162
  PARAMETER_NOT_FOUND: "PARAMETER_NOT_FOUND",
160
163
  INTERSECTION_FAILED: "INTERSECTION_FAILED",
@@ -169,7 +172,29 @@ const BrepErrorCode = {
169
172
  // Minkowski errors
170
173
  MINKOWSKI_FAILED: "MINKOWSKI_FAILED",
171
174
  MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL",
172
- MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D"
175
+ MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D",
176
+ // Polyhedron errors
177
+ POLYHEDRON_INSUFFICIENT_POINTS: "POLYHEDRON_INSUFFICIENT_POINTS",
178
+ POLYHEDRON_INSUFFICIENT_FACES: "POLYHEDRON_INSUFFICIENT_FACES",
179
+ POLYHEDRON_INVALID_INDEX: "POLYHEDRON_INVALID_INDEX",
180
+ POLYHEDRON_FAILED: "POLYHEDRON_FAILED",
181
+ // Roof errors
182
+ ROOF_FAILED: "ROOF_FAILED",
183
+ // Multi-section sweep errors
184
+ MULTI_SWEEP_INSUFFICIENT_SECTIONS: "MULTI_SWEEP_INSUFFICIENT_SECTIONS",
185
+ MULTI_SWEEP_FAILED: "MULTI_SWEEP_FAILED",
186
+ // Guide curve sweep errors
187
+ GUIDED_SWEEP_FAILED: "GUIDED_SWEEP_FAILED",
188
+ // Face tagging errors
189
+ FACE_TAG_INVALID: "FACE_TAG_INVALID",
190
+ // Surface errors
191
+ SURFACE_GRID_TOO_SMALL: "SURFACE_GRID_TOO_SMALL",
192
+ SURFACE_GRID_JAGGED: "SURFACE_GRID_JAGGED",
193
+ SURFACE_FAILED: "SURFACE_FAILED",
194
+ // Assembly mate errors
195
+ ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID",
196
+ ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED",
197
+ ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED"
173
198
  };
174
199
  function makeError(kind, code, message, cause, metadata, suggestion) {
175
200
  const base = { kind, code, message, cause };
@@ -156,6 +156,9 @@ const BrepErrorCode = {
156
156
  STL_IMPORT_FAILED: "STL_IMPORT_FAILED",
157
157
  IGES_EXPORT_FAILED: "IGES_EXPORT_FAILED",
158
158
  IGES_IMPORT_FAILED: "IGES_IMPORT_FAILED",
159
+ DXF_IMPORT_FAILED: "DXF_IMPORT_FAILED",
160
+ OBJ_IMPORT_FAILED: "OBJ_IMPORT_FAILED",
161
+ THREEMF_IMPORT_FAILED: "THREEMF_IMPORT_FAILED",
159
162
  // Computation errors
160
163
  PARAMETER_NOT_FOUND: "PARAMETER_NOT_FOUND",
161
164
  INTERSECTION_FAILED: "INTERSECTION_FAILED",
@@ -170,7 +173,29 @@ const BrepErrorCode = {
170
173
  // Minkowski errors
171
174
  MINKOWSKI_FAILED: "MINKOWSKI_FAILED",
172
175
  MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL",
173
- MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D"
176
+ MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D",
177
+ // Polyhedron errors
178
+ POLYHEDRON_INSUFFICIENT_POINTS: "POLYHEDRON_INSUFFICIENT_POINTS",
179
+ POLYHEDRON_INSUFFICIENT_FACES: "POLYHEDRON_INSUFFICIENT_FACES",
180
+ POLYHEDRON_INVALID_INDEX: "POLYHEDRON_INVALID_INDEX",
181
+ POLYHEDRON_FAILED: "POLYHEDRON_FAILED",
182
+ // Roof errors
183
+ ROOF_FAILED: "ROOF_FAILED",
184
+ // Multi-section sweep errors
185
+ MULTI_SWEEP_INSUFFICIENT_SECTIONS: "MULTI_SWEEP_INSUFFICIENT_SECTIONS",
186
+ MULTI_SWEEP_FAILED: "MULTI_SWEEP_FAILED",
187
+ // Guide curve sweep errors
188
+ GUIDED_SWEEP_FAILED: "GUIDED_SWEEP_FAILED",
189
+ // Face tagging errors
190
+ FACE_TAG_INVALID: "FACE_TAG_INVALID",
191
+ // Surface errors
192
+ SURFACE_GRID_TOO_SMALL: "SURFACE_GRID_TOO_SMALL",
193
+ SURFACE_GRID_JAGGED: "SURFACE_GRID_JAGGED",
194
+ SURFACE_FAILED: "SURFACE_FAILED",
195
+ // Assembly mate errors
196
+ ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID",
197
+ ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED",
198
+ ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED"
174
199
  };
175
200
  function makeError(kind, code, message, cause, metadata, suggestion) {
176
201
  const base = { kind, code, message, cause };