@faicad/faijs 0.33.2 → 0.35.2

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 (392) hide show
  1. package/dist/api/api-namespace.d.ts +14 -14
  2. package/dist/api/api-namespace.d.ts.map +1 -1
  3. package/dist/api/api-namespace.js +40 -14
  4. package/dist/api/api-namespace.js.map +1 -1
  5. package/dist/api/appearance.d.ts +47 -6
  6. package/dist/api/appearance.d.ts.map +1 -1
  7. package/dist/api/appearance.js.map +1 -1
  8. package/dist/api/assembly/solve-tree.d.ts +1 -0
  9. package/dist/api/assembly/solve-tree.d.ts.map +1 -1
  10. package/dist/api/assembly/solve-tree.js +42 -17
  11. package/dist/api/assembly/solve-tree.js.map +1 -1
  12. package/dist/api/assembly/solve.d.ts +1 -0
  13. package/dist/api/assembly/solve.d.ts.map +1 -1
  14. package/dist/api/assembly/solve.js.map +1 -1
  15. package/dist/api/assembly/solvers/global-solver.d.ts.map +1 -1
  16. package/dist/api/assembly/solvers/global-solver.js +130 -23
  17. package/dist/api/assembly/solvers/global-solver.js.map +1 -1
  18. package/dist/api/assembly/solvers/pose-from-delta.d.ts +9 -0
  19. package/dist/api/assembly/solvers/pose-from-delta.d.ts.map +1 -1
  20. package/dist/api/assembly/solvers/pose-from-delta.js +23 -0
  21. package/dist/api/assembly/solvers/pose-from-delta.js.map +1 -1
  22. package/dist/api/assembly/solvers/types.d.ts +20 -2
  23. package/dist/api/assembly/solvers/types.d.ts.map +1 -1
  24. package/dist/api/assembly/solvers/types.js.map +1 -1
  25. package/dist/api/chamfer.d.ts +7 -4
  26. package/dist/api/chamfer.d.ts.map +1 -1
  27. package/dist/api/chamfer.js +57 -13
  28. package/dist/api/chamfer.js.map +1 -1
  29. package/dist/api/draft.d.ts +7 -4
  30. package/dist/api/draft.d.ts.map +1 -1
  31. package/dist/api/draft.js +11 -6
  32. package/dist/api/draft.js.map +1 -1
  33. package/dist/api/edge-ref.d.ts +4 -4
  34. package/dist/api/edge-ref.js +4 -4
  35. package/dist/api/edge-ref.js.map +1 -1
  36. package/dist/api/extrude.d.ts +10 -6
  37. package/dist/api/extrude.d.ts.map +1 -1
  38. package/dist/api/extrude.js +50 -25
  39. package/dist/api/extrude.js.map +1 -1
  40. package/dist/api/face-ref.d.ts +4 -4
  41. package/dist/api/face-ref.js +4 -4
  42. package/dist/api/face-ref.js.map +1 -1
  43. package/dist/api/feature-repair.d.ts +6 -3
  44. package/dist/api/feature-repair.d.ts.map +1 -1
  45. package/dist/api/feature-repair.js +12 -7
  46. package/dist/api/feature-repair.js.map +1 -1
  47. package/dist/api/fillet-variable.d.ts +6 -2
  48. package/dist/api/fillet-variable.d.ts.map +1 -1
  49. package/dist/api/fillet-variable.js +24 -6
  50. package/dist/api/fillet-variable.js.map +1 -1
  51. package/dist/api/fillet.d.ts +7 -4
  52. package/dist/api/fillet.d.ts.map +1 -1
  53. package/dist/api/fillet.js +45 -12
  54. package/dist/api/fillet.js.map +1 -1
  55. package/dist/api/helix.d.ts +13 -13
  56. package/dist/api/helix.d.ts.map +1 -1
  57. package/dist/api/helix.js +19 -24
  58. package/dist/api/helix.js.map +1 -1
  59. package/dist/api/import-brep.d.ts +10 -18
  60. package/dist/api/import-brep.d.ts.map +1 -1
  61. package/dist/api/import-brep.js +17 -25
  62. package/dist/api/import-brep.js.map +1 -1
  63. package/dist/api/import-step.d.ts +10 -15
  64. package/dist/api/import-step.d.ts.map +1 -1
  65. package/dist/api/import-step.js +24 -29
  66. package/dist/api/import-step.js.map +1 -1
  67. package/dist/api/index.js +2 -2
  68. package/dist/api/index.js.map +1 -1
  69. package/dist/api/internal/export-members.js.map +1 -1
  70. package/dist/api/loft-advanced.d.ts +4 -0
  71. package/dist/api/loft-advanced.d.ts.map +1 -1
  72. package/dist/api/loft-advanced.js +4 -0
  73. package/dist/api/loft-advanced.js.map +1 -1
  74. package/dist/api/loft.d.ts +5 -3
  75. package/dist/api/loft.d.ts.map +1 -1
  76. package/dist/api/loft.js +5 -3
  77. package/dist/api/loft.js.map +1 -1
  78. package/dist/api/meta.d.ts +42 -6
  79. package/dist/api/meta.d.ts.map +1 -1
  80. package/dist/api/meta.js.map +1 -1
  81. package/dist/api/punch-hole.d.ts +5 -2
  82. package/dist/api/punch-hole.d.ts.map +1 -1
  83. package/dist/api/punch-hole.js +4 -1
  84. package/dist/api/punch-hole.js.map +1 -1
  85. package/dist/api/replicate.d.ts +4 -5
  86. package/dist/api/replicate.d.ts.map +1 -1
  87. package/dist/api/replicate.js +4 -5
  88. package/dist/api/replicate.js.map +1 -1
  89. package/dist/api/selectors-to-refs.d.ts +83 -0
  90. package/dist/api/selectors-to-refs.d.ts.map +1 -0
  91. package/dist/api/selectors-to-refs.js +211 -0
  92. package/dist/api/selectors-to-refs.js.map +1 -0
  93. package/dist/api/shell.d.ts +17 -8
  94. package/dist/api/shell.d.ts.map +1 -1
  95. package/dist/api/shell.js +45 -15
  96. package/dist/api/shell.js.map +1 -1
  97. package/dist/api/sketch-on-face.d.ts +12 -6
  98. package/dist/api/sketch-on-face.d.ts.map +1 -1
  99. package/dist/api/sketch-on-face.js +31 -4
  100. package/dist/api/sketch-on-face.js.map +1 -1
  101. package/dist/api/sketch-on-plane.d.ts +3 -0
  102. package/dist/api/sketch-on-plane.d.ts.map +1 -1
  103. package/dist/api/sketch-on-plane.js +3 -0
  104. package/dist/api/sketch-on-plane.js.map +1 -1
  105. package/dist/api/sketch-on-surface.d.ts +4 -1
  106. package/dist/api/sketch-on-surface.d.ts.map +1 -1
  107. package/dist/api/sketch-on-surface.js +4 -1
  108. package/dist/api/sketch-on-surface.js.map +1 -1
  109. package/dist/api/view/view-projection.d.ts.map +1 -1
  110. package/dist/api/view/view-projection.js +9 -2
  111. package/dist/api/view/view-projection.js.map +1 -1
  112. package/dist/brep/brep-chain.js +2 -2
  113. package/dist/brep/brep-chain.js.map +1 -1
  114. package/dist/brep/brep-ops.d.ts +1 -1
  115. package/dist/brep/brep-ops.js +1 -1
  116. package/dist/brep/brep-ops.js.map +1 -1
  117. package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
  118. package/dist/brep/engine/adapters/brep-mock.js +45 -0
  119. package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
  120. package/dist/brep/engine/primitives.d.ts +87 -3
  121. package/dist/brep/engine/primitives.d.ts.map +1 -1
  122. package/dist/brep/engine/primitives.js +1 -1
  123. package/dist/brep/engine/primitives.js.map +1 -1
  124. package/dist/brep/engine/registry.d.ts +33 -7
  125. package/dist/brep/engine/registry.d.ts.map +1 -1
  126. package/dist/brep/engine/registry.js +47 -16
  127. package/dist/brep/engine/registry.js.map +1 -1
  128. package/dist/brep/handle-bridge.d.ts +14 -15
  129. package/dist/brep/handle-bridge.d.ts.map +1 -1
  130. package/dist/brep/handle-bridge.js +35 -15
  131. package/dist/brep/handle-bridge.js.map +1 -1
  132. package/dist/brep/primitives-brep.js +2 -2
  133. package/dist/brep/primitives-brep.js.map +1 -1
  134. package/dist/brep/text/text-to-solid.d.ts +40 -3
  135. package/dist/brep/text/text-to-solid.d.ts.map +1 -1
  136. package/dist/brep/text/text-to-solid.js +104 -24
  137. package/dist/brep/text/text-to-solid.js.map +1 -1
  138. package/dist/brepkit-kernel/brepkitKernel.d.ts +2 -2
  139. package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
  140. package/dist/brepkit-kernel/brepkitKernel.js +315 -36
  141. package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
  142. package/dist/brepkit-kernel/brepkitWasm.js +7 -7
  143. package/dist/brepkit-kernel/brepkitWasm.js.map +1 -1
  144. package/dist/brepkit-kernel/multi-version-test.d.ts +2 -2
  145. package/dist/brepkit-kernel/multi-version-test.d.ts.map +1 -1
  146. package/dist/brepkit-kernel/multi-version-test.js +6 -6
  147. package/dist/brepkit-kernel/multi-version-test.js.map +1 -1
  148. package/dist/browser.d.ts +2 -3
  149. package/dist/browser.d.ts.map +1 -1
  150. package/dist/browser.js +1 -2
  151. package/dist/browser.js.map +1 -1
  152. package/dist/cad-runtime/admit-compat-lib.d.ts +9 -1
  153. package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
  154. package/dist/cad-runtime/admit-compat-lib.js +11 -1
  155. package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
  156. package/dist/cad-runtime/browser-lib-loader.d.ts +16 -11
  157. package/dist/cad-runtime/browser-lib-loader.d.ts.map +1 -1
  158. package/dist/cad-runtime/browser-lib-loader.js +16 -8
  159. package/dist/cad-runtime/browser-lib-loader.js.map +1 -1
  160. package/dist/cad-runtime/direct-executor.d.ts +62 -5
  161. package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
  162. package/dist/cad-runtime/direct-executor.js +617 -42
  163. package/dist/cad-runtime/direct-executor.js.map +1 -1
  164. package/dist/cad-runtime/interp/closure.d.ts +3 -2
  165. package/dist/cad-runtime/interp/closure.d.ts.map +1 -1
  166. package/dist/cad-runtime/interp/closure.js.map +1 -1
  167. package/dist/cad-runtime/interp/env.d.ts +9 -6
  168. package/dist/cad-runtime/interp/env.d.ts.map +1 -1
  169. package/dist/cad-runtime/interp/env.js +4 -2
  170. package/dist/cad-runtime/interp/env.js.map +1 -1
  171. package/dist/cad-runtime/lib-decl.d.ts +121 -0
  172. package/dist/cad-runtime/lib-decl.d.ts.map +1 -0
  173. package/dist/cad-runtime/lib-decl.js +100 -0
  174. package/dist/cad-runtime/lib-decl.js.map +1 -0
  175. package/dist/cad-runtime/ports.d.ts +12 -0
  176. package/dist/cad-runtime/ports.d.ts.map +1 -1
  177. package/dist/cad-runtime/ports.js.map +1 -1
  178. package/dist/cad-runtime/runtime.d.ts +59 -5
  179. package/dist/cad-runtime/runtime.d.ts.map +1 -1
  180. package/dist/cad-runtime/runtime.js +237 -18
  181. package/dist/cad-runtime/runtime.js.map +1 -1
  182. package/dist/extra/browser.d.ts +9 -0
  183. package/dist/extra/browser.d.ts.map +1 -0
  184. package/dist/extra/browser.js +9 -0
  185. package/dist/extra/browser.js.map +1 -0
  186. package/dist/extra/editor-ops.d.ts +22 -0
  187. package/dist/extra/editor-ops.d.ts.map +1 -0
  188. package/dist/extra/editor-ops.js +21 -0
  189. package/dist/extra/editor-ops.js.map +1 -0
  190. package/dist/extra/extras/svg-extrude.d.ts +45 -0
  191. package/dist/extra/extras/svg-extrude.d.ts.map +1 -0
  192. package/dist/extra/extras/svg-extrude.js +110 -0
  193. package/dist/extra/extras/svg-extrude.js.map +1 -0
  194. package/dist/extra/extras/text-cjk.d.ts +36 -0
  195. package/dist/extra/extras/text-cjk.d.ts.map +1 -0
  196. package/dist/extra/extras/text-cjk.js +86 -0
  197. package/dist/extra/extras/text-cjk.js.map +1 -0
  198. package/dist/extra/extras/text-geometry.d.ts +69 -0
  199. package/dist/extra/extras/text-geometry.d.ts.map +1 -0
  200. package/dist/extra/extras/text-geometry.js +188 -0
  201. package/dist/extra/extras/text-geometry.js.map +1 -0
  202. package/dist/extra/index.d.ts +40 -0
  203. package/dist/extra/index.d.ts.map +1 -0
  204. package/dist/extra/index.js +40 -0
  205. package/dist/extra/index.js.map +1 -0
  206. package/dist/extra/mesh/drill-hole/DrillHoleCore.d.ts +94 -0
  207. package/dist/extra/mesh/drill-hole/DrillHoleCore.d.ts.map +1 -0
  208. package/dist/extra/mesh/drill-hole/DrillHoleCore.js +282 -0
  209. package/dist/extra/mesh/drill-hole/DrillHoleCore.js.map +1 -0
  210. package/dist/extra/mesh/drill-hole/drill-types.d.ts +34 -0
  211. package/dist/extra/mesh/drill-hole/drill-types.d.ts.map +1 -0
  212. package/dist/extra/mesh/drill-hole/drill-types.js +7 -0
  213. package/dist/extra/mesh/drill-hole/drill-types.js.map +1 -0
  214. package/dist/extra/mesh/engrave-decoration.d.ts +42 -0
  215. package/dist/extra/mesh/engrave-decoration.d.ts.map +1 -0
  216. package/dist/extra/mesh/engrave-decoration.js +39 -0
  217. package/dist/extra/mesh/engrave-decoration.js.map +1 -0
  218. package/dist/extra/mesh/fai_drill.d.ts +21 -0
  219. package/dist/extra/mesh/fai_drill.d.ts.map +1 -0
  220. package/dist/extra/mesh/fai_drill.js +89 -0
  221. package/dist/extra/mesh/fai_drill.js.map +1 -0
  222. package/dist/extra/mesh/fai_extrude.d.ts +24 -0
  223. package/dist/extra/mesh/fai_extrude.d.ts.map +1 -0
  224. package/dist/extra/mesh/fai_extrude.js +42 -0
  225. package/dist/extra/mesh/fai_extrude.js.map +1 -0
  226. package/dist/extra/mesh/fai_split.d.ts +164 -0
  227. package/dist/extra/mesh/fai_split.d.ts.map +1 -0
  228. package/dist/extra/mesh/fai_split.js +269 -0
  229. package/dist/extra/mesh/fai_split.js.map +1 -0
  230. package/dist/extra/mesh/primitives.d.ts +29 -0
  231. package/dist/extra/mesh/primitives.d.ts.map +1 -0
  232. package/dist/extra/mesh/primitives.js +41 -0
  233. package/dist/extra/mesh/primitives.js.map +1 -0
  234. package/dist/extra/op-names.d.ts +37 -0
  235. package/dist/extra/op-names.d.ts.map +1 -0
  236. package/dist/extra/op-names.js +46 -0
  237. package/dist/extra/op-names.js.map +1 -0
  238. package/dist/extra/ops/compound.d.ts +140 -0
  239. package/dist/extra/ops/compound.d.ts.map +1 -0
  240. package/dist/extra/ops/compound.js +167 -0
  241. package/dist/extra/ops/compound.js.map +1 -0
  242. package/dist/extra/ops/copy.d.ts +40 -0
  243. package/dist/extra/ops/copy.d.ts.map +1 -0
  244. package/dist/extra/ops/copy.js +83 -0
  245. package/dist/extra/ops/copy.js.map +1 -0
  246. package/dist/extra/ops/fai_drill.d.ts +51 -0
  247. package/dist/extra/ops/fai_drill.d.ts.map +1 -0
  248. package/dist/extra/ops/fai_drill.js +233 -0
  249. package/dist/extra/ops/fai_drill.js.map +1 -0
  250. package/dist/extra/ops/fai_extrude.d.ts +36 -0
  251. package/dist/extra/ops/fai_extrude.d.ts.map +1 -0
  252. package/dist/extra/ops/fai_extrude.js +84 -0
  253. package/dist/extra/ops/fai_extrude.js.map +1 -0
  254. package/dist/extra/ops/fai_split.d.ts +46 -0
  255. package/dist/extra/ops/fai_split.d.ts.map +1 -0
  256. package/dist/extra/ops/fai_split.js +235 -0
  257. package/dist/extra/ops/fai_split.js.map +1 -0
  258. package/dist/extra/ops/load.d.ts +49 -0
  259. package/dist/extra/ops/load.d.ts.map +1 -0
  260. package/dist/extra/ops/load.js +385 -0
  261. package/dist/extra/ops/load.js.map +1 -0
  262. package/dist/extra/ops/svg-extrude.d.ts +32 -0
  263. package/dist/extra/ops/svg-extrude.d.ts.map +1 -0
  264. package/dist/extra/ops/svg-extrude.js +74 -0
  265. package/dist/extra/ops/svg-extrude.js.map +1 -0
  266. package/dist/extra/ops/text.d.ts +34 -0
  267. package/dist/extra/ops/text.d.ts.map +1 -0
  268. package/dist/extra/ops/text.js +100 -0
  269. package/dist/extra/ops/text.js.map +1 -0
  270. package/dist/geometry2d/bridge/lift-on-plane.d.ts +8 -5
  271. package/dist/geometry2d/bridge/lift-on-plane.d.ts.map +1 -1
  272. package/dist/geometry2d/bridge/lift-on-plane.js +8 -5
  273. package/dist/geometry2d/bridge/lift-on-plane.js.map +1 -1
  274. package/dist/index.d.ts +6 -2
  275. package/dist/index.d.ts.map +1 -1
  276. package/dist/index.js +8 -2
  277. package/dist/index.js.map +1 -1
  278. package/dist/lang/symbol-table.d.ts +3 -3
  279. package/dist/lang/symbol-table.generated.d.ts +10 -0
  280. package/dist/lang/symbol-table.generated.d.ts.map +1 -1
  281. package/dist/lang/symbol-table.generated.js +10 -0
  282. package/dist/lang/symbol-table.generated.js.map +1 -1
  283. package/dist/lang/symbol-table.js +3 -3
  284. package/dist/lang/symbol-table.js.map +1 -1
  285. package/dist/math3d/index.d.ts +1 -1
  286. package/dist/math3d/index.js +1 -1
  287. package/dist/math3d/index.js.map +1 -1
  288. package/dist/mesh/engrave.d.ts +2 -3
  289. package/dist/mesh/engrave.d.ts.map +1 -1
  290. package/dist/mesh/engrave.js +4 -11
  291. package/dist/mesh/engrave.js.map +1 -1
  292. package/dist/mesh/index.d.ts +0 -2
  293. package/dist/mesh/index.d.ts.map +1 -1
  294. package/dist/mesh/index.js +0 -2
  295. package/dist/mesh/index.js.map +1 -1
  296. package/dist/mesh/primitives.d.ts +1 -1
  297. package/dist/mesh/primitives.js +1 -1
  298. package/dist/mesh/primitives.js.map +1 -1
  299. package/dist/node-host/cli.d.ts +11 -4
  300. package/dist/node-host/cli.d.ts.map +1 -1
  301. package/dist/node-host/cli.js +53 -28
  302. package/dist/node-host/cli.js.map +1 -1
  303. package/dist/node-host/execute-script.d.ts.map +1 -1
  304. package/dist/node-host/execute-script.js +3 -4
  305. package/dist/node-host/execute-script.js.map +1 -1
  306. package/dist/node-host/lib-package-json.d.ts +36 -0
  307. package/dist/node-host/lib-package-json.d.ts.map +1 -0
  308. package/dist/node-host/lib-package-json.js +73 -0
  309. package/dist/node-host/lib-package-json.js.map +1 -0
  310. package/dist/occt-kernel/occt-primitives.d.ts.map +1 -1
  311. package/dist/occt-kernel/occt-primitives.js +41 -0
  312. package/dist/occt-kernel/occt-primitives.js.map +1 -1
  313. package/dist/occt-kernel/occtKernel.d.ts +1 -1
  314. package/dist/occt-kernel/occtKernel.js +1 -1
  315. package/dist/occt-kernel/occtKernel.js.map +1 -1
  316. package/dist/runtime-state.d.ts +28 -1
  317. package/dist/runtime-state.d.ts.map +1 -1
  318. package/dist/runtime-state.js +14 -1
  319. package/dist/runtime-state.js.map +1 -1
  320. package/dist/sdk.d.ts +2 -2
  321. package/dist/sdk.d.ts.map +1 -1
  322. package/dist/sdk.js +11 -2
  323. package/dist/sdk.js.map +1 -1
  324. package/dist/sketch/bspline.d.ts +58 -0
  325. package/dist/sketch/bspline.d.ts.map +1 -0
  326. package/dist/sketch/bspline.js +104 -0
  327. package/dist/sketch/bspline.js.map +1 -0
  328. package/dist/sketch/canonical.d.ts +239 -0
  329. package/dist/sketch/canonical.d.ts.map +1 -0
  330. package/dist/sketch/canonical.js +17 -0
  331. package/dist/sketch/canonical.js.map +1 -0
  332. package/dist/sketch/contour.d.ts +43 -0
  333. package/dist/sketch/contour.d.ts.map +1 -0
  334. package/dist/sketch/contour.js +202 -0
  335. package/dist/sketch/contour.js.map +1 -0
  336. package/dist/sketch/dim-spec.d.ts +32 -0
  337. package/dist/sketch/dim-spec.d.ts.map +1 -0
  338. package/dist/sketch/dim-spec.js +112 -0
  339. package/dist/sketch/dim-spec.js.map +1 -0
  340. package/dist/sketch/faces.d.ts +45 -0
  341. package/dist/sketch/faces.d.ts.map +1 -0
  342. package/dist/sketch/faces.js +108 -0
  343. package/dist/sketch/faces.js.map +1 -0
  344. package/dist/sketch/fcstd-types.d.ts +194 -0
  345. package/dist/sketch/fcstd-types.d.ts.map +1 -0
  346. package/dist/sketch/fcstd-types.js +67 -0
  347. package/dist/sketch/fcstd-types.js.map +1 -0
  348. package/dist/sketch/index.d.ts +46 -0
  349. package/dist/sketch/index.d.ts.map +1 -0
  350. package/dist/sketch/index.js +39 -0
  351. package/dist/sketch/index.js.map +1 -0
  352. package/dist/sketch/node.d.ts +14 -0
  353. package/dist/sketch/node.d.ts.map +1 -0
  354. package/dist/sketch/node.js +43 -0
  355. package/dist/sketch/node.js.map +1 -0
  356. package/dist/sketch/op.d.ts +111 -0
  357. package/dist/sketch/op.d.ts.map +1 -0
  358. package/dist/sketch/op.js +185 -0
  359. package/dist/sketch/op.js.map +1 -0
  360. package/dist/sketch/planegcs-backend.d.ts +69 -0
  361. package/dist/sketch/planegcs-backend.d.ts.map +1 -0
  362. package/dist/sketch/planegcs-backend.js +812 -0
  363. package/dist/sketch/planegcs-backend.js.map +1 -0
  364. package/dist/sketch/project.d.ts +176 -0
  365. package/dist/sketch/project.d.ts.map +1 -0
  366. package/dist/sketch/project.js +656 -0
  367. package/dist/sketch/project.js.map +1 -0
  368. package/dist/sketch/shapes.d.ts +370 -0
  369. package/dist/sketch/shapes.d.ts.map +1 -0
  370. package/dist/sketch/shapes.js +959 -0
  371. package/dist/sketch/shapes.js.map +1 -0
  372. package/dist/sketch/solve.d.ts +21 -0
  373. package/dist/sketch/solve.d.ts.map +1 -0
  374. package/dist/sketch/solve.js +144 -0
  375. package/dist/sketch/solve.js.map +1 -0
  376. package/dist/sketch/solver-loader.d.ts +47 -0
  377. package/dist/sketch/solver-loader.d.ts.map +1 -0
  378. package/dist/sketch/solver-loader.js +77 -0
  379. package/dist/sketch/solver-loader.js.map +1 -0
  380. package/dist/sketch/solver.d.ts +63 -0
  381. package/dist/sketch/solver.d.ts.map +1 -0
  382. package/dist/sketch/solver.js +28 -0
  383. package/dist/sketch/solver.js.map +1 -0
  384. package/dist/sketch/verify.d.ts +53 -0
  385. package/dist/sketch/verify.d.ts.map +1 -0
  386. package/dist/sketch/verify.js +71 -0
  387. package/dist/sketch/verify.js.map +1 -0
  388. package/dist/weapp.d.ts +1 -1
  389. package/dist/weapp.d.ts.map +1 -1
  390. package/dist/weapp.js +1 -1
  391. package/dist/weapp.js.map +1 -1
  392. package/package.json +43 -11
@@ -0,0 +1,112 @@
1
+ const LENGTH = { kind: 'dim', dim: 'length' };
2
+ const ANGLE = { kind: 'dim', dim: 'angle' };
3
+ const PLAIN = { kind: 'plain' };
4
+ /** [x, y] — both length. */
5
+ const PT2 = { kind: 'array', item: LENGTH };
6
+ /** Pt2[] — array of length pairs (bspline control points). */
7
+ const PT2_ARRAY = { kind: 'array', item: PT2 };
8
+ /** [x, y, z] — all length (3D point, e.g. plane origin). */
9
+ const VEC3_LENGTH = { kind: 'array', item: LENGTH };
10
+ // ── shapes[] ──────────────────────────────────────────────────────────────
11
+ const shapeCases = {
12
+ rect: { kind: 'object', fields: { w: LENGTH, d: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },
13
+ roundedRect: { kind: 'object', fields: { w: LENGTH, d: LENGTH, r: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },
14
+ circle: { kind: 'object', fields: { r: LENGTH, cx: LENGTH, cy: LENGTH } },
15
+ ellipse: { kind: 'object', fields: { rx: LENGTH, ry: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },
16
+ polygon: { kind: 'object', fields: { r: LENGTH, cx: LENGTH, cy: LENGTH, n: PLAIN, angle: ANGLE } },
17
+ slot: { kind: 'object', fields: { w: LENGTH, d: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },
18
+ trapezoid: { kind: 'object', fields: { w: LENGTH, h: LENGTH, cx: LENGTH, cy: LENGTH, a1: ANGLE, a2: ANGLE } },
19
+ line: { kind: 'object', fields: { from: PT2, to: PT2 } },
20
+ arc: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, r: LENGTH, a0: ANGLE, a1: ANGLE, ccw: PLAIN } },
21
+ bspline: { kind: 'object', fields: { pts: PT2_ARRAY, degree: PLAIN } },
22
+ point: { kind: 'object', fields: { x: LENGTH, y: LENGTH } },
23
+ close: { kind: 'object', fields: {} },
24
+ };
25
+ // ── constraints[] ─────────────────────────────────────────────────────────
26
+ // Ref fields (of/a/b/p on/about) carry strings — not numeric, omitted.
27
+ // orientation `dir` is a direction vector — not length, declared `plain`.
28
+ // angle/arcAngle value is angle.
29
+ const constraintCases = {
30
+ distance: { kind: 'object', fields: { value: LENGTH } },
31
+ distanceX: { kind: 'object', fields: { value: LENGTH } },
32
+ distanceY: { kind: 'object', fields: { value: LENGTH } },
33
+ length: { kind: 'object', fields: { value: LENGTH } },
34
+ radius: { kind: 'object', fields: { value: LENGTH } },
35
+ diameter: { kind: 'object', fields: { value: LENGTH } },
36
+ angle: { kind: 'object', fields: { value: ANGLE } },
37
+ arcAngle: { kind: 'object', fields: { value: ANGLE } },
38
+ parallel: { kind: 'object', fields: { dir: PLAIN } },
39
+ perpendicular: { kind: 'object', fields: { dir: PLAIN } },
40
+ orientation: { kind: 'object', fields: { dir: PLAIN } },
41
+ fix: { kind: 'object', fields: {} },
42
+ horizontal: { kind: 'object', fields: {} },
43
+ vertical: { kind: 'object', fields: {} },
44
+ collinear: { kind: 'object', fields: {} },
45
+ concentric: { kind: 'object', fields: {} },
46
+ equal: { kind: 'object', fields: {} },
47
+ midpoint: { kind: 'object', fields: {} },
48
+ symmetry: { kind: 'object', fields: {} },
49
+ tangent: { kind: 'object', fields: {} },
50
+ coincident: { kind: 'object', fields: {} },
51
+ colinear: { kind: 'object', fields: {} },
52
+ };
53
+ // ── geoms[] (expanded canonical geometry) ─────────────────────────────────
54
+ const geomCases = {
55
+ line: { kind: 'object', fields: { x1: LENGTH, y1: LENGTH, x2: LENGTH, y2: LENGTH } },
56
+ circle: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, r: LENGTH } },
57
+ arc: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, r: LENGTH, a0: ANGLE, a1: ANGLE, ccw: PLAIN } },
58
+ point: { kind: 'object', fields: { x: LENGTH, y: LENGTH } },
59
+ ellipse: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, rx: LENGTH, ry: LENGTH, angle: ANGLE, a0: ANGLE, a1: ANGLE } },
60
+ bspline: {
61
+ kind: 'object',
62
+ fields: {
63
+ poles: { kind: 'array', item: { kind: 'object', fields: { x: LENGTH, y: LENGTH } } },
64
+ knots: { kind: 'array', item: PLAIN },
65
+ degree: PLAIN,
66
+ },
67
+ },
68
+ };
69
+ // ── plane ─────────────────────────────────────────────────────────────────
70
+ // origin is a 3D point (length); normal and xAxis are direction vectors (plain).
71
+ // When plane is a string (named plane), the object spec falls through to fmtValue.
72
+ const planeSpec = {
73
+ kind: 'object',
74
+ fields: {
75
+ origin: VEC3_LENGTH,
76
+ normal: { kind: 'array', item: PLAIN },
77
+ xAxis: { kind: 'array', item: PLAIN },
78
+ },
79
+ };
80
+ // ── public API ────────────────────────────────────────────────────────────
81
+ /**
82
+ * DimSpec for the `shapes[]` array of `cad.sketch`.
83
+ * @returns a `tagged`-by-`kind` array spec; length fields → `dim:'length'`,
84
+ * angle fields → `dim:'angle'`, pure numbers → `plain`.
85
+ */
86
+ export function shapesDimSpec() {
87
+ return { kind: 'array', item: { kind: 'tagged', key: 'kind', cases: shapeCases } };
88
+ }
89
+ /**
90
+ * DimSpec for the `constraints[]` array of `cad.sketch`.
91
+ * @returns a `tagged`-by-`kind` array spec; length-valued constraints → `dim:'length'`,
92
+ * angle-valued constraints → `dim:'angle'`, pure numbers → `plain`.
93
+ */
94
+ export function constraintsDimSpec() {
95
+ return { kind: 'array', item: { kind: 'tagged', key: 'kind', cases: constraintCases } };
96
+ }
97
+ /**
98
+ * DimSpec for the top-level options object of `cad.sketch({ shapes, geoms, constraints, plane, ... })`.
99
+ * @returns an `object` spec covering `shapes`/`geoms`/`constraints`/`plane` fields.
100
+ */
101
+ export function sketchDimSpec() {
102
+ return {
103
+ kind: 'object',
104
+ fields: {
105
+ shapes: shapesDimSpec(),
106
+ geoms: { kind: 'array', item: { kind: 'tagged', key: 'kind', cases: geomCases } },
107
+ constraints: constraintsDimSpec(),
108
+ plane: planeSpec,
109
+ },
110
+ };
111
+ }
112
+ //# sourceMappingURL=dim-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dim-spec.js","sourceRoot":"","sources":["../../src/sketch/dim-spec.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,GAAY,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAA;AACtD,MAAM,KAAK,GAAY,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA;AACpD,MAAM,KAAK,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAExC,4BAA4B;AAC5B,MAAM,GAAG,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AAEpD,8DAA8D;AAC9D,MAAM,SAAS,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAEvD,4DAA4D;AAC5D,MAAM,WAAW,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AAE5D,6EAA6E;AAE7E,MAAM,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,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;YACjF,WAAW,EAAE,kBAAkB,EAAE;YACjC,KAAK,EAAE,SAAS;SACjB;KACF,CAAA;AACH,CAAC","sourcesContent":["/**\n * dim-spec — recursive {@link DimSpec} for `cad.sketch` unit-aware codegen.\n *\n * Every numeric field is explicitly declared:\n * - Length fields → `dim: 'length'`\n * - Angle fields → `dim: 'angle'`\n * - Pure numbers (counts, degrees, booleans) → `kind: 'plain'`\n * - String/boolean/ref fields → omitted (not numeric, `object` spec only\n * descends into listed fields)\n *\n * Design doc §3.1 (user裁定 2026-10-10): `'plain'` is a legal, explicit\n * declaration — not an exemption. Every numeric parameter must be declared.\n */\nimport type { DimSpec } from '../units'\n\nconst LENGTH: DimSpec = { kind: 'dim', dim: 'length' }\nconst ANGLE: DimSpec = { kind: 'dim', dim: 'angle' }\nconst PLAIN: DimSpec = { kind: 'plain' }\n\n/** [x, y] — both length. */\nconst PT2: DimSpec = { kind: 'array', item: LENGTH }\n\n/** Pt2[] — array of length pairs (bspline control points). */\nconst PT2_ARRAY: DimSpec = { kind: 'array', item: PT2 }\n\n/** [x, y, z] — all length (3D point, e.g. plane origin). */\nconst VEC3_LENGTH: DimSpec = { kind: 'array', item: LENGTH }\n\n// ── shapes[] ──────────────────────────────────────────────────────────────\n\nconst shapeCases: Record<string, DimSpec> = {\n rect: { kind: 'object', fields: { w: LENGTH, d: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },\n roundedRect: { kind: 'object', fields: { w: LENGTH, d: LENGTH, r: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },\n circle: { kind: 'object', fields: { r: LENGTH, cx: LENGTH, cy: LENGTH } },\n ellipse: { kind: 'object', fields: { rx: LENGTH, ry: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },\n polygon: { kind: 'object', fields: { r: LENGTH, cx: LENGTH, cy: LENGTH, n: PLAIN, angle: ANGLE } },\n slot: { kind: 'object', fields: { w: LENGTH, d: LENGTH, cx: LENGTH, cy: LENGTH, angle: ANGLE } },\n trapezoid: { kind: 'object', fields: { w: LENGTH, h: LENGTH, cx: LENGTH, cy: LENGTH, a1: ANGLE, a2: ANGLE } },\n line: { kind: 'object', fields: { from: PT2, to: PT2 } },\n arc: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, r: LENGTH, a0: ANGLE, a1: ANGLE, ccw: PLAIN } },\n bspline: { kind: 'object', fields: { pts: PT2_ARRAY, degree: PLAIN } },\n point: { kind: 'object', fields: { x: LENGTH, y: LENGTH } },\n close: { kind: 'object', fields: {} },\n}\n\n// ── constraints[] ─────────────────────────────────────────────────────────\n// Ref fields (of/a/b/p on/about) carry strings — not numeric, omitted.\n// orientation `dir` is a direction vector — not length, declared `plain`.\n// angle/arcAngle value is angle.\n\nconst constraintCases: Record<string, DimSpec> = {\n distance: { kind: 'object', fields: { value: LENGTH } },\n distanceX: { kind: 'object', fields: { value: LENGTH } },\n distanceY: { kind: 'object', fields: { value: LENGTH } },\n length: { kind: 'object', fields: { value: LENGTH } },\n radius: { kind: 'object', fields: { value: LENGTH } },\n diameter: { kind: 'object', fields: { value: LENGTH } },\n angle: { kind: 'object', fields: { value: ANGLE } },\n arcAngle: { kind: 'object', fields: { value: ANGLE } },\n parallel: { kind: 'object', fields: { dir: PLAIN } },\n perpendicular: { kind: 'object', fields: { dir: PLAIN } },\n orientation: { kind: 'object', fields: { dir: PLAIN } },\n fix: { kind: 'object', fields: {} },\n horizontal: { kind: 'object', fields: {} },\n vertical: { kind: 'object', fields: {} },\n collinear: { kind: 'object', fields: {} },\n concentric: { kind: 'object', fields: {} },\n equal: { kind: 'object', fields: {} },\n midpoint: { kind: 'object', fields: {} },\n symmetry: { kind: 'object', fields: {} },\n tangent: { kind: 'object', fields: {} },\n coincident: { kind: 'object', fields: {} },\n colinear: { kind: 'object', fields: {} },\n}\n\n// ── geoms[] (expanded canonical geometry) ─────────────────────────────────\n\nconst geomCases: Record<string, DimSpec> = {\n line: { kind: 'object', fields: { x1: LENGTH, y1: LENGTH, x2: LENGTH, y2: LENGTH } },\n circle: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, r: LENGTH } },\n arc: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, r: LENGTH, a0: ANGLE, a1: ANGLE, ccw: PLAIN } },\n point: { kind: 'object', fields: { x: LENGTH, y: LENGTH } },\n ellipse: { kind: 'object', fields: { cx: LENGTH, cy: LENGTH, rx: LENGTH, ry: LENGTH, angle: ANGLE, a0: ANGLE, a1: ANGLE } },\n bspline: {\n kind: 'object',\n fields: {\n poles: { kind: 'array', item: { kind: 'object', fields: { x: LENGTH, y: LENGTH } } },\n knots: { kind: 'array', item: PLAIN },\n degree: PLAIN,\n },\n },\n}\n\n// ── plane ─────────────────────────────────────────────────────────────────\n// origin is a 3D point (length); normal and xAxis are direction vectors (plain).\n// When plane is a string (named plane), the object spec falls through to fmtValue.\n\nconst planeSpec: DimSpec = {\n kind: 'object',\n fields: {\n origin: VEC3_LENGTH,\n normal: { kind: 'array', item: PLAIN },\n xAxis: { kind: 'array', item: PLAIN },\n },\n}\n\n// ── public API ────────────────────────────────────────────────────────────\n\n/**\n * DimSpec for the `shapes[]` array of `cad.sketch`.\n * @returns a `tagged`-by-`kind` array spec; length fields → `dim:'length'`,\n * angle fields → `dim:'angle'`, pure numbers → `plain`.\n */\nexport function shapesDimSpec(): DimSpec {\n return { kind: 'array', item: { kind: 'tagged', key: 'kind', cases: shapeCases } }\n}\n\n/**\n * DimSpec for the `constraints[]` array of `cad.sketch`.\n * @returns a `tagged`-by-`kind` array spec; length-valued constraints → `dim:'length'`,\n * angle-valued constraints → `dim:'angle'`, pure numbers → `plain`.\n */\nexport function constraintsDimSpec(): DimSpec {\n return { kind: 'array', item: { kind: 'tagged', key: 'kind', cases: constraintCases } }\n}\n\n/**\n * DimSpec for the top-level options object of `cad.sketch({ shapes, geoms, constraints, plane, ... })`.\n * @returns an `object` spec covering `shapes`/`geoms`/`constraints`/`plane` fields.\n */\nexport function sketchDimSpec(): DimSpec {\n return {\n kind: 'object',\n fields: {\n shapes: shapesDimSpec(),\n geoms: { kind: 'array', item: { kind: 'tagged', key: 'kind', cases: geomCases } },\n constraints: constraintsDimSpec(),\n plane: planeSpec,\n },\n }\n}\n"]}
@@ -0,0 +1,45 @@
1
+ import type { Shape } from '../mesh/types.js';
2
+ import type { SketchConstraint, SketchGeom, SolveOutcome } from './canonical.js';
3
+ import type { SketchParams } from './op.js';
4
+ import { type SolveSketchOptions } from './solve.js';
5
+ /** Options for {@link sketchFaces}. */
6
+ export interface SketchFacesOptions extends SolveSketchOptions {
7
+ /** Product form: `'face'` (default) builds a face; `'wire'` returns the outer wire only. */
8
+ as?: 'face' | 'wire';
9
+ /**
10
+ * Named target plane (`'XY'` default; e.g. `'XZ'` / `'YZ'`) or an explicit
11
+ * plane frame (A3, 2026-09-28): `{ origin, normal, xAxis? }` for arbitrary
12
+ * sketch planes (the sketchOnPlane hand-off, D3 option (b)).
13
+ */
14
+ plane?: SketchParams['plane'];
15
+ /**
16
+ * 本次草图里有 `mode:'s'`(内环/孔)形状:构面后**校验孔确实被包含**。
17
+ *
18
+ * 孔的身份由轮廓包含关系决定(core `organiseBlueprints` + `addHolesInFace`),
19
+ * 所以"减"不需要面级布尔;但一个没被任何外轮廓包住的 `mode:'s'` 形状会**静默变成
20
+ * 一块额外的外轮廓面**——那正是必须显式报错的形态(`E_SKETCHC_SUBTRACT_NOT_CONTAINED`)。
21
+ */
22
+ expectHoles?: boolean;
23
+ /** Diagnostics observer (the script-face op forwards this to the host sink). */
24
+ onDiagnostic?: (outcome: SolveOutcome) => void;
25
+ }
26
+ /**
27
+ * Build the shape from an already-solved outcome (shared by op + wrapper).
28
+ *
29
+ * @param outcome - a converged solve outcome.
30
+ * @param as - product form: `'face'` (default) or `'wire'`.
31
+ * @param plane - named plane or explicit frame `{ origin, normal, xAxis? }` (default `'XY'`).
32
+ * @param expectHoles - 本次草图声明了 `mode:'s'` 内环 → 构面后校验孔确实被包含。
33
+ * @returns the placement face or outer wire.
34
+ */
35
+ export declare function shapeFromSolved(outcome: SolveOutcome, as?: 'face' | 'wire', plane?: SketchParams['plane'], expectHoles?: boolean): Shape;
36
+ /**
37
+ * Solve a canonical sketch and build its planar face / outer wire.
38
+ *
39
+ * @param geoms - canonical geometry (stored coordinates are the initial guess).
40
+ * @param constraints - canonical constraints (default: none).
41
+ * @param opts - solver selection, product form, target plane and diagnostics observer.
42
+ * @returns the face (`as:'wire'` → the outer wire as a 1D curve), placed on `opts.plane`.
43
+ */
44
+ export declare function sketchFaces(geoms: SketchGeom[], constraints?: SketchConstraint[], opts?: SketchFacesOptions): Promise<Shape>;
45
+ //# sourceMappingURL=faces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/sketch/faces.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAA;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAA;AA4BjE,uCAAuC;AACvC,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,4FAA4F;IAC5F,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAC7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gFAAgF;IAChF,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;CAC/C;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,YAAY,EACrB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EACpB,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,EAC7B,WAAW,UAAQ,GAClB,KAAK,CA6BP;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,UAAU,EAAE,EACnB,WAAW,GAAE,gBAAgB,EAAO,EACpC,IAAI,CAAC,EAAE,kBAAkB,GACxB,OAAO,CAAC,KAAK,CAAC,CAIhB"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * faces — `sketchFaces`: solve a canonical sketch, chain the solved geometry
3
+ * into closed contours and build the face through core's **unified 2D→3D
4
+ * placement pipeline** (`buildSketchOnPlaneWith`, E2/F4): the contours are
5
+ * lifted onto a target plane (named plane, e.g. `'XY'` / `'XZ'`) by the same
6
+ * shared placement core used by `cad.sketchOnPlane`, so a solved sketch can be
7
+ * placed on an arbitrary plane rather than only the implicit z=0 frame.
8
+ *
9
+ * The solve → contour build hand-off is a distinct, failable step (§3.3): a
10
+ * sketch can solve successfully yet yield zero closed loops (dangling
11
+ * segments); that is a real failure mode and is surfaced explicitly rather
12
+ * than treated as a solved sketch.
13
+ */
14
+ import { buildSketchOnPlaneWith } from '../api/sketch-on-plane.js';
15
+ import { getBrepApi } from '../brep/handle-bridge.js';
16
+ import { brepOf } from '../shape.js';
17
+ import { solveSketch } from './solve.js';
18
+ import { toFreeCadGeoms } from './project.js';
19
+ import { extractContours } from './contour.js';
20
+ /** One-line description of a conflicting constraint, e.g. `length(bottom) = 80`. */
21
+ function describeConflict(d) {
22
+ const refs = d.refs.join(', ');
23
+ const val = typeof d.value === 'number' ? ` = ${d.value}` : '';
24
+ return `${d.kind}(${refs})${val}`;
25
+ }
26
+ /**
27
+ * Build the `E_SKETCHC_CONFLICTING` error message. Conflict details are
28
+ * resolved to tags (never bare solver indices); falls back to numeric indices
29
+ * when the solver reports none (§3.2, §5.1 probe caveat).
30
+ */
31
+ function conflictingMessage(outcome) {
32
+ const header = 'E_SKETCHC_CONFLICTING: conflicting constraints detected';
33
+ const details = outcome.conflictDetails;
34
+ if (details && details.length > 0) {
35
+ return `${header}\n${details.map((d) => ` - ${describeConflict(d)}`).join('\n')}`;
36
+ }
37
+ const idx = outcome.problemConstraints.length > 0
38
+ ? ` (indices: ${outcome.problemConstraints.join(', ')})`
39
+ : '';
40
+ return `${header}${idx}`;
41
+ }
42
+ /**
43
+ * 构面之后校验"声明的内环确实成了孔"。
44
+ *
45
+ * 判据是**结果**而不是几何猜测:轮廓数 > 面数,说明至少有一条轮廓被当成了内环
46
+ * (`organiseBlueprints` 按包含关系把它并进外环)。否则那条 `mode:'s'` 形状没被
47
+ * 任何外轮廓包住,静默变成外轮廓面是不可接受的。
48
+ */
49
+ function assertHolesMade(shape, contourCount) {
50
+ const faces = getBrepApi().getSubShapes(brepOf(shape), 'face');
51
+ if (faces.length >= contourCount) {
52
+ throw new Error('E_SKETCHC_SUBTRACT_NOT_CONTAINED: a `mode:"s"` shape is not contained by any outer ' +
53
+ `contour (${contourCount} contours → ${faces.length} faces); 孔必须落在某个外轮廓内部`);
54
+ }
55
+ }
56
+ /**
57
+ * Build the shape from an already-solved outcome (shared by op + wrapper).
58
+ *
59
+ * @param outcome - a converged solve outcome.
60
+ * @param as - product form: `'face'` (default) or `'wire'`.
61
+ * @param plane - named plane or explicit frame `{ origin, normal, xAxis? }` (default `'XY'`).
62
+ * @param expectHoles - 本次草图声明了 `mode:'s'` 内环 → 构面后校验孔确实被包含。
63
+ * @returns the placement face or outer wire.
64
+ */
65
+ export function shapeFromSolved(outcome, as, plane, expectHoles = false) {
66
+ // 2026-09-27裁定: a conflicting over-constraint is a HARD error on the
67
+ // script face — the message must point at the clashing constraints (§3.2).
68
+ // Under- and redundant-constraint still solve normally; only a hard solver
69
+ // failure blocks face construction as before.
70
+ if (!outcome.converged && outcome.status === 'conflicting') {
71
+ throw new Error(conflictingMessage(outcome));
72
+ }
73
+ if (!outcome.converged) {
74
+ throw new Error(`E_SKETCHC_SOLVE_FAILED: ${outcome.reason ?? outcome.status}`);
75
+ }
76
+ const contours = extractContours(toFreeCadGeoms(outcome.geoms));
77
+ if (contours.length === 0) {
78
+ throw new Error('E_SKETCHC_NO_CONTOUR: solved sketch produced no closed loop');
79
+ }
80
+ const loops = contours.map((c) => ({ segments: c.segments }));
81
+ // A3 (D3 (b)): the placement hand-off goes through the SAME shared
82
+ // placement core (`buildSketchOnPlaneWith`) for both named planes and
83
+ // explicit frames — the contours land on the target plane in one step.
84
+ const planeSpec = typeof plane === 'string' ? { name: plane } : (plane ?? { name: 'XY' });
85
+ const shape = buildSketchOnPlaneWith(getBrepApi(), {
86
+ contours: loops,
87
+ plane: planeSpec,
88
+ as,
89
+ });
90
+ // `as:'wire'` 只交外环,孔不参与成面 —— 那种调用没有"孔没被包含"可言。
91
+ if (expectHoles && as !== 'wire')
92
+ assertHolesMade(shape, contours.length);
93
+ return shape;
94
+ }
95
+ /**
96
+ * Solve a canonical sketch and build its planar face / outer wire.
97
+ *
98
+ * @param geoms - canonical geometry (stored coordinates are the initial guess).
99
+ * @param constraints - canonical constraints (default: none).
100
+ * @param opts - solver selection, product form, target plane and diagnostics observer.
101
+ * @returns the face (`as:'wire'` → the outer wire as a 1D curve), placed on `opts.plane`.
102
+ */
103
+ export async function sketchFaces(geoms, constraints = [], opts) {
104
+ const outcome = await solveSketch(geoms, constraints, opts);
105
+ opts?.onDiagnostic?.(outcome);
106
+ return shapeFromSolved(outcome, opts?.as, opts?.plane, opts?.expectHoles ?? false);
107
+ }
108
+ //# sourceMappingURL=faces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faces.js","sourceRoot":"","sources":["../../src/sketch/faces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAG/D,OAAO,EAAE,UAAU,EAAE,MA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K,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACzE,MAAM,KAAK,GAAG,sBAAsB,CAAC,UAAU,EAAE,EAAE;QACjD,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,SAAS;QAChB,EAAE;KACH,CAAC,CAAA;IACF,8CAA8C;IAC9C,IAAI,WAAW,IAAI,EAAE,KAAK,MAAM;QAAE,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzE,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAmB,EACnB,cAAkC,EAAE,EACpC,IAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;IAC3D,IAAI,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,CAAA;IAC7B,OAAO,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,IAAI,KAAK,CAAC,CAAA;AACpF,CAAC","sourcesContent":["/**\n * faces — `sketchFaces`: solve a canonical sketch, chain the solved geometry\n * into closed contours and build the face through core's **unified 2D→3D\n * placement pipeline** (`buildSketchOnPlaneWith`, E2/F4): the contours are\n * lifted onto a target plane (named plane, e.g. `'XY'` / `'XZ'`) by the same\n * shared placement core used by `cad.sketchOnPlane`, so a solved sketch can be\n * placed on an arbitrary plane rather than only the implicit z=0 frame.\n *\n * The solve → contour build hand-off is a distinct, failable step (§3.3): a\n * sketch can solve successfully yet yield zero closed loops (dangling\n * segments); that is a real failure mode and is surfaced explicitly rather\n * than treated as a solved sketch.\n */\nimport { buildSketchOnPlaneWith } from '../api/sketch-on-plane'\nimport type { ProfileLoop } from '../api/profile'\nimport type { SketchOnPlaneParams } from '../api/sketch-on-plane'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { brepOf } from '../shape'\nimport type { Shape } from '../mesh/types'\nimport type { SketchConstraint, SketchGeom, SolveOutcome, ConflictDetail } from './canonical.js'\nimport type { SketchParams } from './op.js'\nimport { solveSketch, type SolveSketchOptions } from './solve.js'\nimport { toFreeCadGeoms } from './project.js'\nimport { extractContours } from './contour.js'\n\n/** One-line description of a conflicting constraint, e.g. `length(bottom) = 80`. */\nfunction describeConflict(d: ConflictDetail): string {\n const refs = d.refs.join(', ')\n const val = typeof d.value === 'number' ? ` = ${d.value}` : ''\n return `${d.kind}(${refs})${val}`\n}\n\n/**\n * Build the `E_SKETCHC_CONFLICTING` error message. Conflict details are\n * resolved to tags (never bare solver indices); falls back to numeric indices\n * when the solver reports none (§3.2, §5.1 probe caveat).\n */\nfunction conflictingMessage(outcome: SolveOutcome): string {\n const header = 'E_SKETCHC_CONFLICTING: conflicting constraints detected'\n const details = outcome.conflictDetails\n if (details && details.length > 0) {\n return `${header}\\n${details.map((d) => ` - ${describeConflict(d)}`).join('\\n')}`\n }\n const idx = outcome.problemConstraints.length > 0\n ? ` (indices: ${outcome.problemConstraints.join(', ')})`\n : ''\n return `${header}${idx}`\n}\n\n/** Options for {@link sketchFaces}. */\nexport interface SketchFacesOptions extends SolveSketchOptions {\n /** Product form: `'face'` (default) builds a face; `'wire'` returns the outer wire only. */\n as?: 'face' | 'wire'\n /**\n * Named target plane (`'XY'` default; e.g. `'XZ'` / `'YZ'`) or an explicit\n * plane frame (A3, 2026-09-28): `{ origin, normal, xAxis? }` for arbitrary\n * sketch planes (the sketchOnPlane hand-off, D3 option (b)).\n */\n plane?: SketchParams['plane']\n /**\n * 本次草图里有 `mode:'s'`(内环/孔)形状:构面后**校验孔确实被包含**。\n *\n * 孔的身份由轮廓包含关系决定(core `organiseBlueprints` + `addHolesInFace`),\n * 所以\"减\"不需要面级布尔;但一个没被任何外轮廓包住的 `mode:'s'` 形状会**静默变成\n * 一块额外的外轮廓面**——那正是必须显式报错的形态(`E_SKETCHC_SUBTRACT_NOT_CONTAINED`)。\n */\n expectHoles?: boolean\n /** Diagnostics observer (the script-face op forwards this to the host sink). */\n onDiagnostic?: (outcome: SolveOutcome) => void\n}\n\n/**\n * 构面之后校验\"声明的内环确实成了孔\"。\n *\n * 判据是**结果**而不是几何猜测:轮廓数 > 面数,说明至少有一条轮廓被当成了内环\n * (`organiseBlueprints` 按包含关系把它并进外环)。否则那条 `mode:'s'` 形状没被\n * 任何外轮廓包住,静默变成外轮廓面是不可接受的。\n */\nfunction assertHolesMade(shape: Shape, contourCount: number): void {\n const faces = getBrepApi().getSubShapes(brepOf(shape) as never, 'face' as never) as unknown[]\n if (faces.length >= contourCount) {\n throw new Error(\n 'E_SKETCHC_SUBTRACT_NOT_CONTAINED: a `mode:\"s\"` shape is not contained by any outer ' +\n `contour (${contourCount} contours → ${faces.length} faces); 孔必须落在某个外轮廓内部`,\n )\n }\n}\n\n/**\n * Build the shape from an already-solved outcome (shared by op + wrapper).\n *\n * @param outcome - a converged solve outcome.\n * @param as - product form: `'face'` (default) or `'wire'`.\n * @param plane - named plane or explicit frame `{ origin, normal, xAxis? }` (default `'XY'`).\n * @param expectHoles - 本次草图声明了 `mode:'s'` 内环 → 构面后校验孔确实被包含。\n * @returns the placement face or outer wire.\n */\nexport function shapeFromSolved(\n outcome: SolveOutcome,\n as?: 'face' | 'wire',\n plane?: SketchParams['plane'],\n expectHoles = false,\n): Shape {\n // 2026-09-27裁定: a conflicting over-constraint is a HARD error on the\n // script face — the message must point at the clashing constraints (§3.2).\n // Under- and redundant-constraint still solve normally; only a hard solver\n // failure blocks face construction as before.\n if (!outcome.converged && outcome.status === 'conflicting') {\n throw new Error(conflictingMessage(outcome))\n }\n if (!outcome.converged) {\n throw new Error(`E_SKETCHC_SOLVE_FAILED: ${outcome.reason ?? outcome.status}`)\n }\n const contours = extractContours(toFreeCadGeoms(outcome.geoms))\n if (contours.length === 0) {\n throw new Error('E_SKETCHC_NO_CONTOUR: solved sketch produced no closed loop')\n }\n const loops: ProfileLoop[] = contours.map((c) => ({ segments: c.segments }))\n // A3 (D3 (b)): the placement hand-off goes through the SAME shared\n // placement core (`buildSketchOnPlaneWith`) for both named planes and\n // explicit frames — the contours land on the target plane in one step.\n const planeSpec: SketchOnPlaneParams['plane'] =\n typeof plane === 'string' ? { name: plane } : (plane ?? { name: 'XY' })\n const shape = buildSketchOnPlaneWith(getBrepApi(), {\n contours: loops,\n plane: planeSpec,\n as,\n })\n // `as:'wire'` 只交外环,孔不参与成面 —— 那种调用没有\"孔没被包含\"可言。\n if (expectHoles && as !== 'wire') assertHolesMade(shape, contours.length)\n return shape\n}\n\n/**\n * Solve a canonical sketch and build its planar face / outer wire.\n *\n * @param geoms - canonical geometry (stored coordinates are the initial guess).\n * @param constraints - canonical constraints (default: none).\n * @param opts - solver selection, product form, target plane and diagnostics observer.\n * @returns the face (`as:'wire'` → the outer wire as a 1D curve), placed on `opts.plane`.\n */\nexport async function sketchFaces(\n geoms: SketchGeom[],\n constraints: SketchConstraint[] = [],\n opts?: SketchFacesOptions,\n): Promise<Shape> {\n const outcome = await solveSketch(geoms, constraints, opts)\n opts?.onDiagnostic?.(outcome)\n return shapeFromSolved(outcome, opts?.as, opts?.plane, opts?.expectHoles ?? false)\n}\n"]}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * fcstd-types — FCStd sketch geometry / constraint model (migrated from
3
+ * `@faicad/faijs-freecad`'s `sketch-parse.ts`, type half only).
4
+ *
5
+ * These are the FreeCAD-shaped records the solver pipeline consumes: geometry
6
+ * carries an `index` (geoId) and 3D sketch-local coordinates; constraints carry
7
+ * the `ConstraintType` integer and `(geoId, pos)` refs. The canonical,
8
+ * projection-friendly model lives in `./canonical.ts` — this module is the
9
+ * internal/FCStd-projection representation.
10
+ *
11
+ * Field format per the fcstd port plan §5.2/§5.3:
12
+ * - geometry coordinates are 3D (X/Y/Z); sketch-local Z is usually 0
13
+ * - `<Constrain>` carries Type as the ConstraintType enum integer
14
+ * - ElementIds/ElementPositions take precedence over First/Second/Third
15
+ * - IsDriving defaults to true when missing
16
+ * - geoId: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external
17
+ */
18
+ /** ConstraintType enum values (src/Mod/Sketcher/App/Constraint.h:52-77) */
19
+ export declare const ConstraintType: {
20
+ readonly Coincident: 1;
21
+ readonly Horizontal: 2;
22
+ readonly Vertical: 3;
23
+ readonly Parallel: 4;
24
+ readonly Tangent: 5;
25
+ readonly Distance: 6;
26
+ readonly DistanceX: 7;
27
+ readonly DistanceY: 8;
28
+ readonly Angle: 9;
29
+ readonly Perpendicular: 10;
30
+ readonly Radius: 11;
31
+ readonly Equal: 12;
32
+ readonly PointOnObject: 13;
33
+ readonly Symmetric: 14;
34
+ readonly InternalAlignment: 15;
35
+ readonly SnellsLaw: 16;
36
+ readonly Block: 17;
37
+ readonly Diameter: 18;
38
+ readonly Weight: 19;
39
+ readonly Group: 20;
40
+ readonly Text: 21;
41
+ };
42
+ /**
43
+ * Human-readable names for the ConstraintType enum integers (debugging/
44
+ * diagnostics only).
45
+ */
46
+ export declare const CONSTRAINT_NAMES: Record<number, string>;
47
+ /** GeoEnum (src/Mod/Sketcher/App/GeoEnum.h:71-78) */
48
+ export declare const GeoId: {
49
+ readonly RtPnt: -1;
50
+ readonly HAxis: -1;
51
+ readonly VAxis: -2;
52
+ readonly RefExt: -3;
53
+ };
54
+ /** PointPos (GeoEnum.h:88-94) */
55
+ export declare const PointPos: {
56
+ readonly none: 0;
57
+ readonly start: 1;
58
+ readonly end: 2;
59
+ readonly mid: 3;
60
+ };
61
+ /**
62
+ * One parsed sketch geometry element (point, line, circle, arc, ellipse or
63
+ * bspline), in 3D sketch-local coordinates.
64
+ *
65
+ * `construction` (2026-09-26): FreeCAD marks reference geometry (axes, symmetry
66
+ * lines, helper circles) with `<Construction value="1"/>`. It participates in
67
+ * the constraint solve but is NOT part of the profile: FreeCAD never constrains
68
+ * it to the real outline, so its stored coordinates are frequently leftover
69
+ * garbage (measured on `Double glazed window … .FCStd` Sketch095: a
70
+ * construction line with `StartY = -16508.67` next to real geometry at y≈1165).
71
+ * Contour extraction must therefore filter on it — see `contour.ts`.
72
+ */
73
+ export type FcstdSketchGeom = {
74
+ kind: 'point';
75
+ index: number;
76
+ x: number;
77
+ y: number;
78
+ z: number;
79
+ construction?: boolean;
80
+ } | {
81
+ kind: 'line';
82
+ index: number;
83
+ x1: number;
84
+ y1: number;
85
+ z1: number;
86
+ x2: number;
87
+ y2: number;
88
+ z2: number;
89
+ construction?: boolean;
90
+ } | {
91
+ kind: 'circle';
92
+ index: number;
93
+ cx: number;
94
+ cy: number;
95
+ cz: number;
96
+ radius: number;
97
+ construction?: boolean;
98
+ } | {
99
+ kind: 'arc';
100
+ index: number;
101
+ cx: number;
102
+ cy: number;
103
+ cz: number;
104
+ radius: number;
105
+ startAngle: number;
106
+ endAngle: number;
107
+ /** arc endpoints derived from angles (kept for solver wiring) */
108
+ x1: number;
109
+ y1: number;
110
+ z1: number;
111
+ x2: number;
112
+ y2: number;
113
+ z2: number;
114
+ construction?: boolean;
115
+ } | {
116
+ kind: 'ellipse';
117
+ index: number;
118
+ cx: number;
119
+ cy: number;
120
+ cz: number;
121
+ majorRadius: number;
122
+ minorRadius: number;
123
+ /** rotation of major axis, radians */
124
+ angleXU: number;
125
+ /** partial-ellipse arc bounds (ArcOfEllipse); absent on a full ellipse */
126
+ startAngle?: number;
127
+ endAngle?: number;
128
+ /** first focus (computed) */
129
+ fx1: number;
130
+ fy1: number;
131
+ fx2: number;
132
+ fy2: number;
133
+ construction?: boolean;
134
+ } | {
135
+ /** Part::GeomBSplineCurve (Poles/Knots/Degree/IsPeriodic) */
136
+ kind: 'bspline';
137
+ index: number;
138
+ poles: {
139
+ x: number;
140
+ y: number;
141
+ }[];
142
+ knots: number[];
143
+ degree: number;
144
+ periodic: boolean;
145
+ /** curve start/end (exact for clamped splines; solver wiring + chaining) */
146
+ x1: number;
147
+ y1: number;
148
+ z1: number;
149
+ x2: number;
150
+ y2: number;
151
+ z2: number;
152
+ construction?: boolean;
153
+ };
154
+ /**
155
+ * One (geometry, point) reference inside a constraint: a geoId plus a
156
+ * PointPos selector.
157
+ */
158
+ export interface FcstdGeoRef {
159
+ /** geometry id: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external */
160
+ geoId: number;
161
+ /** PointPos selector (0 = edge itself, 1/2 = start/end, 3 = center) */
162
+ pos: number;
163
+ }
164
+ /**
165
+ * One parsed sketch constraint.
166
+ */
167
+ export interface FcstdSketchCon {
168
+ /** index in the constraint list */
169
+ index: number;
170
+ /** ConstraintType integer */
171
+ type: number;
172
+ /** resolved element refs */
173
+ refs: FcstdGeoRef[];
174
+ /** driving dimension value (Distance/Angle/Radius/...) */
175
+ value: number;
176
+ /** IsDriving; missing means true */
177
+ isDriving: boolean;
178
+ /** raw name attribute */
179
+ name: string;
180
+ /** InternalAlignmentType when type === 15 */
181
+ internalAlignmentType?: number;
182
+ }
183
+ /**
184
+ * The fully parsed sketch: geometry, constraints, constrainedness and the set
185
+ * of referenced external geoIds.
186
+ */
187
+ export interface FcstdParsedSketch {
188
+ geoms: FcstdSketchGeom[];
189
+ constraints: FcstdSketchCon[];
190
+ fullyConstrained: boolean;
191
+ /** geoIds <= -3 referenced by constraints */
192
+ externalGeoIds: number[];
193
+ }
194
+ //# sourceMappingURL=fcstd-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fcstd-types.d.ts","sourceRoot":"","sources":["../../src/sketch/fcstd-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAsBjB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMnD,CAAA;AAED,qDAA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,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,4BAA4B;IAC5B,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAA;IAClB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,WAAW,EAAE,cAAc,EAAE,CAAA;IAC7B,gBAAgB,EAAE,OAAO,CAAA;IACzB,6CAA6C;IAC7C,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * fcstd-types — FCStd sketch geometry / constraint model (migrated from
3
+ * `@faicad/faijs-freecad`'s `sketch-parse.ts`, type half only).
4
+ *
5
+ * These are the FreeCAD-shaped records the solver pipeline consumes: geometry
6
+ * carries an `index` (geoId) and 3D sketch-local coordinates; constraints carry
7
+ * the `ConstraintType` integer and `(geoId, pos)` refs. The canonical,
8
+ * projection-friendly model lives in `./canonical.ts` — this module is the
9
+ * internal/FCStd-projection representation.
10
+ *
11
+ * Field format per the fcstd port plan §5.2/§5.3:
12
+ * - geometry coordinates are 3D (X/Y/Z); sketch-local Z is usually 0
13
+ * - `<Constrain>` carries Type as the ConstraintType enum integer
14
+ * - ElementIds/ElementPositions take precedence over First/Second/Third
15
+ * - IsDriving defaults to true when missing
16
+ * - geoId: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external
17
+ */
18
+ /** ConstraintType enum values (src/Mod/Sketcher/App/Constraint.h:52-77) */
19
+ export const ConstraintType = {
20
+ Coincident: 1,
21
+ Horizontal: 2,
22
+ Vertical: 3,
23
+ Parallel: 4,
24
+ Tangent: 5,
25
+ Distance: 6,
26
+ DistanceX: 7,
27
+ DistanceY: 8,
28
+ Angle: 9,
29
+ Perpendicular: 10,
30
+ Radius: 11,
31
+ Equal: 12,
32
+ PointOnObject: 13,
33
+ Symmetric: 14,
34
+ InternalAlignment: 15,
35
+ SnellsLaw: 16,
36
+ Block: 17,
37
+ Diameter: 18,
38
+ Weight: 19,
39
+ Group: 20,
40
+ Text: 21,
41
+ };
42
+ /**
43
+ * Human-readable names for the ConstraintType enum integers (debugging/
44
+ * diagnostics only).
45
+ */
46
+ export const CONSTRAINT_NAMES = {
47
+ 1: 'Coincident', 2: 'Horizontal', 3: 'Vertical', 4: 'Parallel', 5: 'Tangent',
48
+ 6: 'Distance', 7: 'DistanceX', 8: 'DistanceY', 9: 'Angle', 10: 'Perpendicular',
49
+ 11: 'Radius', 12: 'Equal', 13: 'PointOnObject', 14: 'Symmetric',
50
+ 15: 'InternalAlignment', 16: 'SnellsLaw', 17: 'Block', 18: 'Diameter',
51
+ 19: 'Weight', 20: 'Group', 21: 'Text',
52
+ };
53
+ /** GeoEnum (src/Mod/Sketcher/App/GeoEnum.h:71-78) */
54
+ export const GeoId = {
55
+ RtPnt: -1,
56
+ HAxis: -1,
57
+ VAxis: -2,
58
+ RefExt: -3,
59
+ };
60
+ /** PointPos (GeoEnum.h:88-94) */
61
+ export const PointPos = {
62
+ none: 0, // edge itself
63
+ start: 1,
64
+ end: 2,
65
+ mid: 3, // center of circle/ellipse
66
+ };
67
+ //# sourceMappingURL=fcstd-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fcstd-types.js","sourceRoot":"","sources":["../../src/sketch/fcstd-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,CAAC;IACb,UAAU,EA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CAAiC;AACjC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,CAAC,EAAE,cAAc;IACvB,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC,EAAE,2BAA2B;CAC3B,CAAA","sourcesContent":["/**\n * fcstd-types — FCStd sketch geometry / constraint model (migrated from\n * `@faicad/faijs-freecad`'s `sketch-parse.ts`, type half only).\n *\n * These are the FreeCAD-shaped records the solver pipeline consumes: geometry\n * carries an `index` (geoId) and 3D sketch-local coordinates; constraints carry\n * the `ConstraintType` integer and `(geoId, pos)` refs. The canonical,\n * projection-friendly model lives in `./canonical.ts` — this module is the\n * internal/FCStd-projection representation.\n *\n * Field format per the fcstd port plan §5.2/§5.3:\n * - geometry coordinates are 3D (X/Y/Z); sketch-local Z is usually 0\n * - `<Constrain>` carries Type as the ConstraintType enum integer\n * - ElementIds/ElementPositions take precedence over First/Second/Third\n * - IsDriving defaults to true when missing\n * - geoId: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external\n */\n\n/** ConstraintType enum values (src/Mod/Sketcher/App/Constraint.h:52-77) */\nexport const ConstraintType = {\n Coincident: 1,\n Horizontal: 2,\n Vertical: 3,\n Parallel: 4,\n Tangent: 5,\n Distance: 6,\n DistanceX: 7,\n DistanceY: 8,\n Angle: 9,\n Perpendicular: 10,\n Radius: 11,\n Equal: 12,\n PointOnObject: 13,\n Symmetric: 14,\n InternalAlignment: 15,\n SnellsLaw: 16,\n Block: 17,\n Diameter: 18,\n Weight: 19,\n Group: 20,\n Text: 21,\n} as const\n\n/**\n * Human-readable names for the ConstraintType enum integers (debugging/\n * diagnostics only).\n */\nexport const CONSTRAINT_NAMES: Record<number, string> = {\n 1: 'Coincident', 2: 'Horizontal', 3: 'Vertical', 4: 'Parallel', 5: 'Tangent',\n 6: 'Distance', 7: 'DistanceX', 8: 'DistanceY', 9: 'Angle', 10: 'Perpendicular',\n 11: 'Radius', 12: 'Equal', 13: 'PointOnObject', 14: 'Symmetric',\n 15: 'InternalAlignment', 16: 'SnellsLaw', 17: 'Block', 18: 'Diameter',\n 19: 'Weight', 20: 'Group', 21: 'Text',\n}\n\n/** GeoEnum (src/Mod/Sketcher/App/GeoEnum.h:71-78) */\nexport const GeoId = {\n RtPnt: -1,\n HAxis: -1,\n VAxis: -2,\n RefExt: -3,\n} as const\n\n/** PointPos (GeoEnum.h:88-94) */\nexport const PointPos = {\n none: 0, // edge itself\n start: 1,\n end: 2,\n mid: 3, // center of circle/ellipse\n} as const\n\n/**\n * One parsed sketch geometry element (point, line, circle, arc, ellipse or\n * bspline), in 3D sketch-local coordinates.\n *\n * `construction` (2026-09-26): FreeCAD marks reference geometry (axes, symmetry\n * lines, helper circles) with `<Construction value=\"1\"/>`. It participates in\n * the constraint solve but is NOT part of the profile: FreeCAD never constrains\n * it to the real outline, so its stored coordinates are frequently leftover\n * garbage (measured on `Double glazed window … .FCStd` Sketch095: a\n * construction line with `StartY = -16508.67` next to real geometry at y≈1165).\n * Contour extraction must therefore filter on it — see `contour.ts`.\n */\nexport type FcstdSketchGeom =\n | { kind: 'point'; index: number; x: number; y: number; z: number; construction?: boolean }\n | { kind: 'line'; index: number; x1: number; y1: number; z1: number; x2: number; y2: number; z2: number; construction?: boolean }\n | { kind: 'circle'; index: number; cx: number; cy: number; cz: number; radius: number; construction?: boolean }\n | {\n kind: 'arc'\n index: number\n cx: number\n cy: number\n cz: number\n radius: number\n startAngle: number // radians\n endAngle: number\n /** arc endpoints derived from angles (kept for solver wiring) */\n x1: number\n y1: number\n z1: number\n x2: number\n y2: number\n z2: number\n construction?: boolean\n }\n | {\n kind: 'ellipse'\n index: number\n cx: number\n cy: number\n cz: number\n majorRadius: number\n minorRadius: number\n /** rotation of major axis, radians */\n angleXU: number\n /** partial-ellipse arc bounds (ArcOfEllipse); absent on a full ellipse */\n startAngle?: number\n endAngle?: number\n /** first focus (computed) */\n fx1: number\n fy1: number\n fx2: number\n fy2: number\n construction?: boolean\n }\n | {\n /** Part::GeomBSplineCurve (Poles/Knots/Degree/IsPeriodic) */\n kind: 'bspline'\n index: number\n poles: { x: number; y: number }[]\n knots: number[]\n degree: number\n periodic: boolean\n /** curve start/end (exact for clamped splines; solver wiring + chaining) */\n x1: number\n y1: number\n z1: number\n x2: number\n y2: number\n z2: number\n construction?: boolean\n }\n\n/**\n * One (geometry, point) reference inside a constraint: a geoId plus a\n * PointPos selector.\n */\nexport interface FcstdGeoRef {\n /** geometry id: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external */\n geoId: number\n /** PointPos selector (0 = edge itself, 1/2 = start/end, 3 = center) */\n pos: number // PointPos\n}\n\n/**\n * One parsed sketch constraint.\n */\nexport interface FcstdSketchCon {\n /** index in the constraint list */\n index: number\n /** ConstraintType integer */\n type: number\n /** resolved element refs */\n refs: FcstdGeoRef[]\n /** driving dimension value (Distance/Angle/Radius/...) */\n value: number\n /** IsDriving; missing means true */\n isDriving: boolean\n /** raw name attribute */\n name: string\n /** InternalAlignmentType when type === 15 */\n internalAlignmentType?: number\n}\n\n/**\n * The fully parsed sketch: geometry, constraints, constrainedness and the set\n * of referenced external geoIds.\n */\nexport interface FcstdParsedSketch {\n geoms: FcstdSketchGeom[]\n constraints: FcstdSketchCon[]\n fullyConstrained: boolean\n /** geoIds <= -3 referenced by constraints */\n externalGeoIds: number[]\n}"]}