brepjs 12.8.2 → 12.10.0

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 (294) hide show
  1. package/dist/2d/blueprints/{approximations.d.ts → blueprintApproximations.d.ts} +1 -1
  2. package/dist/2d/blueprints/blueprintApproximations.d.ts.map +1 -0
  3. package/dist/2d/blueprints/{customCorners.d.ts → blueprintCustomCorners.d.ts} +1 -1
  4. package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +1 -0
  5. package/dist/2d/blueprints/blueprintFns.d.ts +17 -3
  6. package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
  7. package/dist/2d/blueprints/{offset.d.ts → blueprintOffset.d.ts} +1 -1
  8. package/dist/2d/blueprints/blueprintOffset.d.ts.map +1 -0
  9. package/dist/2d/blueprints/index.d.ts +4 -4
  10. package/dist/2d/blueprints/index.d.ts.map +1 -1
  11. package/dist/2d/lib/Curve2D.d.ts +1 -1
  12. package/dist/2d/lib/Curve2D.d.ts.map +1 -1
  13. package/dist/2d/lib/svgPath.d.ts.map +1 -1
  14. package/dist/2d/lib/vectorOperations.d.ts +4 -1
  15. package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
  16. package/dist/2d-CzEysb7A.js +108 -0
  17. package/dist/2d-DCxS_sb_.cjs +107 -0
  18. package/dist/2d.cjs +24 -88
  19. package/dist/2d.d.ts +1 -1
  20. package/dist/2d.js +34 -99
  21. package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-BoC0DsDm.cjs} +15 -45
  22. package/dist/{Blueprint-DbVaf6k7.js → Blueprint-CQNRtmYG.js} +33 -63
  23. package/dist/{boolean2D-y3E92F0u.js → boolean2D-DXAt4GAK.js} +132 -62
  24. package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-N9Pgumgg.cjs} +112 -42
  25. package/dist/{booleanFns-BCTjYZAg.js → booleanFns-BXV7Oh0h.js} +53 -50
  26. package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-CxArUj_q.cjs} +43 -40
  27. package/dist/brepjs.cjs +448 -379
  28. package/dist/brepjs.js +1634 -1563
  29. package/dist/core/dimensionTypes.d.ts +52 -0
  30. package/dist/core/dimensionTypes.d.ts.map +1 -0
  31. package/dist/core/disposal.d.ts +18 -0
  32. package/dist/core/disposal.d.ts.map +1 -1
  33. package/dist/core/errors.d.ts +7 -8
  34. package/dist/core/errors.d.ts.map +1 -1
  35. package/dist/core/kernelErrorTranslation.d.ts +15 -0
  36. package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
  37. package/dist/core/planeOps.d.ts +14 -0
  38. package/dist/core/planeOps.d.ts.map +1 -1
  39. package/dist/core/result.d.ts +4 -0
  40. package/dist/core/result.d.ts.map +1 -1
  41. package/dist/core/shapeTypes.d.ts +14 -146
  42. package/dist/core/shapeTypes.d.ts.map +1 -1
  43. package/dist/core/{definitionMaps.d.ts → typeDiscriminants.d.ts} +5 -1
  44. package/dist/core/typeDiscriminants.d.ts.map +1 -0
  45. package/dist/core/validityTypes.d.ts +100 -0
  46. package/dist/core/validityTypes.d.ts.map +1 -0
  47. package/dist/core.cjs +52 -11
  48. package/dist/core.d.ts +1 -1
  49. package/dist/core.d.ts.map +1 -1
  50. package/dist/core.js +119 -76
  51. package/dist/{curveFns-BZngcnQ1.cjs → curveFns-CWZRuXQ3.cjs} +2 -2
  52. package/dist/{curveFns-mROFhiuG.js → curveFns-OmbtFSG8.js} +14 -14
  53. package/dist/{drawFns-Bwakrq7w.js → drawFns-8S0ULGRj.js} +146 -118
  54. package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-voV2wEp8.cjs} +153 -125
  55. package/dist/{faceFns-B8GnxjdY.js → faceFns-Bn2seBfp.js} +16 -24
  56. package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-CmIrjdt1.cjs} +2 -10
  57. package/dist/{helpers-X0juxnwj.js → helpers-CEn618MW.js} +89 -21
  58. package/dist/{helpers-C8NoT0Wu.cjs → helpers-mipaxDTy.cjs} +77 -9
  59. package/dist/index.d.ts +20 -19
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/io/gltfImportFns.d.ts +18 -0
  62. package/dist/io/gltfImportFns.d.ts.map +1 -0
  63. package/dist/io/ioUtils.d.ts +16 -0
  64. package/dist/io/ioUtils.d.ts.map +1 -0
  65. package/dist/io/objImportFns.d.ts.map +1 -1
  66. package/dist/io/threemfImportFns.d.ts.map +1 -1
  67. package/dist/io.cjs +4 -4
  68. package/dist/io.js +4 -4
  69. package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
  70. package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
  71. package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
  72. package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
  73. package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
  74. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
  75. package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
  76. package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
  77. package/dist/kernel/brepkit/helpers.d.ts +84 -0
  78. package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
  79. package/dist/kernel/brepkit/internalOps.d.ts +28 -0
  80. package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
  81. package/dist/kernel/brepkit/ioOps.d.ts +43 -0
  82. package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
  83. package/dist/kernel/brepkit/measureOps.d.ts +30 -0
  84. package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
  85. package/dist/kernel/brepkit/meshOps.d.ts +7 -0
  86. package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
  87. package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
  88. package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
  89. package/dist/kernel/brepkit/repairOps.d.ts +14 -0
  90. package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
  91. package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
  92. package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
  93. package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
  94. package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
  95. package/dist/kernel/brepkit/transformOps.d.ts +14 -0
  96. package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
  97. package/dist/kernel/brepkitAdapter.d.ts +1 -1
  98. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  99. package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
  100. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  101. package/dist/kernel/defaultAdapter.d.ts.map +1 -1
  102. package/dist/kernel/extendedConstructorOps.d.ts +9 -1
  103. package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
  104. package/dist/kernel/index.d.ts +1 -0
  105. package/dist/kernel/index.d.ts.map +1 -1
  106. package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
  107. package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
  108. package/dist/kernel/interfaces/builder-ops.d.ts +57 -0
  109. package/dist/kernel/interfaces/builder-ops.d.ts.map +1 -0
  110. package/dist/kernel/interfaces/core.d.ts +30 -0
  111. package/dist/kernel/interfaces/core.d.ts.map +1 -0
  112. package/dist/kernel/interfaces/curve-ops.d.ts +41 -0
  113. package/dist/kernel/interfaces/curve-ops.d.ts.map +1 -0
  114. package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
  115. package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
  116. package/dist/kernel/interfaces/index.d.ts +37 -0
  117. package/dist/kernel/interfaces/index.d.ts.map +1 -0
  118. package/dist/kernel/interfaces/io-ops.d.ts +66 -0
  119. package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
  120. package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
  121. package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
  122. package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
  123. package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
  124. package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
  125. package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
  126. package/dist/kernel/interfaces/primitive-ops.d.ts +13 -0
  127. package/dist/kernel/interfaces/primitive-ops.d.ts.map +1 -0
  128. package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
  129. package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
  130. package/dist/kernel/interfaces/surface-ops.d.ts +50 -0
  131. package/dist/kernel/interfaces/surface-ops.d.ts.map +1 -0
  132. package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
  133. package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
  134. package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
  135. package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
  136. package/dist/kernel/interfaces/transform-ops.d.ts +35 -0
  137. package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
  138. package/dist/kernel/modifierOps.d.ts +2 -2
  139. package/dist/kernel/modifierOps.d.ts.map +1 -1
  140. package/dist/kernel/types.d.ts +2 -446
  141. package/dist/kernel/types.d.ts.map +1 -1
  142. package/dist/measurement/measureCache.d.ts +11 -9
  143. package/dist/measurement/measureCache.d.ts.map +1 -1
  144. package/dist/measurement/measureFns.d.ts +24 -71
  145. package/dist/measurement/measureFns.d.ts.map +1 -1
  146. package/dist/measurement/measureTypes.d.ts +30 -0
  147. package/dist/measurement/measureTypes.d.ts.map +1 -0
  148. package/dist/{measurement-D8EJ694A.js → measurement-fJWDEpz0.js} +53 -34
  149. package/dist/measurement-ph-kanQ7.cjs +154 -0
  150. package/dist/measurement.cjs +2 -1
  151. package/dist/measurement.d.ts +1 -1
  152. package/dist/measurement.d.ts.map +1 -1
  153. package/dist/measurement.js +4 -3
  154. package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-B9p4EVV8.cjs} +4 -4
  155. package/dist/{meshFns-nQjK38EC.js → meshFns-D0qIoxm-.js} +3 -3
  156. package/dist/operations/compoundOpsFns.d.ts +38 -0
  157. package/dist/operations/compoundOpsFns.d.ts.map +1 -0
  158. package/dist/operations/convexHullFns.d.ts +21 -0
  159. package/dist/operations/convexHullFns.d.ts.map +1 -0
  160. package/dist/operations/extrudeFns.d.ts +2 -93
  161. package/dist/operations/extrudeFns.d.ts.map +1 -1
  162. package/dist/operations/guidedSweepFns.d.ts +3 -22
  163. package/dist/operations/guidedSweepFns.d.ts.map +1 -1
  164. package/dist/operations/multiSweepFns.d.ts +3 -29
  165. package/dist/operations/multiSweepFns.d.ts.map +1 -1
  166. package/dist/operations/roofFns.d.ts +2 -2
  167. package/dist/operations/roofFns.d.ts.map +1 -1
  168. package/dist/operations/straightSkeleton.d.ts.map +1 -1
  169. package/dist/operations/sweepFns.d.ts +121 -0
  170. package/dist/operations/sweepFns.d.ts.map +1 -0
  171. package/dist/{operations-BfbkK6DU.js → operations-DX_qy_TB.js} +29 -177
  172. package/dist/{operations-CYpmLSC4.cjs → operations-Ds4xoyxR.cjs} +6 -154
  173. package/dist/operations.cjs +6 -10
  174. package/dist/operations.d.ts +0 -2
  175. package/dist/operations.d.ts.map +1 -1
  176. package/dist/operations.js +26 -30
  177. package/dist/originTrackingFns-BOCAMfd0.js +137 -0
  178. package/dist/originTrackingFns-SPU7ly3_.cjs +136 -0
  179. package/dist/query/edgeFinder.d.ts +4 -14
  180. package/dist/query/edgeFinder.d.ts.map +1 -1
  181. package/dist/query/faceFinder.d.ts +4 -14
  182. package/dist/query/faceFinder.d.ts.map +1 -1
  183. package/dist/query/finderCore.d.ts +6 -0
  184. package/dist/query/finderCore.d.ts.map +1 -1
  185. package/dist/query/shapeFinders.d.ts +32 -0
  186. package/dist/query/shapeFinders.d.ts.map +1 -0
  187. package/dist/query/wireFinder.d.ts +4 -9
  188. package/dist/query/wireFinder.d.ts.map +1 -1
  189. package/dist/query.cjs +54 -32
  190. package/dist/query.js +56 -34
  191. package/dist/{result-BaSD1fqR.js → result-CoDaWsvc.js} +48 -90
  192. package/dist/{result-fAX0OZzI.cjs → result-DULetAht.cjs} +17 -59
  193. package/dist/result.cjs +1 -1
  194. package/dist/result.js +23 -23
  195. package/dist/shapeFns-BZ6zk7nd.js +34 -0
  196. package/dist/shapeFns-bRkrwI8R.cjs +33 -0
  197. package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-T0n6mRmt.cjs} +170 -137
  198. package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-dhhm-T5A.js} +205 -172
  199. package/dist/sketching/CompoundSketch.d.ts +4 -4
  200. package/dist/sketching/CompoundSketch.d.ts.map +1 -1
  201. package/dist/sketching/Sketch.d.ts +3 -3
  202. package/dist/sketching/Sketch.d.ts.map +1 -1
  203. package/dist/sketching/Sketcher.d.ts.map +1 -1
  204. package/dist/sketching/Sketches.d.ts +1 -1
  205. package/dist/sketching/Sketches.d.ts.map +1 -1
  206. package/dist/sketching/draw.d.ts +1 -20
  207. package/dist/sketching/draw.d.ts.map +1 -1
  208. package/dist/sketching/draw3d.d.ts +22 -0
  209. package/dist/sketching/draw3d.d.ts.map +1 -0
  210. package/dist/sketching/sketchFns.d.ts +3 -3
  211. package/dist/sketching/sketchFns.d.ts.map +1 -1
  212. package/dist/sketching/sketchLib.d.ts +2 -2
  213. package/dist/sketching/sketchLib.d.ts.map +1 -1
  214. package/dist/sketching.cjs +2 -2
  215. package/dist/sketching.d.ts +2 -1
  216. package/dist/sketching.d.ts.map +1 -1
  217. package/dist/sketching.js +2 -2
  218. package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BEAoLYvr.cjs} +3 -3
  219. package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-tVmD3R7Z.js} +12 -12
  220. package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-DYS8AMSS.cjs} +3 -3
  221. package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dl0ATFbO.js} +15 -15
  222. package/dist/sweepFns-BKnQs59A.js +215 -0
  223. package/dist/sweepFns-COqeYIUp.cjs +214 -0
  224. package/dist/text/textBlueprints.d.ts +4 -3
  225. package/dist/text/textBlueprints.d.ts.map +1 -1
  226. package/dist/topology/booleanFns.d.ts.map +1 -1
  227. package/dist/topology/cast.d.ts +1 -5
  228. package/dist/topology/cast.d.ts.map +1 -1
  229. package/dist/topology/compoundOpsFns.d.ts +3 -35
  230. package/dist/topology/compoundOpsFns.d.ts.map +1 -1
  231. package/dist/topology/curveFns.d.ts +1 -1
  232. package/dist/topology/curveFns.d.ts.map +1 -1
  233. package/dist/topology/index.d.ts +2 -3
  234. package/dist/topology/index.d.ts.map +1 -1
  235. package/dist/topology/{colorFns.d.ts → metadata/colorFns.d.ts} +2 -2
  236. package/dist/topology/metadata/colorFns.d.ts.map +1 -0
  237. package/dist/topology/{faceTagFns.d.ts → metadata/faceTagFns.d.ts} +2 -2
  238. package/dist/topology/metadata/faceTagFns.d.ts.map +1 -0
  239. package/dist/topology/metadata/metadataPropagation.d.ts +30 -0
  240. package/dist/topology/metadata/metadataPropagation.d.ts.map +1 -0
  241. package/dist/topology/metadata/originTrackingFns.d.ts +23 -0
  242. package/dist/topology/metadata/originTrackingFns.d.ts.map +1 -0
  243. package/dist/topology/modifierFns.d.ts.map +1 -1
  244. package/dist/topology/shapeFns.d.ts +6 -120
  245. package/dist/topology/shapeFns.d.ts.map +1 -1
  246. package/dist/topology/topologyQueryFns.d.ts +67 -0
  247. package/dist/topology/topologyQueryFns.d.ts.map +1 -0
  248. package/dist/topology/transformFns.d.ts +49 -0
  249. package/dist/topology/transformFns.d.ts.map +1 -0
  250. package/dist/topology/wrapperFns.d.ts.map +1 -1
  251. package/dist/{topology-C7x98OVn.js → topology-C1oUQXZS.js} +235 -50
  252. package/dist/{topology-ANwCzGL8.cjs → topology-xyDYbkHW.cjs} +205 -20
  253. package/dist/topology.cjs +18 -17
  254. package/dist/topology.js +97 -96
  255. package/dist/topologyQueryFns-0IptTUCo.cjs +118 -0
  256. package/dist/topologyQueryFns-Dj4Xd5kx.js +119 -0
  257. package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
  258. package/dist/utils/precisionRound.d.ts +4 -0
  259. package/dist/utils/precisionRound.d.ts.map +1 -1
  260. package/dist/utils/vec2d.d.ts +5 -0
  261. package/dist/utils/vec2d.d.ts.map +1 -1
  262. package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
  263. package/dist/{vectors-Bx8wkNui.js → vectors-B8juLsQB.js} +15 -7
  264. package/dist/{vectors-D_IiZx0q.cjs → vectors-I_0zdD3O.cjs} +9 -1
  265. package/dist/vectors.cjs +1 -1
  266. package/dist/vectors.js +23 -23
  267. package/package.json +9 -9
  268. package/dist/2d/blueprints/approximations.d.ts.map +0 -1
  269. package/dist/2d/blueprints/customCorners.d.ts.map +0 -1
  270. package/dist/2d/blueprints/offset.d.ts.map +0 -1
  271. package/dist/core/definitionMaps.d.ts.map +0 -1
  272. package/dist/core/geometryHelpers.d.ts +0 -30
  273. package/dist/core/geometryHelpers.d.ts.map +0 -1
  274. package/dist/core/memory.d.ts +0 -6
  275. package/dist/core/memory.d.ts.map +0 -1
  276. package/dist/core/typeErrors.d.ts +0 -17
  277. package/dist/core/typeErrors.d.ts.map +0 -1
  278. package/dist/cornerFinder-Ckz-mPHE.js +0 -59
  279. package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
  280. package/dist/loft-Bhw-FMoL.js +0 -228
  281. package/dist/loft-hp3pc1M7.cjs +0 -227
  282. package/dist/measurement-BoNTUBAp.cjs +0 -135
  283. package/dist/operations/extrude.d.ts +0 -72
  284. package/dist/operations/extrude.d.ts.map +0 -1
  285. package/dist/operations/loft.d.ts +0 -33
  286. package/dist/operations/loft.d.ts.map +0 -1
  287. package/dist/shapeFns-C2SnNvdH.cjs +0 -468
  288. package/dist/shapeFns-FDuKkrDR.js +0 -469
  289. package/dist/topology/colorFns.d.ts.map +0 -1
  290. package/dist/topology/faceTagFns.d.ts.map +0 -1
  291. package/dist/utils/round2.d.ts +0 -3
  292. package/dist/utils/round2.d.ts.map +0 -1
  293. package/dist/utils/round5.d.ts +0 -3
  294. package/dist/utils/round5.d.ts.map +0 -1
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
3
+ const vecOps = require("./vecOps-CjRL1jau.cjs");
4
+ const faceFns = require("./faceFns-CmIrjdt1.cjs");
5
+ const result = require("./result-DULetAht.cjs");
6
+ function clone(shape) {
7
+ return shapeTypes.castShape(result.unwrap(faceFns.downcast(shape.wrapped)));
8
+ }
9
+ function toBREP(shape) {
10
+ return shapeTypes.getKernel().toBREP(shape.wrapped);
11
+ }
12
+ function getHashCode(shape) {
13
+ return shapeTypes.getKernel().hashCode(shape.wrapped, vecOps.HASH_CODE_MAX);
14
+ }
15
+ function isEmpty(shape) {
16
+ return shapeTypes.getKernel().isNull(shape.wrapped);
17
+ }
18
+ function isSameShape(a, b) {
19
+ return shapeTypes.getKernel().isSame(a.wrapped, b.wrapped);
20
+ }
21
+ function isEqualShape(a, b) {
22
+ return shapeTypes.getKernel().isEqual(a.wrapped, b.wrapped);
23
+ }
24
+ function simplify(shape) {
25
+ return shapeTypes.castShape(shapeTypes.getKernel().simplify(shape.wrapped));
26
+ }
27
+ exports.clone = clone;
28
+ exports.getHashCode = getHashCode;
29
+ exports.isEmpty = isEmpty;
30
+ exports.isEqualShape = isEqualShape;
31
+ exports.isSameShape = isSameShape;
32
+ exports.simplify = simplify;
33
+ exports.toBREP = toBREP;
@@ -1082,7 +1082,17 @@ function chamferDistAngle(oc, shape, edges, distance2, angleDeg) {
1082
1082
  return result;
1083
1083
  }
1084
1084
  function offsetWire2D(oc, wire, offsetVal, joinType) {
1085
- const jt = joinType ?? oc.GeomAbs_JoinType.GeomAbs_Arc;
1085
+ let jt;
1086
+ if (typeof joinType === "string") {
1087
+ const map = {
1088
+ arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
1089
+ intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
1090
+ tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
1091
+ };
1092
+ jt = map[joinType] ?? oc.GeomAbs_JoinType.GeomAbs_Arc;
1093
+ } else {
1094
+ jt = joinType ?? oc.GeomAbs_JoinType.GeomAbs_Arc;
1095
+ }
1086
1096
  const offsetter = new oc.BRepOffsetAPI_MakeOffset_3(wire, jt, false);
1087
1097
  offsetter.Perform(offsetVal, 0);
1088
1098
  const result = offsetter.Shape();
@@ -2208,6 +2218,74 @@ function dispose(_oc, handle) {
2208
2218
  } catch {
2209
2219
  }
2210
2220
  }
2221
+ function makeRectangle(oc, width, height) {
2222
+ const e1 = makeLineEdge(oc, [0, 0, 0], [width, 0, 0]);
2223
+ const e2 = makeLineEdge(oc, [width, 0, 0], [width, height, 0]);
2224
+ const e3 = makeLineEdge(oc, [width, height, 0], [0, height, 0]);
2225
+ const e4 = makeLineEdge(oc, [0, height, 0], [0, 0, 0]);
2226
+ const bw = new oc.BRepBuilderAPI_MakeWire_1();
2227
+ bw.Add_1(e1);
2228
+ bw.Add_1(e2);
2229
+ bw.Add_1(e3);
2230
+ bw.Add_1(e4);
2231
+ const wire = bw.Wire();
2232
+ bw.delete();
2233
+ e1.delete();
2234
+ e2.delete();
2235
+ e3.delete();
2236
+ e4.delete();
2237
+ const bf = new oc.BRepBuilderAPI_MakeFace_15(wire, false);
2238
+ const face = bf.Face();
2239
+ bf.delete();
2240
+ return face;
2241
+ }
2242
+ function createPoint3d(oc, x, y, z) {
2243
+ return new oc.gp_Pnt_3(x, y, z);
2244
+ }
2245
+ function createDirection3d(oc, x, y, z) {
2246
+ return new oc.gp_Dir_4(x, y, z);
2247
+ }
2248
+ function createVector3d(oc, x, y, z) {
2249
+ return new oc.gp_Vec_4(x, y, z);
2250
+ }
2251
+ function createAxis1(oc, cx, cy, cz, dx, dy, dz) {
2252
+ const pnt = new oc.gp_Pnt_3(cx, cy, cz);
2253
+ const dir = new oc.gp_Dir_4(dx, dy, dz);
2254
+ const ax = new oc.gp_Ax1_2(pnt, dir);
2255
+ pnt.delete();
2256
+ dir.delete();
2257
+ return ax;
2258
+ }
2259
+ function createAxis2(oc, ox, oy, oz, zx, zy, zz, xx, xy, xz) {
2260
+ const pnt = new oc.gp_Pnt_3(ox, oy, oz);
2261
+ const z = new oc.gp_Dir_4(zx, zy, zz);
2262
+ let ax;
2263
+ if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
2264
+ const x = new oc.gp_Dir_4(xx, xy, xz);
2265
+ ax = new oc.gp_Ax2_2(pnt, z, x);
2266
+ x.delete();
2267
+ } else {
2268
+ ax = new oc.gp_Ax2_3(pnt, z);
2269
+ }
2270
+ pnt.delete();
2271
+ z.delete();
2272
+ return ax;
2273
+ }
2274
+ function createAxis3(oc, ox, oy, oz, zx, zy, zz, xx, xy, xz) {
2275
+ const pnt = new oc.gp_Pnt_3(ox, oy, oz);
2276
+ const z = new oc.gp_Dir_4(zx, zy, zz);
2277
+ let ax;
2278
+ if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
2279
+ const x = new oc.gp_Dir_4(xx, xy, xz);
2280
+ ax = new oc.gp_Ax3_3(pnt, z, x);
2281
+ x.delete();
2282
+ } else {
2283
+ ax = new oc.gp_Ax3_4(pnt, z);
2284
+ }
2285
+ pnt.delete();
2286
+ z.delete();
2287
+ return ax;
2288
+ }
2211
2289
  function mapContinuity(oc, continuity) {
2212
2290
  switch (continuity) {
2213
2291
  case "C0":
@@ -4111,12 +4189,7 @@ class DefaultAdapter {
4111
4189
  return makeBoxFromCorners(this.oc, p1, p2);
4112
4190
  }
4113
4191
  makeRectangle(width, height) {
4114
- const e1 = this.makeLineEdge([0, 0, 0], [width, 0, 0]);
4115
- const e2 = this.makeLineEdge([width, 0, 0], [width, height, 0]);
4116
- const e3 = this.makeLineEdge([width, height, 0], [0, height, 0]);
4117
- const e4 = this.makeLineEdge([0, height, 0], [0, 0, 0]);
4118
- const wire = this.makeWire([e1, e2, e3, e4]);
4119
- return this.makeFace(wire);
4192
+ return makeRectangle(this.oc, width, height);
4120
4193
  }
4121
4194
  solidFromShell(shell2) {
4122
4195
  return solidFromShell(this.oc, shell2);
@@ -4333,17 +4406,7 @@ class DefaultAdapter {
4333
4406
  }
4334
4407
  // --- 2D offset ---
4335
4408
  offsetWire2D(wire, offset2, joinType) {
4336
- let jt = joinType;
4337
- if (typeof joinType === "string") {
4338
- const oc = this.oc;
4339
- const map = {
4340
- arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
4341
- intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
4342
- tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
4343
- };
4344
- jt = map[joinType];
4345
- }
4346
- return offsetWire2D(this.oc, wire, offset2, jt);
4409
+ return offsetWire2D(this.oc, wire, offset2, joinType);
4347
4410
  }
4348
4411
  // --- Distance ---
4349
4412
  distance(shape1, shape2) {
@@ -4779,51 +4842,22 @@ class DefaultAdapter {
4779
4842
  }
4780
4843
  // --- 3D Geometry primitive factories ---
4781
4844
  createPoint3d(x, y, z) {
4782
- return new this.oc.gp_Pnt_3(x, y, z);
4845
+ return createPoint3d(this.oc, x, y, z);
4783
4846
  }
4784
4847
  createDirection3d(x, y, z) {
4785
- return new this.oc.gp_Dir_4(x, y, z);
4848
+ return createDirection3d(this.oc, x, y, z);
4786
4849
  }
4787
4850
  createVector3d(x, y, z) {
4788
- return new this.oc.gp_Vec_4(x, y, z);
4851
+ return createVector3d(this.oc, x, y, z);
4789
4852
  }
4790
4853
  createAxis1(cx, cy, cz, dx, dy, dz) {
4791
- const pnt = new this.oc.gp_Pnt_3(cx, cy, cz);
4792
- const dir = new this.oc.gp_Dir_4(dx, dy, dz);
4793
- const ax = new this.oc.gp_Ax1_2(pnt, dir);
4794
- pnt.delete();
4795
- dir.delete();
4796
- return ax;
4854
+ return createAxis1(this.oc, cx, cy, cz, dx, dy, dz);
4797
4855
  }
4798
4856
  createAxis2(ox, oy, oz, zx, zy, zz, xx, xy, xz) {
4799
- const pnt = new this.oc.gp_Pnt_3(ox, oy, oz);
4800
- const z = new this.oc.gp_Dir_4(zx, zy, zz);
4801
- let ax;
4802
- if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
4803
- const x = new this.oc.gp_Dir_4(xx, xy, xz);
4804
- ax = new this.oc.gp_Ax2_2(pnt, z, x);
4805
- x.delete();
4806
- } else {
4807
- ax = new this.oc.gp_Ax2_3(pnt, z);
4808
- }
4809
- pnt.delete();
4810
- z.delete();
4811
- return ax;
4857
+ return createAxis2(this.oc, ox, oy, oz, zx, zy, zz, xx, xy, xz);
4812
4858
  }
4813
4859
  createAxis3(ox, oy, oz, zx, zy, zz, xx, xy, xz) {
4814
- const pnt = new this.oc.gp_Pnt_3(ox, oy, oz);
4815
- const z = new this.oc.gp_Dir_4(zx, zy, zz);
4816
- let ax;
4817
- if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
4818
- const x = new this.oc.gp_Dir_4(xx, xy, xz);
4819
- ax = new this.oc.gp_Ax3_3(pnt, z, x);
4820
- x.delete();
4821
- } else {
4822
- ax = new this.oc.gp_Ax3_4(pnt, z);
4823
- }
4824
- pnt.delete();
4825
- z.delete();
4826
- return ax;
4860
+ return createAxis3(this.oc, ox, oy, oz, zx, zy, zz, xx, xy, xz);
4827
4861
  }
4828
4862
  // --- Unsupported brepkit-only methods ---
4829
4863
  export3MF(_shape, _tolerance) {
@@ -4967,7 +5001,13 @@ function withKernel(id, fn) {
4967
5001
  _defaultKernelId = id;
4968
5002
  _cachedDefault = _kernels.get(id) ?? null;
4969
5003
  try {
4970
- return fn();
5004
+ const result = fn();
5005
+ if (result instanceof Promise) {
5006
+ throw new Error(
5007
+ "withKernel() callback returned a Promise. Async code must use getKernel(id) directly — the kernel override is restored synchronously in finally."
5008
+ );
5009
+ }
5010
+ return result;
4971
5011
  } finally {
4972
5012
  _defaultKernelId = prev;
4973
5013
  _cachedDefault = prev ? _kernels.get(prev) ?? null : null;
@@ -4993,7 +5033,38 @@ if (!globalWithRegistry.FinalizationRegistry) {
4993
5033
  }
4994
5034
  };
4995
5035
  }
5036
+ const _stats = {
5037
+ liveHandles: 0,
5038
+ peakHandles: 0,
5039
+ gcCollected: 0,
5040
+ scopeEnters: 0,
5041
+ scopeExits: 0
5042
+ };
5043
+ function getDisposalStats() {
5044
+ return { ..._stats };
5045
+ }
5046
+ function resetDisposalStats() {
5047
+ _stats.liveHandles = 0;
5048
+ _stats.peakHandles = 0;
5049
+ _stats.gcCollected = 0;
5050
+ _stats.scopeEnters = 0;
5051
+ _stats.scopeExits = 0;
5052
+ }
5053
+ function trackHandleCreated() {
5054
+ _stats.liveHandles++;
5055
+ if (_stats.liveHandles > _stats.peakHandles) {
5056
+ _stats.peakHandles = _stats.liveHandles;
5057
+ }
5058
+ }
5059
+ function trackHandleDisposed() {
5060
+ _stats.liveHandles--;
5061
+ }
5062
+ function trackGcCollected() {
5063
+ _stats.gcCollected++;
5064
+ _stats.liveHandles--;
5065
+ }
4996
5066
  const registry = new FinalizationRegistry((heldValue) => {
5067
+ trackGcCollected();
4997
5068
  try {
4998
5069
  heldValue.delete();
4999
5070
  } catch {
@@ -5004,6 +5075,7 @@ function createHandle(ocShape) {
5004
5075
  const dispose2 = () => {
5005
5076
  if (!disposed) {
5006
5077
  disposed = true;
5078
+ trackHandleDisposed();
5007
5079
  registry.unregister(handle);
5008
5080
  try {
5009
5081
  ocShape.delete();
@@ -5026,6 +5098,7 @@ function createHandle(ocShape) {
5026
5098
  dispose2();
5027
5099
  }
5028
5100
  };
5101
+ trackHandleCreated();
5029
5102
  registry.register(handle, ocShape, handle);
5030
5103
  return handle;
5031
5104
  }
@@ -5042,6 +5115,7 @@ function createKernelHandle(ocObj) {
5042
5115
  [Symbol.dispose]() {
5043
5116
  if (!disposed) {
5044
5117
  disposed = true;
5118
+ trackHandleDisposed();
5045
5119
  registry.unregister(handle);
5046
5120
  try {
5047
5121
  ocObj.delete();
@@ -5050,11 +5124,15 @@ function createKernelHandle(ocObj) {
5050
5124
  }
5051
5125
  }
5052
5126
  };
5127
+ trackHandleCreated();
5053
5128
  registry.register(handle, ocObj, handle);
5054
5129
  return handle;
5055
5130
  }
5056
5131
  class DisposalScope {
5057
5132
  handles = [];
5133
+ constructor() {
5134
+ _stats.scopeEnters++;
5135
+ }
5058
5136
  /** Register a resource for disposal when scope ends. */
5059
5137
  register(resource) {
5060
5138
  this.handles.push(() => {
@@ -5076,6 +5154,7 @@ class DisposalScope {
5076
5154
  return disposable;
5077
5155
  }
5078
5156
  [Symbol.dispose]() {
5157
+ _stats.scopeExits++;
5079
5158
  for (let i = this.handles.length - 1; i >= 0; i--) {
5080
5159
  this.handles[i]?.();
5081
5160
  }
@@ -5124,20 +5203,38 @@ async function withScopeResultAsync(fn) {
5124
5203
  function isLive(handle) {
5125
5204
  return !handle.disposed;
5126
5205
  }
5127
- function brandHandle(handle) {
5206
+ function is3D(s) {
5207
+ return s.__is2D !== true;
5208
+ }
5209
+ function is2D(s) {
5210
+ return s.__is2D === true;
5211
+ }
5212
+ function as3D(s) {
5213
+ if (!is3D(s)) throw new Error("Expected 3D shape, got 2D");
5214
+ return s;
5215
+ }
5216
+ function as2D(s) {
5217
+ if (!is2D(s)) throw new Error("Expected 2D shape, got 3D");
5218
+ return s;
5219
+ }
5220
+ function getShapeKind(shape) {
5221
+ return getKernel().shapeType(shape.wrapped);
5222
+ }
5223
+ function brandHandle(handle, dim) {
5224
+ if (dim === "2D") handle.__is2D = true;
5128
5225
  return handle;
5129
5226
  }
5130
- function createVertex(ocShape) {
5131
- return brandHandle(createHandle(ocShape));
5227
+ function createVertex(ocShape, dim) {
5228
+ return brandHandle(createHandle(ocShape), dim);
5132
5229
  }
5133
- function createEdge(ocShape) {
5134
- return brandHandle(createHandle(ocShape));
5230
+ function createEdge(ocShape, dim) {
5231
+ return brandHandle(createHandle(ocShape), dim);
5135
5232
  }
5136
- function createWire(ocShape) {
5137
- return brandHandle(createHandle(ocShape));
5233
+ function createWire(ocShape, dim) {
5234
+ return brandHandle(createHandle(ocShape), dim);
5138
5235
  }
5139
- function createFace(ocShape) {
5140
- return brandHandle(createHandle(ocShape));
5236
+ function createFace(ocShape, dim) {
5237
+ return brandHandle(createHandle(ocShape), dim);
5141
5238
  }
5142
5239
  function createShell(ocShape) {
5143
5240
  return brandHandle(createHandle(ocShape));
@@ -5148,11 +5245,8 @@ function createSolid(ocShape) {
5148
5245
  function createCompSolid(ocShape) {
5149
5246
  return brandHandle(createHandle(ocShape));
5150
5247
  }
5151
- function createCompound(ocShape) {
5152
- return brandHandle(createHandle(ocShape));
5153
- }
5154
- function getShapeKind(shape) {
5155
- return getKernel().shapeType(shape.wrapped);
5248
+ function createCompound(ocShape, dim) {
5249
+ return brandHandle(createHandle(ocShape), dim);
5156
5250
  }
5157
5251
  function isVertex(s) {
5158
5252
  return getShapeKind(s) === "vertex";
@@ -5185,73 +5279,18 @@ function isShape1D(s) {
5185
5279
  const kind = getShapeKind(s);
5186
5280
  return kind === "edge" || kind === "wire";
5187
5281
  }
5188
- function is3D(s) {
5189
- return s.__is2D !== true;
5190
- }
5191
- function is2D(s) {
5192
- return s.__is2D === true;
5193
- }
5194
- function as3D(s) {
5195
- if (!is3D(s)) throw new Error("Expected 3D shape, got 2D");
5196
- return s;
5197
- }
5198
- function as2D(s) {
5199
- if (!is2D(s)) throw new Error("Expected 2D shape, got 3D");
5200
- return s;
5201
- }
5202
- function isClosedWire(wire) {
5203
- return getKernel().curveIsClosed(wire.wrapped);
5204
- }
5205
- function isOrientedFace(face) {
5206
- return getKernel().isValid(face.wrapped);
5207
- }
5208
- function isManifoldShell(shell2) {
5209
- const kernel = getKernel();
5210
- if (!kernel.isValid(shell2.wrapped)) return false;
5211
- const validate = kernel.isValidStrict?.bind(kernel) ?? kernel.isValid.bind(kernel);
5212
- try {
5213
- const solid = kernel.solidFromShell(shell2.wrapped);
5214
- const valid = validate(solid);
5215
- try {
5216
- kernel.dispose(solid);
5217
- } catch {
5218
- }
5219
- return valid;
5220
- } catch {
5221
- return false;
5222
- }
5223
- }
5224
- function isValidSolid(solid) {
5225
- return getKernel().isValid(solid.wrapped);
5226
- }
5227
- function closedWire(wire) {
5228
- if (isClosedWire(wire)) return { valid: true, shape: wire };
5229
- return { valid: false, reason: "Wire is not closed: start and end points do not coincide" };
5230
- }
5231
- function orientedFace(face) {
5232
- if (isOrientedFace(face)) return { valid: true, shape: face };
5233
- return { valid: false, reason: "Face orientation is inconsistent or face is invalid" };
5234
- }
5235
- function manifoldShell(shell2) {
5236
- if (isManifoldShell(shell2)) return { valid: true, shape: shell2 };
5237
- return { valid: false, reason: "Shell is not manifold: has free edges or is invalid" };
5238
- }
5239
- function validSolid(solid) {
5240
- if (isValidSolid(solid)) return { valid: true, shape: solid };
5241
- return { valid: false, reason: "Solid failed BRepCheck validation" };
5242
- }
5243
- function castShape(ocShape) {
5282
+ function castShape(ocShape, dim) {
5244
5283
  const kernel = getKernel();
5245
5284
  const st = kernel.shapeType(ocShape);
5246
5285
  const dc = kernel.downcast(ocShape, st);
5247
- if (st === "vertex") return createVertex(dc);
5248
- if (st === "edge") return createEdge(dc);
5249
- if (st === "wire") return createWire(dc);
5250
- if (st === "face") return createFace(dc);
5286
+ if (st === "vertex") return createVertex(dc, dim);
5287
+ if (st === "edge") return createEdge(dc, dim);
5288
+ if (st === "wire") return createWire(dc, dim);
5289
+ if (st === "face") return createFace(dc, dim);
5251
5290
  if (st === "shell") return createShell(dc);
5252
5291
  if (st === "solid") return createSolid(dc);
5253
5292
  if (st === "compsolid") return createCompSolid(dc);
5254
- return createCompound(dc);
5293
+ return createCompound(dc, dim);
5255
5294
  }
5256
5295
  function castShape3D(ocShape) {
5257
5296
  return castShape(ocShape);
@@ -5261,7 +5300,6 @@ exports.as2D = as2D;
5261
5300
  exports.as3D = as3D;
5262
5301
  exports.castShape = castShape;
5263
5302
  exports.castShape3D = castShape3D;
5264
- exports.closedWire = closedWire;
5265
5303
  exports.createCompound = createCompound;
5266
5304
  exports.createEdge = createEdge;
5267
5305
  exports.createFace = createFace;
@@ -5271,32 +5309,27 @@ exports.createShell = createShell;
5271
5309
  exports.createSolid = createSolid;
5272
5310
  exports.createVertex = createVertex;
5273
5311
  exports.createWire = createWire;
5312
+ exports.getDisposalStats = getDisposalStats;
5274
5313
  exports.getKernel = getKernel;
5275
5314
  exports.getKernel2D = getKernel2D;
5276
5315
  exports.getShapeKind = getShapeKind;
5277
5316
  exports.initFromOC = initFromOC;
5278
5317
  exports.is2D = is2D;
5279
5318
  exports.is3D = is3D;
5280
- exports.isClosedWire = isClosedWire;
5281
5319
  exports.isCompound = isCompound;
5282
5320
  exports.isEdge = isEdge;
5283
5321
  exports.isFace = isFace;
5284
5322
  exports.isLive = isLive;
5285
- exports.isManifoldShell = isManifoldShell;
5286
- exports.isOrientedFace = isOrientedFace;
5287
5323
  exports.isShape1D = isShape1D;
5288
5324
  exports.isShape3D = isShape3D;
5289
5325
  exports.isShell = isShell;
5290
5326
  exports.isSolid = isSolid;
5291
- exports.isValidSolid = isValidSolid;
5292
5327
  exports.isVertex = isVertex;
5293
5328
  exports.isWire = isWire;
5294
- exports.manifoldShell = manifoldShell;
5295
- exports.orientedFace = orientedFace;
5296
5329
  exports.registerForCleanup = registerForCleanup;
5297
5330
  exports.registerKernel = registerKernel;
5331
+ exports.resetDisposalStats = resetDisposalStats;
5298
5332
  exports.unregisterFromCleanup = unregisterFromCleanup;
5299
- exports.validSolid = validSolid;
5300
5333
  exports.withKernel = withKernel;
5301
5334
  exports.withScope = withScope;
5302
5335
  exports.withScopeResult = withScopeResult;