brepjs 12.8.2 → 12.9.1

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 (225) hide show
  1. package/dist/2d/lib/svgPath.d.ts.map +1 -1
  2. package/dist/2d/lib/vectorOperations.d.ts +4 -1
  3. package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
  4. package/dist/2d.cjs +2 -2
  5. package/dist/2d.js +5 -5
  6. package/dist/{Blueprint-DbVaf6k7.js → Blueprint-1HGbugaC.js} +33 -63
  7. package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-CUyXM6CV.cjs} +15 -45
  8. package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-9OnbotKT.cjs} +9 -9
  9. package/dist/{boolean2D-y3E92F0u.js → boolean2D-CR4efa35.js} +11 -11
  10. package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-BBd2oTvv.cjs} +43 -40
  11. package/dist/{booleanFns-BCTjYZAg.js → booleanFns-Br2KdGJq.js} +53 -50
  12. package/dist/brepjs.cjs +379 -284
  13. package/dist/brepjs.js +1437 -1341
  14. package/dist/core/definitionMaps.d.ts +2 -7
  15. package/dist/core/definitionMaps.d.ts.map +1 -1
  16. package/dist/core/dimensionTypes.d.ts +52 -0
  17. package/dist/core/dimensionTypes.d.ts.map +1 -0
  18. package/dist/core/disposal.d.ts +18 -0
  19. package/dist/core/disposal.d.ts.map +1 -1
  20. package/dist/core/errors.d.ts +1 -8
  21. package/dist/core/errors.d.ts.map +1 -1
  22. package/dist/core/kernelErrorTranslation.d.ts +15 -0
  23. package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
  24. package/dist/core/planeOps.d.ts +14 -0
  25. package/dist/core/planeOps.d.ts.map +1 -1
  26. package/dist/core/result.d.ts +4 -0
  27. package/dist/core/result.d.ts.map +1 -1
  28. package/dist/core/shapeTypes.d.ts +14 -146
  29. package/dist/core/shapeTypes.d.ts.map +1 -1
  30. package/dist/core/typeDiscriminants.d.ts +14 -0
  31. package/dist/core/typeDiscriminants.d.ts.map +1 -0
  32. package/dist/core/validityTypes.d.ts +100 -0
  33. package/dist/core/validityTypes.d.ts.map +1 -0
  34. package/dist/core.cjs +52 -11
  35. package/dist/core.d.ts +1 -1
  36. package/dist/core.d.ts.map +1 -1
  37. package/dist/core.js +118 -75
  38. package/dist/{curveFns-mROFhiuG.js → curveFns-1u0oZ0u0.js} +14 -14
  39. package/dist/{curveFns-BZngcnQ1.cjs → curveFns-BwLvO_Ia.cjs} +2 -2
  40. package/dist/{drawFns-Bwakrq7w.js → drawFns-B0na6sbo.js} +16 -16
  41. package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-CzlEePor.cjs} +18 -18
  42. package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-BAKkZG6D.cjs} +2 -2
  43. package/dist/{faceFns-B8GnxjdY.js → faceFns-DGMp47Os.js} +3 -3
  44. package/dist/{helpers-C8NoT0Wu.cjs → helpers-DVdscQxW.cjs} +73 -8
  45. package/dist/{helpers-X0juxnwj.js → helpers-sJjnIXDA.js} +85 -20
  46. package/dist/index.d.ts +10 -11
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/io.cjs +4 -4
  49. package/dist/io.js +4 -4
  50. package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
  51. package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
  52. package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
  53. package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
  54. package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
  55. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
  56. package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
  57. package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
  58. package/dist/kernel/brepkit/helpers.d.ts +84 -0
  59. package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
  60. package/dist/kernel/brepkit/internalOps.d.ts +28 -0
  61. package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
  62. package/dist/kernel/brepkit/ioOps.d.ts +43 -0
  63. package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
  64. package/dist/kernel/brepkit/measureOps.d.ts +30 -0
  65. package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
  66. package/dist/kernel/brepkit/meshOps.d.ts +7 -0
  67. package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
  68. package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
  69. package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
  70. package/dist/kernel/brepkit/repairOps.d.ts +14 -0
  71. package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
  72. package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
  73. package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
  74. package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
  75. package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
  76. package/dist/kernel/brepkit/transformOps.d.ts +14 -0
  77. package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
  78. package/dist/kernel/brepkitAdapter.d.ts +1 -1
  79. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  80. package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
  81. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  82. package/dist/kernel/defaultAdapter.d.ts.map +1 -1
  83. package/dist/kernel/extendedConstructorOps.d.ts +9 -1
  84. package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
  85. package/dist/kernel/index.d.ts +1 -0
  86. package/dist/kernel/index.d.ts.map +1 -1
  87. package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
  88. package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
  89. package/dist/kernel/interfaces/construction-ops.d.ts +76 -0
  90. package/dist/kernel/interfaces/construction-ops.d.ts.map +1 -0
  91. package/dist/kernel/interfaces/core.d.ts +45 -0
  92. package/dist/kernel/interfaces/core.d.ts.map +1 -0
  93. package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
  94. package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
  95. package/dist/kernel/interfaces/geometry-ops.d.ts +77 -0
  96. package/dist/kernel/interfaces/geometry-ops.d.ts.map +1 -0
  97. package/dist/kernel/interfaces/index.d.ts +29 -0
  98. package/dist/kernel/interfaces/index.d.ts.map +1 -0
  99. package/dist/kernel/interfaces/io-ops.d.ts +66 -0
  100. package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
  101. package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
  102. package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
  103. package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
  104. package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
  105. package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
  106. package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
  107. package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
  108. package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
  109. package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
  110. package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
  111. package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
  112. package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
  113. package/dist/kernel/interfaces/transform-ops.d.ts +20 -0
  114. package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
  115. package/dist/kernel/modifierOps.d.ts +2 -2
  116. package/dist/kernel/modifierOps.d.ts.map +1 -1
  117. package/dist/kernel/types.d.ts +2 -446
  118. package/dist/kernel/types.d.ts.map +1 -1
  119. package/dist/{loft-hp3pc1M7.cjs → loft-BNvBZzqe.cjs} +5 -5
  120. package/dist/{loft-Bhw-FMoL.js → loft-D0aCZRaB.js} +7 -7
  121. package/dist/measurement/measureFns.d.ts +2 -2
  122. package/dist/measurement/measureFns.d.ts.map +1 -1
  123. package/dist/{measurement-D8EJ694A.js → measurement-C7o5jE6G.js} +2 -2
  124. package/dist/{measurement-BoNTUBAp.cjs → measurement-DZcaxo1A.cjs} +2 -2
  125. package/dist/measurement.cjs +1 -1
  126. package/dist/measurement.js +1 -1
  127. package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-7dgZgNYK.cjs} +4 -4
  128. package/dist/{meshFns-nQjK38EC.js → meshFns-CtUl9fGY.js} +3 -3
  129. package/dist/operations/compoundOpsFns.d.ts +38 -0
  130. package/dist/operations/compoundOpsFns.d.ts.map +1 -0
  131. package/dist/operations/extrude.d.ts +2 -12
  132. package/dist/operations/extrude.d.ts.map +1 -1
  133. package/dist/operations/extrudeFns.d.ts +2 -93
  134. package/dist/operations/extrudeFns.d.ts.map +1 -1
  135. package/dist/operations/guidedSweepFns.d.ts +3 -22
  136. package/dist/operations/guidedSweepFns.d.ts.map +1 -1
  137. package/dist/operations/loft.d.ts +2 -16
  138. package/dist/operations/loft.d.ts.map +1 -1
  139. package/dist/operations/multiSweepFns.d.ts +3 -29
  140. package/dist/operations/multiSweepFns.d.ts.map +1 -1
  141. package/dist/operations/roofFns.d.ts +2 -2
  142. package/dist/operations/roofFns.d.ts.map +1 -1
  143. package/dist/operations/sweepFns.d.ts +121 -0
  144. package/dist/operations/sweepFns.d.ts.map +1 -0
  145. package/dist/{operations-BfbkK6DU.js → operations-DisJ5F8s.js} +110 -57
  146. package/dist/{operations-CYpmLSC4.cjs → operations-DwZ-RBO1.cjs} +97 -44
  147. package/dist/operations.cjs +2 -2
  148. package/dist/operations.js +14 -14
  149. package/dist/originTrackingFns-NJ1dWoiF.js +137 -0
  150. package/dist/originTrackingFns-dhaCe8Yb.cjs +136 -0
  151. package/dist/query/edgeFinder.d.ts +4 -14
  152. package/dist/query/edgeFinder.d.ts.map +1 -1
  153. package/dist/query/faceFinder.d.ts +4 -14
  154. package/dist/query/faceFinder.d.ts.map +1 -1
  155. package/dist/query/finderCore.d.ts +6 -0
  156. package/dist/query/finderCore.d.ts.map +1 -1
  157. package/dist/query/shapeFinders.d.ts +32 -0
  158. package/dist/query/shapeFinders.d.ts.map +1 -0
  159. package/dist/query/wireFinder.d.ts +4 -9
  160. package/dist/query/wireFinder.d.ts.map +1 -1
  161. package/dist/query.cjs +54 -32
  162. package/dist/query.js +56 -34
  163. package/dist/{result-fAX0OZzI.cjs → result-DJAAj1yb.cjs} +8 -59
  164. package/dist/{result-BaSD1fqR.js → result-DtuwWSUD.js} +38 -89
  165. package/dist/result.cjs +1 -1
  166. package/dist/result.js +22 -22
  167. package/dist/shapeFns-BJbua5kT.js +34 -0
  168. package/dist/shapeFns-w9tWELHX.cjs +33 -0
  169. package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-CAEAyk8j.js} +233 -172
  170. package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-owrg2MNK.cjs} +421 -360
  171. package/dist/sketching/Sketcher.d.ts.map +1 -1
  172. package/dist/sketching.cjs +2 -2
  173. package/dist/sketching.js +2 -2
  174. package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BLQ4I6Ig.cjs} +3 -3
  175. package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-BS-1220W.js} +3 -3
  176. package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dj6AjhOv.js} +7 -7
  177. package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-KU_7OD2q.cjs} +3 -3
  178. package/dist/topology/booleanFns.d.ts.map +1 -1
  179. package/dist/topology/compoundOpsFns.d.ts +3 -35
  180. package/dist/topology/compoundOpsFns.d.ts.map +1 -1
  181. package/dist/topology/index.d.ts +0 -1
  182. package/dist/topology/index.d.ts.map +1 -1
  183. package/dist/topology/metadataPropagation.d.ts +30 -0
  184. package/dist/topology/metadataPropagation.d.ts.map +1 -0
  185. package/dist/topology/modifierFns.d.ts.map +1 -1
  186. package/dist/topology/originTrackingFns.d.ts +23 -0
  187. package/dist/topology/originTrackingFns.d.ts.map +1 -0
  188. package/dist/topology/shapeFns.d.ts +6 -120
  189. package/dist/topology/shapeFns.d.ts.map +1 -1
  190. package/dist/topology/topologyQueryFns.d.ts +67 -0
  191. package/dist/topology/topologyQueryFns.d.ts.map +1 -0
  192. package/dist/topology/transformFns.d.ts +49 -0
  193. package/dist/topology/transformFns.d.ts.map +1 -0
  194. package/dist/topology/wrapperFns.d.ts.map +1 -1
  195. package/dist/{topology-ANwCzGL8.cjs → topology-CyPHYYjV.cjs} +205 -20
  196. package/dist/{topology-C7x98OVn.js → topology-D6LeuhI_.js} +235 -50
  197. package/dist/topology.cjs +18 -17
  198. package/dist/topology.js +92 -91
  199. package/dist/topologyQueryFns-De439iBP.js +119 -0
  200. package/dist/topologyQueryFns-fz5kz5e1.cjs +118 -0
  201. package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
  202. package/dist/utils/precisionRound.d.ts +4 -0
  203. package/dist/utils/precisionRound.d.ts.map +1 -1
  204. package/dist/utils/vec2d.d.ts +5 -0
  205. package/dist/utils/vec2d.d.ts.map +1 -1
  206. package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
  207. package/dist/{vectors-D_IiZx0q.cjs → vectors-C8N_QeEX.cjs} +9 -1
  208. package/dist/{vectors-Bx8wkNui.js → vectors-DTREgnVp.js} +15 -7
  209. package/dist/vectors.cjs +1 -1
  210. package/dist/vectors.js +23 -23
  211. package/package.json +3 -3
  212. package/dist/core/geometryHelpers.d.ts +0 -30
  213. package/dist/core/geometryHelpers.d.ts.map +0 -1
  214. package/dist/core/memory.d.ts +0 -6
  215. package/dist/core/memory.d.ts.map +0 -1
  216. package/dist/core/typeErrors.d.ts +0 -17
  217. package/dist/core/typeErrors.d.ts.map +0 -1
  218. package/dist/cornerFinder-Ckz-mPHE.js +0 -59
  219. package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
  220. package/dist/shapeFns-C2SnNvdH.cjs +0 -468
  221. package/dist/shapeFns-FDuKkrDR.js +0 -469
  222. package/dist/utils/round2.d.ts +0 -3
  223. package/dist/utils/round2.d.ts.map +0 -1
  224. package/dist/utils/round5.d.ts +0 -3
  225. package/dist/utils/round5.d.ts.map +0 -1
@@ -1,10 +1,10 @@
1
- import { B as getKernel, d as createKernelHandle, c as castShape, p as isShape3D, u as isWire, F as createSolid } from "./shapeTypes-CpSaBLDv.js";
2
- import { g as vecLength, v as vecAdd, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
3
- import { e as err, z as validationError, v as unwrap, r as typeCastError, o as ok, A as BrepErrorCode, k as kernelError, i as ioError, d as computationError } from "./result-BaSD1fqR.js";
4
- import { a as buildLawFromProfile } from "./loft-Bhw-FMoL.js";
5
- import { j as fuseAll } from "./booleanFns-BCTjYZAg.js";
6
- import { t as toBREP } from "./shapeFns-FDuKkrDR.js";
7
- import { j as fromBREP } from "./faceFns-B8GnxjdY.js";
1
+ import { e as err, v as validationError, u as unwrap, t as typeCastError, o as ok, k as kernelError, B as BrepErrorCode, i as ioError, d as computationError } from "./result-DtuwWSUD.js";
2
+ import { v as vecLength, a as vecAdd, i as vecIsZero, c as vecNormalize } from "./vecOps-LTN--A58.js";
3
+ import { g as fuseAll } from "./booleanFns-Br2KdGJq.js";
4
+ import { g as getKernel, w as createKernelHandle, c as castShape, j as isShape3D, b as isWire } from "./shapeTypes-CAEAyk8j.js";
5
+ import { t as toBREP } from "./shapeFns-BJbua5kT.js";
6
+ import { j as fromBREP } from "./faceFns-DGMp47Os.js";
7
+ import { a as buildLawFromProfile } from "./loft-D0aCZRaB.js";
8
8
  function uuidv() {
9
9
  return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
10
10
  /[018]/g,
@@ -41,42 +41,6 @@ function makeHelixWire(pitch, height, radius, center, dir, _lefthand = false) {
41
41
  const kernel = getKernel();
42
42
  return castShape(kernel.makeHelixWire(pitch, height, radius, [...center], [...dir]));
43
43
  }
44
- function extrude(face, extrusionVec) {
45
- if (getKernel().isNull(face.wrapped)) {
46
- return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "extrude: face is a null shape"));
47
- }
48
- if (vecLength(extrusionVec) === 0) {
49
- return err(validationError("EXTRUDE_ZERO_VECTOR", "extrude: extrusion vector has zero length"));
50
- }
51
- try {
52
- const kernel = getKernel();
53
- const len = vecLength(extrusionVec);
54
- const dir = vecNormalize(extrusionVec);
55
- const shape = kernel.extrude(face.wrapped, [...dir], len);
56
- const downcastShape = kernel.downcast(shape, "solid");
57
- const solid = createSolid(downcastShape);
58
- return ok(solid);
59
- } catch (e) {
60
- return err(
61
- kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
62
- operation: "extrude",
63
- vectorLength: vecLength(extrusionVec)
64
- })
65
- );
66
- }
67
- }
68
- function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
69
- if (getKernel().isNull(face.wrapped)) {
70
- return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
71
- }
72
- const kernel = getKernel();
73
- const shape = kernel.revolveVec(face.wrapped, [...center], [...direction], angle);
74
- const result = castShape(shape);
75
- if (!isShape3D(result)) {
76
- return err(typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
77
- }
78
- return ok(result);
79
- }
80
44
  function sweep(wire, spine, config = {}, shellMode = false) {
81
45
  if (config.mode === "simple" && !shellMode) {
82
46
  const kernel2 = getKernel();
@@ -173,6 +137,95 @@ function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMod
173
137
  const law = profileShape ? unwrap(buildLawFromProfile(extrusionLength, profileShape)) : null;
174
138
  return sweep(wire, spine, { auxiliarySpine, law }, shellMode);
175
139
  }
140
+ function multiSectionSweep(sections, spine, options) {
141
+ if (sections.length < 2) {
142
+ return err(
143
+ validationError(
144
+ BrepErrorCode.MULTI_SWEEP_INSUFFICIENT_SECTIONS,
145
+ `Multi-section sweep requires at least 2 sections, got ${sections.length}`
146
+ )
147
+ );
148
+ }
149
+ const { solid = true, ruled = false, tolerance = 1e-6 } = options ?? {};
150
+ const explicitLocations = sections.map((s) => s.location);
151
+ for (let i = 0; i < explicitLocations.length; i++) {
152
+ const loc = explicitLocations[i];
153
+ if (loc !== void 0 && (loc < 0 || loc > 1)) {
154
+ return err(
155
+ validationError(
156
+ BrepErrorCode.MULTI_SWEEP_FAILED,
157
+ `Section ${i} location ${loc} is out of range [0, 1]`
158
+ )
159
+ );
160
+ }
161
+ }
162
+ const definedLocs = explicitLocations.filter((l) => l !== void 0);
163
+ for (let i = 1; i < definedLocs.length; i++) {
164
+ if ((definedLocs[i] ?? 0) <= (definedLocs[i - 1] ?? 0)) {
165
+ return err(
166
+ validationError(
167
+ BrepErrorCode.MULTI_SWEEP_FAILED,
168
+ "Section locations must be strictly increasing"
169
+ )
170
+ );
171
+ }
172
+ }
173
+ try {
174
+ const kernel = getKernel();
175
+ const [uFirst, uLast] = kernel.curveParameters(spine.wrapped);
176
+ const uRange = uLast - uFirst;
177
+ const params = sections.map((s, i) => {
178
+ if (s.location !== void 0) {
179
+ return uFirst + s.location * uRange;
180
+ }
181
+ return uFirst + i / (sections.length - 1) * uRange;
182
+ });
183
+ const positionedWires = [];
184
+ for (let i = 0; i < sections.length; i++) {
185
+ const param = params[i];
186
+ const section = sections[i];
187
+ if (param === void 0 || section === void 0) continue;
188
+ const positioned = kernel.positionOnCurve(section.wire.wrapped, spine.wrapped, param);
189
+ positionedWires.push(kernel.downcast(positioned, "wire"));
190
+ }
191
+ const loftResult = kernel.loftAdvanced(positionedWires, { solid, ruled, tolerance });
192
+ const result = castShape(loftResult);
193
+ if (!isShape3D(result)) {
194
+ return err(
195
+ typeCastError("MULTI_SWEEP_NOT_3D", "Multi-section sweep did not produce a 3D shape")
196
+ );
197
+ }
198
+ return ok(result);
199
+ } catch (e) {
200
+ const raw = e instanceof Error ? e.message : String(e);
201
+ return err(
202
+ kernelError(BrepErrorCode.MULTI_SWEEP_FAILED, `Multi-section sweep failed: ${raw}`, e)
203
+ );
204
+ }
205
+ }
206
+ function guidedSweep(profile, spine, guides, options = {}) {
207
+ const { transition = "transformed", solid = true, tolerance } = options;
208
+ try {
209
+ const kernel = getKernel();
210
+ const shellMode = !solid;
211
+ const auxiliary = guides.length > 0 ? guides[0]?.wrapped : void 0;
212
+ const sweepResult = kernel.sweepPipeShell(profile.wrapped, spine.wrapped, {
213
+ transitionMode: transition,
214
+ ...auxiliary ? { auxiliary } : {},
215
+ shellMode,
216
+ ...tolerance !== void 0 ? { tolerance, boundTolerance: tolerance } : {}
217
+ });
218
+ const ocShape = typeof sweepResult === "object" && "shape" in sweepResult ? sweepResult.shape : sweepResult;
219
+ const result = castShape(ocShape);
220
+ if (!isShape3D(result)) {
221
+ return err(typeCastError("GUIDED_SWEEP_NOT_3D", "Guided sweep did not produce a 3D shape"));
222
+ }
223
+ return ok(result);
224
+ } catch (e) {
225
+ const raw = e instanceof Error ? e.message : String(e);
226
+ return err(kernelError(BrepErrorCode.GUIDED_SWEEP_FAILED, `Guided sweep failed: ${raw}`, e));
227
+ }
228
+ }
176
229
  function exportAssemblySTEP(shapes = [], { unit, modelUnit } = {}) {
177
230
  const parseHex = (hex) => {
178
231
  let h = hex;
@@ -541,22 +594,22 @@ export {
541
594
  addStep as b,
542
595
  circularPattern as c,
543
596
  collectShapes as d,
544
- extrude as e,
545
- complexExtrude as f,
546
- countNodes as g,
547
- createAssembly as h,
548
- createAssemblyNode as i,
549
- createHistory as j,
550
- createRegistry as k,
597
+ complexExtrude as e,
598
+ countNodes as f,
599
+ createAssembly as g,
600
+ createAssemblyNode as h,
601
+ createHistory as i,
602
+ createRegistry as j,
603
+ deserializeHistory as k,
551
604
  linearPattern as l,
552
- deserializeHistory as m,
553
- exportAssemblySTEP as n,
554
- findNode as o,
555
- findStep as p,
556
- getShape as q,
557
- revolve as r,
605
+ exportAssemblySTEP as m,
606
+ findNode as n,
607
+ findStep as o,
608
+ getShape as p,
609
+ guidedSweep as q,
610
+ modifyStep as r,
558
611
  sweep as s,
559
- modifyStep as t,
612
+ multiSectionSweep as t,
560
613
  registerOperation as u,
561
614
  registerShape as v,
562
615
  walkAssembly as w,
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
2
+ const result = require("./result-DJAAj1yb.cjs");
3
3
  const vecOps = require("./vecOps-CjRL1jau.cjs");
4
- const result = require("./result-fAX0OZzI.cjs");
5
- const loft = require("./loft-hp3pc1M7.cjs");
6
- const booleanFns = require("./booleanFns-gmsX3Cv2.cjs");
7
- const shapeFns = require("./shapeFns-C2SnNvdH.cjs");
8
- const faceFns = require("./faceFns-DB1Fc5gy.cjs");
4
+ const booleanFns = require("./booleanFns-BBd2oTvv.cjs");
5
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
6
+ const shapeFns = require("./shapeFns-w9tWELHX.cjs");
7
+ const faceFns = require("./faceFns-BAKkZG6D.cjs");
8
+ const loft = require("./loft-BNvBZzqe.cjs");
9
9
  function uuidv() {
10
10
  return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
11
11
  /[018]/g,
@@ -42,42 +42,6 @@ function makeHelixWire(pitch, height, radius, center, dir, _lefthand = false) {
42
42
  const kernel = shapeTypes.getKernel();
43
43
  return shapeTypes.castShape(kernel.makeHelixWire(pitch, height, radius, [...center], [...dir]));
44
44
  }
45
- function extrude(face, extrusionVec) {
46
- if (shapeTypes.getKernel().isNull(face.wrapped)) {
47
- return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "extrude: face is a null shape"));
48
- }
49
- if (vecOps.vecLength(extrusionVec) === 0) {
50
- return result.err(result.validationError("EXTRUDE_ZERO_VECTOR", "extrude: extrusion vector has zero length"));
51
- }
52
- try {
53
- const kernel = shapeTypes.getKernel();
54
- const len = vecOps.vecLength(extrusionVec);
55
- const dir = vecOps.vecNormalize(extrusionVec);
56
- const shape = kernel.extrude(face.wrapped, [...dir], len);
57
- const downcastShape = kernel.downcast(shape, "solid");
58
- const solid = shapeTypes.createSolid(downcastShape);
59
- return result.ok(solid);
60
- } catch (e) {
61
- return result.err(
62
- result.kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
63
- operation: "extrude",
64
- vectorLength: vecOps.vecLength(extrusionVec)
65
- })
66
- );
67
- }
68
- }
69
- function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
70
- if (shapeTypes.getKernel().isNull(face.wrapped)) {
71
- return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
72
- }
73
- const kernel = shapeTypes.getKernel();
74
- const shape = kernel.revolveVec(face.wrapped, [...center], [...direction], angle);
75
- const result$1 = shapeTypes.castShape(shape);
76
- if (!shapeTypes.isShape3D(result$1)) {
77
- return result.err(result.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
78
- }
79
- return result.ok(result$1);
80
- }
81
45
  function sweep(wire, spine, config = {}, shellMode = false) {
82
46
  if (config.mode === "simple" && !shellMode) {
83
47
  const kernel2 = shapeTypes.getKernel();
@@ -174,6 +138,95 @@ function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMod
174
138
  const law = profileShape ? result.unwrap(loft.buildLawFromProfile(extrusionLength, profileShape)) : null;
175
139
  return sweep(wire, spine, { auxiliarySpine, law }, shellMode);
176
140
  }
141
+ function multiSectionSweep(sections, spine, options) {
142
+ if (sections.length < 2) {
143
+ return result.err(
144
+ result.validationError(
145
+ result.BrepErrorCode.MULTI_SWEEP_INSUFFICIENT_SECTIONS,
146
+ `Multi-section sweep requires at least 2 sections, got ${sections.length}`
147
+ )
148
+ );
149
+ }
150
+ const { solid = true, ruled = false, tolerance = 1e-6 } = options ?? {};
151
+ const explicitLocations = sections.map((s) => s.location);
152
+ for (let i = 0; i < explicitLocations.length; i++) {
153
+ const loc = explicitLocations[i];
154
+ if (loc !== void 0 && (loc < 0 || loc > 1)) {
155
+ return result.err(
156
+ result.validationError(
157
+ result.BrepErrorCode.MULTI_SWEEP_FAILED,
158
+ `Section ${i} location ${loc} is out of range [0, 1]`
159
+ )
160
+ );
161
+ }
162
+ }
163
+ const definedLocs = explicitLocations.filter((l) => l !== void 0);
164
+ for (let i = 1; i < definedLocs.length; i++) {
165
+ if ((definedLocs[i] ?? 0) <= (definedLocs[i - 1] ?? 0)) {
166
+ return result.err(
167
+ result.validationError(
168
+ result.BrepErrorCode.MULTI_SWEEP_FAILED,
169
+ "Section locations must be strictly increasing"
170
+ )
171
+ );
172
+ }
173
+ }
174
+ try {
175
+ const kernel = shapeTypes.getKernel();
176
+ const [uFirst, uLast] = kernel.curveParameters(spine.wrapped);
177
+ const uRange = uLast - uFirst;
178
+ const params = sections.map((s, i) => {
179
+ if (s.location !== void 0) {
180
+ return uFirst + s.location * uRange;
181
+ }
182
+ return uFirst + i / (sections.length - 1) * uRange;
183
+ });
184
+ const positionedWires = [];
185
+ for (let i = 0; i < sections.length; i++) {
186
+ const param = params[i];
187
+ const section = sections[i];
188
+ if (param === void 0 || section === void 0) continue;
189
+ const positioned = kernel.positionOnCurve(section.wire.wrapped, spine.wrapped, param);
190
+ positionedWires.push(kernel.downcast(positioned, "wire"));
191
+ }
192
+ const loftResult = kernel.loftAdvanced(positionedWires, { solid, ruled, tolerance });
193
+ const result$1 = shapeTypes.castShape(loftResult);
194
+ if (!shapeTypes.isShape3D(result$1)) {
195
+ return result.err(
196
+ result.typeCastError("MULTI_SWEEP_NOT_3D", "Multi-section sweep did not produce a 3D shape")
197
+ );
198
+ }
199
+ return result.ok(result$1);
200
+ } catch (e) {
201
+ const raw = e instanceof Error ? e.message : String(e);
202
+ return result.err(
203
+ result.kernelError(result.BrepErrorCode.MULTI_SWEEP_FAILED, `Multi-section sweep failed: ${raw}`, e)
204
+ );
205
+ }
206
+ }
207
+ function guidedSweep(profile, spine, guides, options = {}) {
208
+ const { transition = "transformed", solid = true, tolerance } = options;
209
+ try {
210
+ const kernel = shapeTypes.getKernel();
211
+ const shellMode = !solid;
212
+ const auxiliary = guides.length > 0 ? guides[0]?.wrapped : void 0;
213
+ const sweepResult = kernel.sweepPipeShell(profile.wrapped, spine.wrapped, {
214
+ transitionMode: transition,
215
+ ...auxiliary ? { auxiliary } : {},
216
+ shellMode,
217
+ ...tolerance !== void 0 ? { tolerance, boundTolerance: tolerance } : {}
218
+ });
219
+ const ocShape = typeof sweepResult === "object" && "shape" in sweepResult ? sweepResult.shape : sweepResult;
220
+ const result$1 = shapeTypes.castShape(ocShape);
221
+ if (!shapeTypes.isShape3D(result$1)) {
222
+ return result.err(result.typeCastError("GUIDED_SWEEP_NOT_3D", "Guided sweep did not produce a 3D shape"));
223
+ }
224
+ return result.ok(result$1);
225
+ } catch (e) {
226
+ const raw = e instanceof Error ? e.message : String(e);
227
+ return result.err(result.kernelError(result.BrepErrorCode.GUIDED_SWEEP_FAILED, `Guided sweep failed: ${raw}`, e));
228
+ }
229
+ }
177
230
  function exportAssemblySTEP(shapes = [], { unit, modelUnit } = {}) {
178
231
  const parseHex = (hex) => {
179
232
  let h = hex;
@@ -541,19 +594,19 @@ exports.createHistory = createHistory;
541
594
  exports.createRegistry = createRegistry;
542
595
  exports.deserializeHistory = deserializeHistory;
543
596
  exports.exportAssemblySTEP = exportAssemblySTEP;
544
- exports.extrude = extrude;
545
597
  exports.findNode = findNode;
546
598
  exports.findStep = findStep;
547
599
  exports.getShape = getShape;
548
600
  exports.gridPattern = gridPattern;
601
+ exports.guidedSweep = guidedSweep;
549
602
  exports.linearPattern = linearPattern;
550
603
  exports.modifyStep = modifyStep;
604
+ exports.multiSectionSweep = multiSectionSweep;
551
605
  exports.registerOperation = registerOperation;
552
606
  exports.registerShape = registerShape;
553
607
  exports.removeChild = removeChild;
554
608
  exports.replayFrom = replayFrom;
555
609
  exports.replayHistory = replayHistory;
556
- exports.revolve = revolve;
557
610
  exports.serializeHistory = serializeHistory;
558
611
  exports.stepCount = stepCount;
559
612
  exports.stepsFrom = stepsFrom;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const operations = require("./operations-CYpmLSC4.cjs");
4
- const loft = require("./loft-hp3pc1M7.cjs");
3
+ const operations = require("./operations-DwZ-RBO1.cjs");
4
+ const loft = require("./loft-BNvBZzqe.cjs");
5
5
  exports.addChild = operations.addChild;
6
6
  exports.addStep = operations.addStep;
7
7
  exports.circularPattern = operations.circularPattern;
@@ -1,32 +1,32 @@
1
- import { a, b, c, d, f, g, h, i, j, k, n, o, p, q, H, l, t, u, v, x, y, z, B, C, D, s, E, F, G, w } from "./operations-BfbkK6DU.js";
2
- import { b as b2, g as g2, l as l2, r } from "./loft-Bhw-FMoL.js";
1
+ import { a, b, c, d, e, f, g, h, i, j, m, n, o, p, H, l, r, u, v, x, y, z, B, C, D, s, E, F, G, w } from "./operations-DisJ5F8s.js";
2
+ import { b as b2, g as g2, l as l2, r as r2 } from "./loft-D0aCZRaB.js";
3
3
  export {
4
4
  a as addChild,
5
5
  b as addStep,
6
6
  b2 as basicFaceExtrusion,
7
7
  c as circularPattern,
8
8
  d as collectShapes,
9
- f as complexExtrude,
10
- g as countNodes,
11
- h as createAssembly,
12
- i as createAssemblyNode,
13
- j as createHistory,
14
- k as createRegistry,
15
- n as exportAssemblySTEP,
16
- o as findNode,
17
- p as findStep,
9
+ e as complexExtrude,
10
+ f as countNodes,
11
+ g as createAssembly,
12
+ h as createAssemblyNode,
13
+ i as createHistory,
14
+ j as createRegistry,
15
+ m as exportAssemblySTEP,
16
+ n as findNode,
17
+ o as findStep,
18
18
  g2 as genericSweep,
19
- q as getHistoryShape,
19
+ p as getHistoryShape,
20
20
  H as gridPattern,
21
21
  l as linearPattern,
22
22
  l2 as loft,
23
- t as modifyStep,
23
+ r as modifyStep,
24
24
  u as registerOperation,
25
25
  v as registerShape,
26
26
  x as removeChild,
27
27
  y as replayFrom,
28
28
  z as replayHistory,
29
- r as revolution,
29
+ r2 as revolution,
30
30
  B as stepCount,
31
31
  C as stepsFrom,
32
32
  D as supportExtrude,
@@ -0,0 +1,137 @@
1
+ import { g as getKernel } from "./shapeTypes-CAEAyk8j.js";
2
+ import { H as HASH_CODE_MAX } from "./vecOps-LTN--A58.js";
3
+ import { g as getCacheEntry, a as getOrCreateCache, b as getFaces } from "./topologyQueryFns-De439iBP.js";
4
+ function setShapeOrigin(shape, origin) {
5
+ const cache = getOrCreateCache(shape);
6
+ const map = /* @__PURE__ */ new Map();
7
+ for (const f of getFaces(shape)) {
8
+ map.set(getKernel().hashCode(f.wrapped, HASH_CODE_MAX), origin);
9
+ }
10
+ cache.faceOrigins = map;
11
+ }
12
+ function getFaceOrigins(shape) {
13
+ return getCacheEntry(shape)?.faceOrigins;
14
+ }
15
+ function propagateOriginsFromEvolution(evolution, inputs, result) {
16
+ const inputOrigins = /* @__PURE__ */ new Map();
17
+ for (const input of inputs) {
18
+ const origins = getFaceOrigins(input);
19
+ if (!origins) continue;
20
+ for (const [hash, origin] of origins) {
21
+ inputOrigins.set(hash, origin);
22
+ }
23
+ }
24
+ if (inputOrigins.size === 0) return;
25
+ const resultMap = /* @__PURE__ */ new Map();
26
+ for (const [hash, origin] of inputOrigins) {
27
+ if (evolution.deleted.has(hash)) continue;
28
+ const modifiedHashes = evolution.modified.get(hash);
29
+ if (modifiedHashes && modifiedHashes.length > 0) {
30
+ for (const modHash of modifiedHashes) {
31
+ resultMap.set(modHash, origin);
32
+ }
33
+ } else {
34
+ resultMap.set(hash, origin);
35
+ }
36
+ const generatedHashes = evolution.generated.get(hash);
37
+ if (generatedHashes) {
38
+ for (const genHash of generatedHashes) {
39
+ if (!resultMap.has(genHash)) {
40
+ resultMap.set(genHash, 0);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ if (resultMap.size > 0) {
46
+ const cache = getOrCreateCache(result);
47
+ cache.faceOrigins = resultMap;
48
+ }
49
+ }
50
+ function propagateOriginsByHash(inputs, result) {
51
+ const lookup = /* @__PURE__ */ new Map();
52
+ for (const input of inputs) {
53
+ const origins = getFaceOrigins(input);
54
+ if (!origins) continue;
55
+ for (const [hash, origin] of origins) {
56
+ lookup.set(hash, origin);
57
+ }
58
+ }
59
+ if (lookup.size === 0) return;
60
+ const kernel = getKernel();
61
+ const resultMap = /* @__PURE__ */ new Map();
62
+ const resultFaces = getFaces(result);
63
+ for (const f of resultFaces) {
64
+ const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
65
+ const origin = lookup.get(hash);
66
+ if (origin !== void 0) {
67
+ resultMap.set(hash, origin);
68
+ }
69
+ }
70
+ if (resultMap.size === 0) {
71
+ const inputSigs = [];
72
+ for (const input of inputs) {
73
+ const origins = getFaceOrigins(input);
74
+ if (!origins) continue;
75
+ for (const f of getFaces(input)) {
76
+ const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
77
+ const origin = origins.get(hash);
78
+ if (origin === void 0) continue;
79
+ try {
80
+ const bounds = kernel.uvBounds(f.wrapped);
81
+ const normal = kernel.surfaceNormal(
82
+ f.wrapped,
83
+ 0.5 * (bounds.uMin + bounds.uMax),
84
+ 0.5 * (bounds.vMin + bounds.vMax)
85
+ );
86
+ const centroid = kernel.surfaceCenterOfMass(f.wrapped);
87
+ inputSigs.push({ origin, normal, centroid });
88
+ } catch {
89
+ }
90
+ }
91
+ }
92
+ if (inputSigs.length > 0) {
93
+ for (const f of resultFaces) {
94
+ const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
95
+ try {
96
+ const outBounds = kernel.uvBounds(f.wrapped);
97
+ const outNormal = kernel.surfaceNormal(
98
+ f.wrapped,
99
+ 0.5 * (outBounds.uMin + outBounds.uMax),
100
+ 0.5 * (outBounds.vMin + outBounds.vMax)
101
+ );
102
+ const outCentroid = kernel.surfaceCenterOfMass(f.wrapped);
103
+ let bestScore = -Infinity;
104
+ let bestOrigin;
105
+ for (const inp of inputSigs) {
106
+ const dot = outNormal[0] * inp.normal[0] + outNormal[1] * inp.normal[1] + outNormal[2] * inp.normal[2];
107
+ if (dot < 0.707) continue;
108
+ const dx = outCentroid[0] - inp.centroid[0];
109
+ const dy = outCentroid[1] - inp.centroid[1];
110
+ const dz = outCentroid[2] - inp.centroid[2];
111
+ const distSq = dx * dx + dy * dy + dz * dz;
112
+ if (distSq > 100) continue;
113
+ const score = dot - distSq / 100;
114
+ if (score > bestScore) {
115
+ bestScore = score;
116
+ bestOrigin = inp.origin;
117
+ }
118
+ }
119
+ if (bestOrigin !== void 0) {
120
+ resultMap.set(hash, bestOrigin);
121
+ }
122
+ } catch {
123
+ }
124
+ }
125
+ }
126
+ }
127
+ if (resultMap.size > 0) {
128
+ const cache = getOrCreateCache(result);
129
+ cache.faceOrigins = resultMap;
130
+ }
131
+ }
132
+ export {
133
+ propagateOriginsFromEvolution as a,
134
+ getFaceOrigins as g,
135
+ propagateOriginsByHash as p,
136
+ setShapeOrigin as s
137
+ };