@faicad/faijs 0.14.1 → 0.16.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 (338) hide show
  1. package/dist/api/api-namespace.d.ts +7 -0
  2. package/dist/api/api-namespace.d.ts.map +1 -1
  3. package/dist/api/api-namespace.js +23 -22
  4. package/dist/api/api-namespace.js.map +1 -1
  5. package/dist/api/boolean.d.ts.map +1 -1
  6. package/dist/api/boolean.js +26 -8
  7. package/dist/api/boolean.js.map +1 -1
  8. package/dist/api/chamfer.d.ts.map +1 -1
  9. package/dist/api/chamfer.js +4 -1
  10. package/dist/api/chamfer.js.map +1 -1
  11. package/dist/api/generated/cad/script-face.d.ts +1 -1
  12. package/dist/api/generated/cad/script-face.d.ts.map +1 -1
  13. package/dist/api/generated/cad/script-face.js +1 -2
  14. package/dist/api/generated/cad/script-face.js.map +1 -1
  15. package/dist/api/generated/operations.js +16 -16
  16. package/dist/api/generated/operations.js.map +1 -1
  17. package/dist/api/generated/script-face-manifest.d.ts.map +1 -1
  18. package/dist/api/generated/script-face-manifest.js +0 -1
  19. package/dist/api/generated/script-face-manifest.js.map +1 -1
  20. package/dist/api/generated/script-face.d.ts +1 -4
  21. package/dist/api/generated/script-face.d.ts.map +1 -1
  22. package/dist/api/generated/script-face.js +2 -3
  23. package/dist/api/generated/script-face.js.map +1 -1
  24. package/dist/api/generated/sketching.js +1 -1
  25. package/dist/api/generated/sketching.js.map +1 -1
  26. package/dist/api/generated/topology.d.ts +0 -8
  27. package/dist/api/generated/topology.d.ts.map +1 -1
  28. package/dist/api/generated/topology.js +19 -26
  29. package/dist/api/generated/topology.js.map +1 -1
  30. package/dist/api/index.d.ts +1 -10
  31. package/dist/api/index.d.ts.map +1 -1
  32. package/dist/api/index.js +10 -18
  33. package/dist/api/index.js.map +1 -1
  34. package/dist/api/internal/compat-projection.d.ts +3 -1
  35. package/dist/api/internal/compat-projection.d.ts.map +1 -1
  36. package/dist/api/internal/compat-projection.js +8 -5
  37. package/dist/api/internal/compat-projection.js.map +1 -1
  38. package/dist/api/internal/replica-role-table.d.ts +36 -0
  39. package/dist/api/internal/replica-role-table.d.ts.map +1 -0
  40. package/dist/api/internal/replica-role-table.js +73 -0
  41. package/dist/api/internal/replica-role-table.js.map +1 -0
  42. package/dist/api/internal/result-unwrap.d.ts +3 -1
  43. package/dist/api/internal/result-unwrap.d.ts.map +1 -1
  44. package/dist/api/internal/result-unwrap.js +2 -2
  45. package/dist/api/internal/result-unwrap.js.map +1 -1
  46. package/dist/api/occt-kernel-bridge.d.ts +105 -27
  47. package/dist/api/occt-kernel-bridge.d.ts.map +1 -1
  48. package/dist/api/occt-kernel-bridge.js +255 -41
  49. package/dist/api/occt-kernel-bridge.js.map +1 -1
  50. package/dist/api/pattern.d.ts.map +1 -1
  51. package/dist/api/pattern.js +25 -61
  52. package/dist/api/pattern.js.map +1 -1
  53. package/dist/api/replicate.d.ts +145 -0
  54. package/dist/api/replicate.d.ts.map +1 -0
  55. package/dist/api/replicate.js +351 -0
  56. package/dist/api/replicate.js.map +1 -0
  57. package/dist/api/revolve.d.ts +36 -0
  58. package/dist/api/revolve.d.ts.map +1 -0
  59. package/dist/api/revolve.js +165 -0
  60. package/dist/api/revolve.js.map +1 -0
  61. package/dist/api/surface/arg-spec.d.ts +8 -0
  62. package/dist/api/surface/arg-spec.d.ts.map +1 -1
  63. package/dist/api/surface/arg-spec.js +37 -36
  64. package/dist/api/surface/arg-spec.js.map +1 -1
  65. package/dist/api/surface/projection-overrides.d.ts.map +1 -1
  66. package/dist/api/surface/projection-overrides.js +6 -0
  67. package/dist/api/surface/projection-overrides.js.map +1 -1
  68. package/dist/boolean/deriveNormals.d.ts +5 -4
  69. package/dist/boolean/deriveNormals.d.ts.map +1 -1
  70. package/dist/boolean/deriveNormals.js +24 -7
  71. package/dist/boolean/deriveNormals.js.map +1 -1
  72. package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
  73. package/dist/brep/engine/adapters/brep-mock.js +58 -0
  74. package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
  75. package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
  76. package/dist/brep/engine/adapters/brepkit.js +39 -1
  77. package/dist/brep/engine/adapters/brepkit.js.map +1 -1
  78. package/dist/brep/engine/adapters/occt.d.ts +1 -5
  79. package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
  80. package/dist/brep/engine/adapters/occt.js +232 -18
  81. package/dist/brep/engine/adapters/occt.js.map +1 -1
  82. package/dist/brep/engine/primitives.d.ts +79 -0
  83. package/dist/brep/engine/primitives.d.ts.map +1 -1
  84. package/dist/brep/engine/primitives.js.map +1 -1
  85. package/dist/brep/engine/types.d.ts +18 -1
  86. package/dist/brep/engine/types.d.ts.map +1 -1
  87. package/dist/brep/engine/types.js.map +1 -1
  88. package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
  89. package/dist/brepkit-kernel/brepkitKernel.js +81 -11
  90. package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
  91. package/dist/browser.d.ts +6 -28
  92. package/dist/browser.d.ts.map +1 -1
  93. package/dist/browser.js +6 -17
  94. package/dist/browser.js.map +1 -1
  95. package/dist/cad-runtime/admit-compat-lib.d.ts +13 -18
  96. package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
  97. package/dist/cad-runtime/admit-compat-lib.js +25 -18
  98. package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
  99. package/dist/cad-runtime/backend-dispatch.d.ts +4 -2
  100. package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
  101. package/dist/cad-runtime/backend-dispatch.js +2 -0
  102. package/dist/cad-runtime/backend-dispatch.js.map +1 -1
  103. package/dist/cad-runtime/browser-lib-loader.d.ts +4 -6
  104. package/dist/cad-runtime/browser-lib-loader.d.ts.map +1 -1
  105. package/dist/cad-runtime/browser-lib-loader.js +4 -9
  106. package/dist/cad-runtime/browser-lib-loader.js.map +1 -1
  107. package/dist/cad-runtime/ports.d.ts +0 -7
  108. package/dist/cad-runtime/ports.d.ts.map +1 -1
  109. package/dist/cad-runtime/ports.js.map +1 -1
  110. package/dist/cad-runtime/runtime.d.ts +1 -3
  111. package/dist/cad-runtime/runtime.d.ts.map +1 -1
  112. package/dist/cad-runtime/runtime.js +13 -18
  113. package/dist/cad-runtime/runtime.js.map +1 -1
  114. package/dist/env-agnostic.d.ts +38 -0
  115. package/dist/env-agnostic.d.ts.map +1 -0
  116. package/dist/env-agnostic.js +29 -0
  117. package/dist/env-agnostic.js.map +1 -0
  118. package/dist/fcstd/codegen.d.ts.map +1 -1
  119. package/dist/fcstd/codegen.js +8 -1
  120. package/dist/fcstd/codegen.js.map +1 -1
  121. package/dist/fcstd/expressions.d.ts +24 -0
  122. package/dist/fcstd/expressions.d.ts.map +1 -1
  123. package/dist/fcstd/expressions.js +91 -0
  124. package/dist/fcstd/expressions.js.map +1 -1
  125. package/dist/fcstd/feature-translate.d.ts.map +1 -1
  126. package/dist/fcstd/feature-translate.js +16 -2
  127. package/dist/fcstd/feature-translate.js.map +1 -1
  128. package/dist/fcstd/structural-types.d.ts.map +1 -1
  129. package/dist/fcstd/structural-types.js +5 -0
  130. package/dist/fcstd/structural-types.js.map +1 -1
  131. package/dist/index.d.ts +7 -24
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +10 -16
  134. package/dist/index.js.map +1 -1
  135. package/dist/lang/determinism-scanner.d.ts +9 -0
  136. package/dist/lang/determinism-scanner.d.ts.map +1 -1
  137. package/dist/lang/determinism-scanner.js +7 -1
  138. package/dist/lang/determinism-scanner.js.map +1 -1
  139. package/dist/lang/symbol-table.d.ts +31 -0
  140. package/dist/lang/symbol-table.d.ts.map +1 -1
  141. package/dist/lang/symbol-table.generated.d.ts +6 -16
  142. package/dist/lang/symbol-table.generated.d.ts.map +1 -1
  143. package/dist/lang/symbol-table.generated.js +6 -16
  144. package/dist/lang/symbol-table.generated.js.map +1 -1
  145. package/dist/lang/symbol-table.js +50 -1
  146. package/dist/lang/symbol-table.js.map +1 -1
  147. package/dist/mesh/creased-normals.d.ts +50 -0
  148. package/dist/mesh/creased-normals.d.ts.map +1 -0
  149. package/dist/mesh/creased-normals.js +114 -0
  150. package/dist/mesh/creased-normals.js.map +1 -0
  151. package/dist/mesh/decoration-provider.d.ts +53 -0
  152. package/dist/mesh/decoration-provider.d.ts.map +1 -0
  153. package/dist/mesh/decoration-provider.js +21 -0
  154. package/dist/mesh/decoration-provider.js.map +1 -0
  155. package/dist/mesh/engrave.d.ts +4 -0
  156. package/dist/mesh/engrave.d.ts.map +1 -1
  157. package/dist/mesh/engrave.js +22 -31
  158. package/dist/mesh/engrave.js.map +1 -1
  159. package/dist/mesh/index.d.ts +5 -14
  160. package/dist/mesh/index.d.ts.map +1 -1
  161. package/dist/mesh/index.js +7 -19
  162. package/dist/mesh/index.js.map +1 -1
  163. package/dist/mesh/io.d.ts +2 -1
  164. package/dist/mesh/io.d.ts.map +1 -1
  165. package/dist/mesh/io.js +5 -7
  166. package/dist/mesh/io.js.map +1 -1
  167. package/dist/mesh/primitives.d.ts +5 -18
  168. package/dist/mesh/primitives.d.ts.map +1 -1
  169. package/dist/mesh/primitives.js +4 -48
  170. package/dist/mesh/primitives.js.map +1 -1
  171. package/dist/mesh/stl-loader.d.ts +23 -0
  172. package/dist/mesh/stl-loader.d.ts.map +1 -0
  173. package/dist/mesh/stl-loader.js +139 -0
  174. package/dist/mesh/stl-loader.js.map +1 -0
  175. package/dist/module-resolver/parse-imports.d.ts +37 -0
  176. package/dist/module-resolver/parse-imports.d.ts.map +1 -0
  177. package/dist/module-resolver/parse-imports.js +39 -0
  178. package/dist/module-resolver/parse-imports.js.map +1 -0
  179. package/dist/module-resolver/resolver.d.ts +1 -1
  180. package/dist/module-resolver/resolver.js +2 -2
  181. package/dist/module-resolver/resolver.js.map +1 -1
  182. package/dist/node-host/cli.d.ts.map +1 -1
  183. package/dist/node-host/cli.js +1 -22
  184. package/dist/node-host/cli.js.map +1 -1
  185. package/dist/primitives/text/cjk-font.d.ts +42 -0
  186. package/dist/primitives/text/cjk-font.d.ts.map +1 -0
  187. package/dist/primitives/text/cjk-font.js +86 -0
  188. package/dist/primitives/text/cjk-font.js.map +1 -0
  189. package/dist/sdk.d.ts +2 -2
  190. package/dist/sdk.js +2 -2
  191. package/dist/sdk.js.map +1 -1
  192. package/dist/symbol-table.d.ts +15 -0
  193. package/dist/symbol-table.d.ts.map +1 -0
  194. package/dist/symbol-table.js +14 -0
  195. package/dist/symbol-table.js.map +1 -0
  196. package/dist/topology/naming/lineage-resolve.js +1 -1
  197. package/dist/topology/naming/lineage-resolve.js.map +1 -1
  198. package/dist/vendored/brepjs/kernel/index.d.ts +5 -0
  199. package/dist/vendored/brepjs/kernel/index.d.ts.map +1 -1
  200. package/dist/vendored/brepjs/kernel/index.js +11 -0
  201. package/dist/vendored/brepjs/kernel/index.js.map +1 -1
  202. package/dist/weapp.d.ts +3 -3
  203. package/dist/weapp.d.ts.map +1 -1
  204. package/dist/weapp.js +6 -3
  205. package/dist/weapp.js.map +1 -1
  206. package/package.json +16 -14
  207. package/dist/api/compat/index.d.ts +0 -173
  208. package/dist/api/compat/index.d.ts.map +0 -1
  209. package/dist/api/compat/index.js +0 -222
  210. package/dist/api/compat/index.js.map +0 -1
  211. package/dist/api/compound.d.ts +0 -110
  212. package/dist/api/compound.d.ts.map +0 -1
  213. package/dist/api/compound.js +0 -164
  214. package/dist/api/compound.js.map +0 -1
  215. package/dist/api/copy.d.ts +0 -40
  216. package/dist/api/copy.d.ts.map +0 -1
  217. package/dist/api/copy.js +0 -83
  218. package/dist/api/copy.js.map +0 -1
  219. package/dist/api/fai_drill.d.ts +0 -46
  220. package/dist/api/fai_drill.d.ts.map +0 -1
  221. package/dist/api/fai_drill.js +0 -243
  222. package/dist/api/fai_drill.js.map +0 -1
  223. package/dist/api/fai_extrude.d.ts +0 -36
  224. package/dist/api/fai_extrude.d.ts.map +0 -1
  225. package/dist/api/fai_extrude.js +0 -79
  226. package/dist/api/fai_extrude.js.map +0 -1
  227. package/dist/api/fai_split.d.ts +0 -46
  228. package/dist/api/fai_split.d.ts.map +0 -1
  229. package/dist/api/fai_split.js +0 -254
  230. package/dist/api/fai_split.js.map +0 -1
  231. package/dist/api/load.d.ts +0 -41
  232. package/dist/api/load.d.ts.map +0 -1
  233. package/dist/api/load.js +0 -84
  234. package/dist/api/load.js.map +0 -1
  235. package/dist/api/svgExtrude.d.ts +0 -32
  236. package/dist/api/svgExtrude.d.ts.map +0 -1
  237. package/dist/api/svgExtrude.js +0 -74
  238. package/dist/api/svgExtrude.js.map +0 -1
  239. package/dist/api/text.d.ts +0 -34
  240. package/dist/api/text.d.ts.map +0 -1
  241. package/dist/api/text.js +0 -101
  242. package/dist/api/text.js.map +0 -1
  243. package/dist/brep/text/fontTestHelper.d.ts +0 -30
  244. package/dist/brep/text/fontTestHelper.d.ts.map +0 -1
  245. package/dist/brep/text/fontTestHelper.js +0 -57
  246. package/dist/brep/text/fontTestHelper.js.map +0 -1
  247. package/dist/cad-runtime/module-executor.d.ts +0 -271
  248. package/dist/cad-runtime/module-executor.d.ts.map +0 -1
  249. package/dist/cad-runtime/module-executor.js +0 -630
  250. package/dist/cad-runtime/module-executor.js.map +0 -1
  251. package/dist/cad-runtime/terminal-dag.d.ts +0 -65
  252. package/dist/cad-runtime/terminal-dag.d.ts.map +0 -1
  253. package/dist/cad-runtime/terminal-dag.js +0 -167
  254. package/dist/cad-runtime/terminal-dag.js.map +0 -1
  255. package/dist/faqts/browser.d.ts +0 -16
  256. package/dist/faqts/browser.d.ts.map +0 -1
  257. package/dist/faqts/browser.js +0 -13
  258. package/dist/faqts/browser.js.map +0 -1
  259. package/dist/faqts/exec-blob.d.ts +0 -14
  260. package/dist/faqts/exec-blob.d.ts.map +0 -1
  261. package/dist/faqts/exec-blob.js +0 -22
  262. package/dist/faqts/exec-blob.js.map +0 -1
  263. package/dist/faqts/exec-node.d.ts +0 -15
  264. package/dist/faqts/exec-node.d.ts.map +0 -1
  265. package/dist/faqts/exec-node.js +0 -29
  266. package/dist/faqts/exec-node.js.map +0 -1
  267. package/dist/faqts/imports.d.ts +0 -74
  268. package/dist/faqts/imports.d.ts.map +0 -1
  269. package/dist/faqts/imports.js +0 -95
  270. package/dist/faqts/imports.js.map +0 -1
  271. package/dist/faqts/index.d.ts +0 -22
  272. package/dist/faqts/index.d.ts.map +0 -1
  273. package/dist/faqts/index.js +0 -21
  274. package/dist/faqts/index.js.map +0 -1
  275. package/dist/faqts/node.d.ts +0 -23
  276. package/dist/faqts/node.d.ts.map +0 -1
  277. package/dist/faqts/node.js +0 -23
  278. package/dist/faqts/node.js.map +0 -1
  279. package/dist/faqts/run.d.ts +0 -62
  280. package/dist/faqts/run.d.ts.map +0 -1
  281. package/dist/faqts/run.js +0 -62
  282. package/dist/faqts/run.js.map +0 -1
  283. package/dist/faqts/transform.d.ts +0 -43
  284. package/dist/faqts/transform.d.ts.map +0 -1
  285. package/dist/faqts/transform.js +0 -35
  286. package/dist/faqts/transform.js.map +0 -1
  287. package/dist/lang/compile.d.ts +0 -50
  288. package/dist/lang/compile.d.ts.map +0 -1
  289. package/dist/lang/compile.js +0 -368
  290. package/dist/lang/compile.js.map +0 -1
  291. package/dist/lang/keep.d.ts +0 -109
  292. package/dist/lang/keep.d.ts.map +0 -1
  293. package/dist/lang/keep.js +0 -226
  294. package/dist/lang/keep.js.map +0 -1
  295. package/dist/lang/parser.d.ts +0 -91
  296. package/dist/lang/parser.d.ts.map +0 -1
  297. package/dist/lang/parser.js +0 -1594
  298. package/dist/lang/parser.js.map +0 -1
  299. package/dist/mesh/drill-hole/DrillHoleCore.d.ts +0 -90
  300. package/dist/mesh/drill-hole/DrillHoleCore.d.ts.map +0 -1
  301. package/dist/mesh/drill-hole/DrillHoleCore.js +0 -287
  302. package/dist/mesh/drill-hole/DrillHoleCore.js.map +0 -1
  303. package/dist/mesh/drill-hole/drill-types.d.ts +0 -34
  304. package/dist/mesh/drill-hole/drill-types.d.ts.map +0 -1
  305. package/dist/mesh/drill-hole/drill-types.js +0 -7
  306. package/dist/mesh/drill-hole/drill-types.js.map +0 -1
  307. package/dist/mesh/fai_drill.d.ts +0 -21
  308. package/dist/mesh/fai_drill.d.ts.map +0 -1
  309. package/dist/mesh/fai_drill.js +0 -92
  310. package/dist/mesh/fai_drill.js.map +0 -1
  311. package/dist/mesh/fai_extrude.d.ts +0 -24
  312. package/dist/mesh/fai_extrude.d.ts.map +0 -1
  313. package/dist/mesh/fai_extrude.js +0 -42
  314. package/dist/mesh/fai_extrude.js.map +0 -1
  315. package/dist/mesh/fai_split.d.ts +0 -164
  316. package/dist/mesh/fai_split.d.ts.map +0 -1
  317. package/dist/mesh/fai_split.js +0 -269
  318. package/dist/mesh/fai_split.js.map +0 -1
  319. package/dist/primitives/svg-extrude.d.ts +0 -43
  320. package/dist/primitives/svg-extrude.d.ts.map +0 -1
  321. package/dist/primitives/svg-extrude.js +0 -78
  322. package/dist/primitives/svg-extrude.js.map +0 -1
  323. package/dist/primitives/text/cjk.d.ts +0 -61
  324. package/dist/primitives/text/cjk.d.ts.map +0 -1
  325. package/dist/primitives/text/cjk.js +0 -215
  326. package/dist/primitives/text/cjk.js.map +0 -1
  327. package/dist/primitives/text-geometry.d.ts +0 -47
  328. package/dist/primitives/text-geometry.d.ts.map +0 -1
  329. package/dist/primitives/text-geometry.js +0 -127
  330. package/dist/primitives/text-geometry.js.map +0 -1
  331. package/dist/test-helpers.d.ts +0 -31
  332. package/dist/test-helpers.d.ts.map +0 -1
  333. package/dist/test-helpers.js +0 -55
  334. package/dist/test-helpers.js.map +0 -1
  335. package/dist/vendored/brepjs/core/kernelReentrancy.d.ts +0 -41
  336. package/dist/vendored/brepjs/core/kernelReentrancy.d.ts.map +0 -1
  337. package/dist/vendored/brepjs/core/kernelReentrancy.js +0 -68
  338. package/dist/vendored/brepjs/core/kernelReentrancy.js.map +0 -1
@@ -1,173 +0,0 @@
1
- /**
2
- * BREP-TS compatibility surface (P21).
3
- *
4
- * Projects the vendored BREP TS tree onto four stable groups so library authors
5
- * can write `import { box, fuse, Sketcher, ok } from this module` and call it
6
- * upstream-style:
7
- *
8
- * ① op — solid primitives + boolean / evolution operations
9
- * ② topology — sub-shape queries + measurements (plus the Bounds3D type)
10
- * ③ sketching — stateful Sketcher / FaceSketcher DSL + drawing factories
11
- * ④ combinators / types — result, vector, plane, errors, constants, types
12
- *
13
- * Every symbol is a projection (re-export or a thin dual-form wrapper) from the
14
- * ported tree: no reimplementation. The `.js` specifiers are the repo
15
- * convention (TypeScript maps `.js` → `.ts`).
16
- *
17
- * Semantic wraps (P23: both live in `api/internal/compat-projection.ts` so the
18
- * generated face and this hand-curated face share one mechanism):
19
- * - single-kernel assert: every modeling op asserts a bound BREP kernel first
20
- * (see `assertKernelBound`); `getBackends()` may throw before configuration,
21
- * so it is guarded and falls back to the occt-kernel binding flag.
22
- * - dual argument forms: object form normalizes to positional form via the
23
- * shared `resolveArgs` discriminant; object keys outside the declared
24
- * parameter table throw the shared `E_ARGS_FORM` token.
25
- * - `box` is the hand-written dual-form sample: positional
26
- * `box(width, depth, height)` and `box({ size })` / `box({ width, depth,
27
- * height })` both forward to the vendored primitive in its native dimension
28
- * order (width = X, depth = Y, height = Z — confirm against
29
- * `primitiveFns#box`), so every accepted form yields identical geometry.
30
- */
31
- import type { ValidSolid } from '../../vendored/brepjs/core/shapeTypes.js';
32
- /** Signature of a compat op projection (inputs normalized before the call). */
33
- type CompatOp = (...args: unknown[]) => unknown;
34
- import { sphere as primitiveSphere, cylinder as primitiveCylinder } from '../../vendored/brepjs/topology/primitiveFns.js';
35
- /**
36
- * Create a solid box.
37
- *
38
- * Positional form `box(width, depth, height)` uses the vendor's native
39
- * dimension order — X = width, Y = depth,
40
- * Z = height (the vendored `primitiveFns#box` dimension order; width/height are
41
- * NOT swapped). See the overload below for the object form.
42
- *
43
- * @param width - side length along X.
44
- * @param depth - side length along Y.
45
- * @param height - side length along Z.
46
- * @returns a new valid solid box.
47
- */
48
- export declare function box(width: number, depth: number, height: number): ValidSolid;
49
- /**
50
- * Create a solid box from an object form.
51
- *
52
- * Accepts `box({ size })` where `size` is a number (cube) or a
53
- * `[width, depth, height]` triple, or `box({ width, depth, height })`. Every
54
- * accepted form forwards to `primitiveBox(width, depth, height)`, so equal
55
- * dimension values always produce identical geometry.
56
- *
57
- * @param options - the dimension set: `size` (a cube edge or a triple) or
58
- * `width`/`depth`/`height` sides.
59
- * @returns a new valid solid box.
60
- * @throws An `Error` whose message contains the shared `E_ARGS_FORM` token when
61
- * no form matches (e.g. `box('x')`, `box()`, or unknown object keys).
62
- */
63
- export declare function box(options: BoxDimensions): ValidSolid;
64
- /** Object-form input accepted by {@link box}. */
65
- export interface BoxDimensions {
66
- /** All three sides as one number (cube) or a `[width, depth, height]` triple. */
67
- size?: number | [number, number, number];
68
- /** Side length along X. */
69
- width?: number;
70
- /** Side length along Y. */
71
- depth?: number;
72
- /** Side length along Z. */
73
- height?: number;
74
- }
75
- /**
76
- * Project the vendored `sphere(radius, options?)` verbatim (P25: the raw
77
- * morph form is what portable libraries call — upstream brepjs signatures,
78
- * no op projection).
79
- */
80
- export { primitiveSphere as sphere };
81
- /** Project the vendored `cylinder(radius, height, options?)` verbatim. */
82
- export { primitiveCylinder as cylinder };
83
- /** Project the vendored `cone(bottomRadius, topRadius, height, options?)`. */
84
- export declare const cone: CompatOp;
85
- /** Project the vendored `torus(majorRadius, minorRadius, options?)`. */
86
- export declare const torus: CompatOp;
87
- /** Project the vendored `ellipsoid(rx, ry, rz, options?)`. */
88
- export declare const ellipsoid: CompatOp;
89
- import { fuse as vendoredFuse, cut as vendoredCut, intersect as vendoredIntersect } from '../../vendored/brepjs/topology/api.js';
90
- import { extrude as vendoredExtrude, revolve as vendoredRevolve, loft as vendoredLoft } from '../../vendored/brepjs/operations/api.js';
91
- /** Fuse two shapeables into one 3D result. */
92
- export declare const fuse: typeof vendoredFuse;
93
- /** Cut the second shapeable out of the first. */
94
- export declare const cut: typeof vendoredCut;
95
- /** Extrude a planar profile along a height or direction vector. */
96
- export declare const extrude: typeof vendoredExtrude;
97
- /** Revolve a planar profile around an axis with optional angle. */
98
- export declare const revolve: typeof vendoredRevolve;
99
- /** Loft through a set of wire profiles. */
100
- export declare const loft: typeof vendoredLoft;
101
- /** Intersect two shapeables (common 3D volume). */
102
- export declare const intersect: typeof vendoredIntersect;
103
- import { makeExternalGear as vendoredMakeExternalGear, makeInternalGear as vendoredMakeInternalGear, makePlanetaryGear as vendoredMakePlanetaryGear } from '../../vendored/brepjs/gear/gearFns.js';
104
- import { thread as vendoredThread } from '../../vendored/brepjs/operations/threadFns.js';
105
- /**
106
- * Build an external spur gear.
107
- * @param params - the external-gear parameters (`teeth`, `moduleSize`, `thickness`, …).
108
- * @returns `Ok` with the gear solid + geometry, or `Err` for invalid parameters.
109
- */
110
- export declare const makeExternalGear: typeof vendoredMakeExternalGear;
111
- /**
112
- * Build an internal (ring) spur gear.
113
- * @param params - the internal-gear parameters, including the optional ring wall thickness.
114
- * @returns `Ok` with the gear solid + geometry, or `Err` for invalid parameters.
115
- */
116
- export declare const makeInternalGear: typeof vendoredMakeInternalGear;
117
- /**
118
- * Build a planetary gear train (sun + planets + ring).
119
- * @param params - the planetary-gear parameters.
120
- * @returns `Ok` with the sun/planet/ring solids and mesh diagnostics, or `Err`.
121
- */
122
- export declare const makePlanetaryGear: typeof vendoredMakePlanetaryGear;
123
- /**
124
- * Build a helical screw-thread ridge.
125
- * @param options - the thread profile (`radius`, `pitch`, `height`, …).
126
- * @returns `Ok` with the thread-ridge solid, or `Err` for invalid parameters.
127
- */
128
- export declare const thread: typeof vendoredThread;
129
- export type { ExternalGearParams, InternalGearParams, PlanetaryGearParams, GearResult, PlanetaryGearAssembly, } from '../../vendored/brepjs/gear/gearFns.js';
130
- export type { ThreadOptions } from '../../vendored/brepjs/operations/threadFns.js';
131
- export { getEdges, getFaces, getWires, getVertices, getShells, getSolids, getCompSolids, getBounds, vertexPosition, } from '../../vendored/brepjs/topology/topologyQueryFns.js';
132
- export type { Bounds3D } from '../../vendored/brepjs/topology/topologyQueryFns.js';
133
- export { measureVolume, measureArea, measureLength, } from '../../vendored/brepjs/measurement/measureFns.js';
134
- export { default as Sketcher } from '../../vendored/brepjs/sketching/sketcher.js';
135
- export { default as FaceSketcher } from '../../vendored/brepjs/sketching/faceSketcher.js';
136
- export { drawCircle, drawEllipse, drawRoundedRectangle, drawRectangle, drawSingleCircle, drawSingleEllipse, drawPolysides, drawText, } from '../../vendored/brepjs/sketching/drawingFactories.js';
137
- export { draw } from '../../vendored/brepjs/sketching/drawingPen.js';
138
- export { makeBaseBox } from '../../vendored/brepjs/sketching/shortcuts.js';
139
- export { ok, err, isOk, isErr, unwrap, unwrapOr, map, andThen, } from '../../vendored/brepjs/core/result.js';
140
- export type { Result, Ok, Err } from '../../vendored/brepjs/core/result.js';
141
- export { vecAdd, vecSub, vecScale, vecDot, vecCross, vecLength, vecNormalize, } from '../../vendored/brepjs/core/vecOps.js';
142
- export { createPlane, createNamedPlane, resolvePlane, } from '../../vendored/brepjs/core/planeOps.js';
143
- export { kernelError, validationError } from '../../vendored/brepjs/core/errors.js';
144
- export type { BrepError } from '../../vendored/brepjs/core/errors.js';
145
- export { DEG2RAD, RAD2DEG } from '../../vendored/brepjs/core/constants.js';
146
- export type { Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Shape3D, ValidSolid, ClosedWire, AnyShape, } from '../../vendored/brepjs/core/shapeTypes.js';
147
- export type { GearGeometry } from '../../vendored/brepjs/gear/gearMath.js';
148
- export type { Plane, PlaneName, PlaneInput } from '../../vendored/brepjs/core/planeTypes.js';
149
- export type { Vec3, PointInput } from '../../vendored/brepjs/core/types.js';
150
- import { line as rawLine, wire as rawWire, wireLoop as rawWireLoop, face as rawFace, polygon as rawPolygon } from '../../vendored/brepjs/topology/primitiveFns.js';
151
- import { outerWire as rawOuterWire, getSurfaceType as rawSurfaceType, pointOnSurface as rawPointOnSurface, normalAt as rawNormalAt, faceCenter as rawFaceCenter } from '../../vendored/brepjs/topology/faceFns.js';
152
- import { sharedEdges as rawSharedEdges } from '../../vendored/brepjs/topology/adjacencyFns.js';
153
- import { curveStartPoint as rawCurveStartPoint, curveEndPoint as rawCurveEndPoint } from '../../vendored/brepjs/topology/curveFns.js';
154
- import { translate as rawTranslate } from '../../vendored/brepjs/topology/transformFns.js';
155
- import { isSolid as rawIsSolid } from '../../vendored/brepjs/core/shapeTypes.js';
156
- import { isPlanarWire as rawIsPlanarWire } from '../../vendored/brepjs/core/validityTypes.js';
157
- import { isValid as rawIsValid } from '../../vendored/brepjs/topology/healingFns.js';
158
- import type { AnyShape } from '../../vendored/brepjs/core/shapeTypes.js';
159
- import type { Vec3 } from '../../vendored/brepjs/core/types.js';
160
- export { rawLine as line, rawWire as wire, rawWireLoop as wireLoop, rawFace as face, rawPolygon as polygon, rawOuterWire as outerWire, rawSurfaceType as getSurfaceType, rawPointOnSurface as pointOnSurface, rawNormalAt as normalAt, rawFaceCenter as faceCenter, rawSharedEdges as sharedEdges, rawCurveStartPoint as curveStartPoint, rawCurveEndPoint as curveEndPoint, rawTranslate as translate, rawIsSolid as isSolid, rawIsPlanarWire as isPlanarWire, rawIsValid as isValid, };
161
- /**
162
- * Rotate a shape by an angle in degrees around an axis.
163
- * @param shape - The shape to rotate.
164
- * @param angle - Rotation angle in degrees.
165
- * @param options - Axis and pivot (`at`) for the rotation; defaults to the Z
166
- * axis through the origin, matching upstream brepjs.
167
- * @returns A new rotated shape.
168
- */
169
- export declare function rotate<T extends AnyShape>(shape: T, angle: number, options?: {
170
- at?: Vec3;
171
- axis?: Vec3;
172
- }): T;
173
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/compat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0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AY,EAC/B,UAAU,IAAI,OAAO,GACtB,CAAA;AAMD;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EACvC,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,EAAE,CAAC,EAAE,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAO,GACvC,CAAC,CAEH"}
@@ -1,222 +0,0 @@
1
- /**
2
- * BREP-TS compatibility surface (P21).
3
- *
4
- * Projects the vendored BREP TS tree onto four stable groups so library authors
5
- * can write `import { box, fuse, Sketcher, ok } from this module` and call it
6
- * upstream-style:
7
- *
8
- * ① op — solid primitives + boolean / evolution operations
9
- * ② topology — sub-shape queries + measurements (plus the Bounds3D type)
10
- * ③ sketching — stateful Sketcher / FaceSketcher DSL + drawing factories
11
- * ④ combinators / types — result, vector, plane, errors, constants, types
12
- *
13
- * Every symbol is a projection (re-export or a thin dual-form wrapper) from the
14
- * ported tree: no reimplementation. The `.js` specifiers are the repo
15
- * convention (TypeScript maps `.js` → `.ts`).
16
- *
17
- * Semantic wraps (P23: both live in `api/internal/compat-projection.ts` so the
18
- * generated face and this hand-curated face share one mechanism):
19
- * - single-kernel assert: every modeling op asserts a bound BREP kernel first
20
- * (see `assertKernelBound`); `getBackends()` may throw before configuration,
21
- * so it is guarded and falls back to the occt-kernel binding flag.
22
- * - dual argument forms: object form normalizes to positional form via the
23
- * shared `resolveArgs` discriminant; object keys outside the declared
24
- * parameter table throw the shared `E_ARGS_FORM` token.
25
- * - `box` is the hand-written dual-form sample: positional
26
- * `box(width, depth, height)` and `box({ size })` / `box({ width, depth,
27
- * height })` both forward to the vendored primitive in its native dimension
28
- * order (width = X, depth = Y, height = Z — confirm against
29
- * `primitiveFns#box`), so every accepted form yields identical geometry.
30
- */
31
- import { assertKernelBound, projectBrepOp } from '../internal/compat-projection.js';
32
- import { isObjectForm } from '../internal/dual-form-args.js';
33
- /**
34
- * Dual-form op wrapper (A-class): asserts the kernel, normalizes object form to
35
- * positional form via `resolveArgs`, then delegates to the vendored
36
- * implementation.
37
- *
38
- * P23: delegates to the shared {@link projectBrepOp} so the hand-curated face
39
- * and the generated face share one projection mechanism (§4.3.2).
40
- */
41
- function wrapDual(name, params, impl) {
42
- return projectBrepOp(name, params, 'A', impl);
43
- }
44
- /**
45
- * Guard-only wrapper: forwards the arguments unchanged after the kernel assert.
46
- * Used for positional-first ops (booleans, evolutions) whose first argument is
47
- * a shape, so the object-form discriminant never applies. The exact function
48
- * type `F` (including its parameter and Result types) is preserved.
49
- */
50
- function wrapGuarded(name, impl) {
51
- const fn = (...args) => {
52
- assertKernelBound(name);
53
- return impl(...args);
54
- };
55
- return fn;
56
- }
57
- // ─────────────────────────────────────────────────────────────────────────────
58
- // ① primitives + booleans + evolutions
59
- // ─────────────────────────────────────────────────────────────────────────────
60
- import { box as primitiveBox, sphere as primitiveSphere, cylinder as primitiveCylinder, cone as primitiveCone, torus as primitiveTorus, ellipsoid as primitiveEllipsoid, } from '../../vendored/brepjs/topology/primitiveFns.js';
61
- export function box(...args) {
62
- assertKernelBound('box');
63
- if (isObjectForm(args)) {
64
- const obj = args[0];
65
- const keys = Object.keys(obj);
66
- const unknownKeys = keys.filter((k) => !['size', 'width', 'depth', 'height'].includes(k));
67
- if (unknownKeys.length > 0)
68
- throw boxArgError(args);
69
- const size = obj.size;
70
- if (size !== undefined) {
71
- if (typeof size === 'number')
72
- return primitiveBox(size, size, size);
73
- if (Array.isArray(size) && size.length === 3) {
74
- const [w, d, h] = size;
75
- return primitiveBox(w, d, h);
76
- }
77
- throw boxArgError(args);
78
- }
79
- const width = obj.width;
80
- const depth = obj.depth;
81
- const height = obj.height;
82
- if (typeof width === 'number' && typeof depth === 'number' && typeof height === 'number') {
83
- return primitiveBox(width, depth, height);
84
- }
85
- throw boxArgError(args);
86
- }
87
- if (args.length === 3 && args.every((a) => typeof a === 'number')) {
88
- const [w, d, h] = args;
89
- return primitiveBox(w, d, h);
90
- }
91
- throw boxArgError(args);
92
- }
93
- /** Shared E_ARGS_FORM error for {@link box} argument mismatches. */
94
- function boxArgError(args) {
95
- return new Error('[compat:box] E_ARGS_FORM: expected box(width, depth, height), ' +
96
- "box({ size: number | [w, d, h] }) or box({ width, depth, height }); got " +
97
- args.map((a) => safeJson(a)).join(', '));
98
- }
99
- /** JSON stringification that never throws on cyclic or exotic values. */
100
- function safeJson(v) {
101
- try {
102
- return JSON.stringify(v) ?? String(v);
103
- }
104
- catch {
105
- return '[unserializable]';
106
- }
107
- }
108
- /**
109
- * Project the vendored `sphere(radius, options?)` verbatim (P25: the raw
110
- * morph form is what portable libraries call — upstream brepjs signatures,
111
- * no op projection).
112
- */
113
- export { primitiveSphere as sphere };
114
- /** Project the vendored `cylinder(radius, height, options?)` verbatim. */
115
- export { primitiveCylinder as cylinder };
116
- /** Project the vendored `cone(bottomRadius, topRadius, height, options?)`. */
117
- export const cone = wrapDual('cone', ['bottomRadius', 'topRadius', 'height'], primitiveCone);
118
- /** Project the vendored `torus(majorRadius, minorRadius, options?)`. */
119
- export const torus = wrapDual('torus', ['majorRadius', 'minorRadius'], primitiveTorus);
120
- /** Project the vendored `ellipsoid(rx, ry, rz, options?)`. */
121
- export const ellipsoid = wrapDual('ellipsoid', ['rx', 'ry', 'rz'], primitiveEllipsoid);
122
- import { fuse as vendoredFuse, cut as vendoredCut, intersect as vendoredIntersect, } from '../../vendored/brepjs/topology/api.js';
123
- import { extrude as vendoredExtrude, revolve as vendoredRevolve, loft as vendoredLoft, } from '../../vendored/brepjs/operations/api.js';
124
- /** Fuse two shapeables into one 3D result. */
125
- export const fuse = wrapGuarded('fuse', vendoredFuse);
126
- /** Cut the second shapeable out of the first. */
127
- export const cut = wrapGuarded('cut', vendoredCut);
128
- /** Extrude a planar profile along a height or direction vector. */
129
- export const extrude = wrapGuarded('extrude', vendoredExtrude);
130
- /** Revolve a planar profile around an axis with optional angle. */
131
- export const revolve = wrapGuarded('revolve', vendoredRevolve);
132
- /** Loft through a set of wire profiles. */
133
- export const loft = wrapGuarded('loft', vendoredLoft);
134
- /** Intersect two shapeables (common 3D volume). */
135
- export const intersect = wrapGuarded('intersect', vendoredIntersect);
136
- // ─────────────────────────────────────────────────────────────────────────────
137
- // ①b library-building factories (P24, §8.1): spur gears, planetary trains, threads.
138
- // Both morphs of these factories are brep-only builders gated by the single-kernel
139
- // assert (wrapGuarded); the kernel is bound at the host boundary (D10).
140
- // ─────────────────────────────────────────────────────────────────────────────
141
- import { makeExternalGear as vendoredMakeExternalGear, makeInternalGear as vendoredMakeInternalGear, makePlanetaryGear as vendoredMakePlanetaryGear, } from '../../vendored/brepjs/gear/gearFns.js';
142
- import { thread as vendoredThread } from '../../vendored/brepjs/operations/threadFns.js';
143
- /**
144
- * Build an external spur gear.
145
- * @param params - the external-gear parameters (`teeth`, `moduleSize`, `thickness`, …).
146
- * @returns `Ok` with the gear solid + geometry, or `Err` for invalid parameters.
147
- */
148
- export const makeExternalGear = wrapGuarded('makeExternalGear', vendoredMakeExternalGear);
149
- /**
150
- * Build an internal (ring) spur gear.
151
- * @param params - the internal-gear parameters, including the optional ring wall thickness.
152
- * @returns `Ok` with the gear solid + geometry, or `Err` for invalid parameters.
153
- */
154
- export const makeInternalGear = wrapGuarded('makeInternalGear', vendoredMakeInternalGear);
155
- /**
156
- * Build a planetary gear train (sun + planets + ring).
157
- * @param params - the planetary-gear parameters.
158
- * @returns `Ok` with the sun/planet/ring solids and mesh diagnostics, or `Err`.
159
- */
160
- export const makePlanetaryGear = wrapGuarded('makePlanetaryGear', vendoredMakePlanetaryGear);
161
- /**
162
- * Build a helical screw-thread ridge.
163
- * @param options - the thread profile (`radius`, `pitch`, `height`, …).
164
- * @returns `Ok` with the thread-ridge solid, or `Err` for invalid parameters.
165
- */
166
- export const thread = wrapGuarded('thread', vendoredThread);
167
- // ─────────────────────────────────────────────────────────────────────────────
168
- // ② sub-shape queries + measurements
169
- // ─────────────────────────────────────────────────────────────────────────────
170
- export { getEdges, getFaces, getWires, getVertices, getShells, getSolids, getCompSolids, getBounds, vertexPosition, } from '../../vendored/brepjs/topology/topologyQueryFns.js';
171
- export { measureVolume, measureArea, measureLength, } from '../../vendored/brepjs/measurement/measureFns.js';
172
- // ─────────────────────────────────────────────────────────────────────────────
173
- // ③ sketching DSL + drawing factories
174
- // ─────────────────────────────────────────────────────────────────────────────
175
- export { default as Sketcher } from '../../vendored/brepjs/sketching/sketcher.js';
176
- export { default as FaceSketcher } from '../../vendored/brepjs/sketching/faceSketcher.js';
177
- export { drawCircle, drawEllipse, drawRoundedRectangle, drawRectangle, drawSingleCircle, drawSingleEllipse, drawPolysides, drawText, } from '../../vendored/brepjs/sketching/drawingFactories.js';
178
- export { draw } from '../../vendored/brepjs/sketching/drawingPen.js';
179
- export { makeBaseBox } from '../../vendored/brepjs/sketching/shortcuts.js';
180
- // ─────────────────────────────────────────────────────────────────────────────
181
- // ④ combinators / pure helpers / types
182
- // ─────────────────────────────────────────────────────────────────────────────
183
- export { ok, err, isOk, isErr, unwrap, unwrapOr, map, andThen, } from '../../vendored/brepjs/core/result.js';
184
- export { vecAdd, vecSub, vecScale, vecDot, vecCross, vecLength, vecNormalize, } from '../../vendored/brepjs/core/vecOps.js';
185
- export { createPlane, createNamedPlane, resolvePlane, } from '../../vendored/brepjs/core/planeOps.js';
186
- export { kernelError, validationError } from '../../vendored/brepjs/core/errors.js';
187
- export { DEG2RAD, RAD2DEG } from '../../vendored/brepjs/core/constants.js';
188
- // ─────────────────────────────────────────────────────────────────────────────
189
- // ⑤ raw 2D-morph + transform + face ports (P25: sheetmetal 单一说明符面)
190
- //
191
- // The sheetmetal authoring path consumes the vendored morph semantics exactly
192
- // (handles in, handles out, `Result` only where the vendored chain returns
193
- // one). These are projected verbatim from the ported tree — same names, same
194
- // signatures as upstream brepjs — so portable library sources only change the
195
- // import specifier line (§8.2).
196
- // ─────────────────────────────────────────────────────────────────────────────
197
- import { line as rawLine, wire as rawWire, wireLoop as rawWireLoop, face as rawFace, polygon as rawPolygon, } from '../../vendored/brepjs/topology/primitiveFns.js';
198
- import { outerWire as rawOuterWire, getSurfaceType as rawSurfaceType, pointOnSurface as rawPointOnSurface, normalAt as rawNormalAt, faceCenter as rawFaceCenter, } from '../../vendored/brepjs/topology/faceFns.js';
199
- import { sharedEdges as rawSharedEdges } from '../../vendored/brepjs/topology/adjacencyFns.js';
200
- import { curveStartPoint as rawCurveStartPoint, curveEndPoint as rawCurveEndPoint, } from '../../vendored/brepjs/topology/curveFns.js';
201
- import { translate as rawTranslate } from '../../vendored/brepjs/topology/transformFns.js';
202
- import { rotate as rawRotate } from '../../vendored/brepjs/topology/transformFns.js';
203
- import { isSolid as rawIsSolid } from '../../vendored/brepjs/core/shapeTypes.js';
204
- import { isPlanarWire as rawIsPlanarWire } from '../../vendored/brepjs/core/validityTypes.js';
205
- import { isValid as rawIsValid } from '../../vendored/brepjs/topology/healingFns.js';
206
- export { rawLine as line, rawWire as wire, rawWireLoop as wireLoop, rawFace as face, rawPolygon as polygon, rawOuterWire as outerWire, rawSurfaceType as getSurfaceType, rawPointOnSurface as pointOnSurface, rawNormalAt as normalAt, rawFaceCenter as faceCenter, rawSharedEdges as sharedEdges, rawCurveStartPoint as curveStartPoint, rawCurveEndPoint as curveEndPoint, rawTranslate as translate, rawIsSolid as isSolid, rawIsPlanarWire as isPlanarWire, rawIsValid as isValid, };
207
- // Upstream brepjs 18's `rotate` takes an axis through an `{ at, axis }` options
208
- // object; the vendored tree (P5-locked commit) is the four-argument positional
209
- // form. Export the upstream-aligned wrap so library code written for brepjs
210
- // rotates with `rotate(shape, angle, { at?, axis? })`.
211
- /**
212
- * Rotate a shape by an angle in degrees around an axis.
213
- * @param shape - The shape to rotate.
214
- * @param angle - Rotation angle in degrees.
215
- * @param options - Axis and pivot (`at`) for the rotation; defaults to the Z
216
- * axis through the origin, matching upstream brepjs.
217
- * @returns A new rotated shape.
218
- */
219
- export function rotate(shape, angle, options = {}) {
220
- return rawRotate(shape, angle, options.at ?? [0, 0, 0], options.axis ?? [0, 0, 1]);
221
- }
222
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/compat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAOzD;;;;;;;GAOG;AACH,SAAS,QAAQ,CACf,IAAY,EACZ,MAAgB,EAChB,IAA+B;IAE/B,OAAO,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAqC,CAAC,CAAA;AAChF,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAI,IAAY,EAAE,IAAO;IAC3C,MAAM,EAAE,GAAoC,CAAC,GAAG,IAAe,EAAE,EAAE;QACjE,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACvB,OAAQ,IAAwC,CAAC,GAAG,IAAI,CAAC,CAAA;IAC3D,CAAC,CAAA;IACD,OAAO,EAAkB,CAAA;AAC3B,CAAC;AAED,gFAAgF;AAChF,uCAAuC;AACvC,gFAAgF;AAEhF,OAAO,EACL,GAAG,IAAI,YAAY,EACnB,MAAM,IAAI,eAAe,EACzB,QAAQ,IAAI,iBAAiB,EAC7B,IAAI,IAAI,aAAa,EACrB,KAAK,IAAI,cAAc,EACvB,SAAS,IAAI,kBAAkB,GAChC,MAAM,gDAAgD,CAAA;AA+BvD,MAAM,UAAU,GAAG,CAAC,GAAG,IAAe;IACpC,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACxB,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA4B,CAAA;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CA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,IAAI,EACf,UAAU,IAAI,OAAO,EACrB,YAAY,IAAI,SAAS,EACzB,cAAc,IAAI,cAAc,EAChC,iBAAiB,IAAI,cAAc,EACnC,WAAW,IAAI,QAAQ,EACvB,aAAa,IAAI,UAAU,EAC3B,cAAc,IAAI,WAAW,EAC7B,kBAAkB,IAAI,eAAe,EACrC,gBAAgB,IAAI,aAAa,EACjC,YAAY,IAAI,SAAS,EACzB,UAAU,IAAI,OAAO,EACrB,eAAe,IAAI,YAAY,EAC/B,UAAU,IAAI,OAAO,GACtB,CAAA;AAED,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,uDAAuD;AACvD;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CACpB,KAAQ,EACR,KAAa,EACb,UAAsC,EAAE;IAExC,OAAO,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC","sourcesContent":["/**\n * BREP-TS compatibility surface (P21).\n *\n * Projects the vendored BREP TS tree onto four stable groups so library authors\n * can write `import { box, fuse, Sketcher, ok } from this module` and call it\n * upstream-style:\n *\n * ① op — solid primitives + boolean / evolution operations\n * ② topology — sub-shape queries + measurements (plus the Bounds3D type)\n * ③ sketching — stateful Sketcher / FaceSketcher DSL + drawing factories\n * ④ combinators / types — result, vector, plane, errors, constants, types\n *\n * Every symbol is a projection (re-export or a thin dual-form wrapper) from the\n * ported tree: no reimplementation. The `.js` specifiers are the repo\n * convention (TypeScript maps `.js` → `.ts`).\n *\n * Semantic wraps (P23: both live in `api/internal/compat-projection.ts` so the\n * generated face and this hand-curated face share one mechanism):\n * - single-kernel assert: every modeling op asserts a bound BREP kernel first\n * (see `assertKernelBound`); `getBackends()` may throw before configuration,\n * so it is guarded and falls back to the occt-kernel binding flag.\n * - dual argument forms: object form normalizes to positional form via the\n * shared `resolveArgs` discriminant; object keys outside the declared\n * parameter table throw the shared `E_ARGS_FORM` token.\n * - `box` is the hand-written dual-form sample: positional\n * `box(width, depth, height)` and `box({ size })` / `box({ width, depth,\n * height })` both forward to the vendored primitive in its native dimension\n * order (width = X, depth = Y, height = Z — confirm against\n * `primitiveFns#box`), so every accepted form yields identical geometry.\n */\n\nimport { assertKernelBound, projectBrepOp } from '../internal/compat-projection'\nimport { isObjectForm } from '../internal/dual-form-args'\n\nimport type { ValidSolid } from '../../vendored/brepjs/core/shapeTypes.js'\n\n/** Signature of a compat op projection (inputs normalized before the call). */\ntype CompatOp = (...args: unknown[]) => unknown\n\n/**\n * Dual-form op wrapper (A-class): asserts the kernel, normalizes object form to\n * positional form via `resolveArgs`, then delegates to the vendored\n * implementation.\n *\n * P23: delegates to the shared {@link projectBrepOp} so the hand-curated face\n * and the generated face share one projection mechanism (§4.3.2).\n */\nfunction wrapDual<R>(\n name: string,\n params: string[],\n impl: (...args: unknown[]) => R\n): CompatOp {\n return projectBrepOp(name, params, 'A', impl as (...args: never[]) => unknown)\n}\n\n/**\n * Guard-only wrapper: forwards the arguments unchanged after the kernel assert.\n * Used for positional-first ops (booleans, evolutions) whose first argument is\n * a shape, so the object-form discriminant never applies. The exact function\n * type `F` (including its parameter and Result types) is preserved.\n */\nfunction wrapGuarded<F>(name: string, impl: F): F {\n const fn: (...args: unknown[]) => unknown = (...args: unknown[]) => {\n assertKernelBound(name)\n return (impl as (...args: unknown[]) => unknown)(...args)\n }\n return fn as unknown as F\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ① primitives + booleans + evolutions\n// ─────────────────────────────────────────────────────────────────────────────\n\nimport {\n box as primitiveBox,\n sphere as primitiveSphere,\n cylinder as primitiveCylinder,\n cone as primitiveCone,\n torus as primitiveTorus,\n ellipsoid as primitiveEllipsoid,\n} from '../../vendored/brepjs/topology/primitiveFns.js'\n\n/**\n * Create a solid box.\n *\n * Positional form `box(width, depth, height)` uses the vendor's native\n * dimension order — X = width, Y = depth,\n * Z = height (the vendored `primitiveFns#box` dimension order; width/height are\n * NOT swapped). See the overload below for the object form.\n *\n * @param width - side length along X.\n * @param depth - side length along Y.\n * @param height - side length along Z.\n * @returns a new valid solid box.\n */\nexport function box(width: number, depth: number, height: number): ValidSolid\n/**\n * Create a solid box from an object form.\n *\n * Accepts `box({ size })` where `size` is a number (cube) or a\n * `[width, depth, height]` triple, or `box({ width, depth, height })`. Every\n * accepted form forwards to `primitiveBox(width, depth, height)`, so equal\n * dimension values always produce identical geometry.\n *\n * @param options - the dimension set: `size` (a cube edge or a triple) or\n * `width`/`depth`/`height` sides.\n * @returns a new valid solid box.\n * @throws An `Error` whose message contains the shared `E_ARGS_FORM` token when\n * no form matches (e.g. `box('x')`, `box()`, or unknown object keys).\n */\nexport function box(options: BoxDimensions): ValidSolid\nexport function box(...args: unknown[]): ValidSolid {\n assertKernelBound('box')\n if (isObjectForm(args)) {\n const obj = args[0] as Record<string, unknown>\n const keys = Object.keys(obj)\n const unknownKeys = keys.filter((k) => !['size', 'width', 'depth', 'height'].includes(k))\n if (unknownKeys.length > 0) throw boxArgError(args)\n const size = obj.size\n if (size !== undefined) {\n if (typeof size === 'number') return primitiveBox(size, size, size)\n if (Array.isArray(size) && size.length === 3) {\n const [w, d, h] = size as [number, number, number]\n return primitiveBox(w, d, h)\n }\n throw boxArgError(args)\n }\n const width = obj.width\n const depth = obj.depth\n const height = obj.height\n if (typeof width === 'number' && typeof depth === 'number' && typeof height === 'number') {\n return primitiveBox(width, depth, height)\n }\n throw boxArgError(args)\n }\n if (args.length === 3 && args.every((a) => typeof a === 'number')) {\n const [w, d, h] = args as [number, number, number]\n return primitiveBox(w, d, h)\n }\n throw boxArgError(args)\n}\n\n/** Object-form input accepted by {@link box}. */\nexport interface BoxDimensions {\n /** All three sides as one number (cube) or a `[width, depth, height]` triple. */\n size?: number | [number, number, number]\n /** Side length along X. */\n width?: number\n /** Side length along Y. */\n depth?: number\n /** Side length along Z. */\n height?: number\n}\n\n/** Shared E_ARGS_FORM error for {@link box} argument mismatches. */\nfunction boxArgError(args: unknown[]): Error {\n return new Error(\n '[compat:box] E_ARGS_FORM: expected box(width, depth, height), ' +\n \"box({ size: number | [w, d, h] }) or box({ width, depth, height }); got \" +\n args.map((a) => safeJson(a)).join(', ')\n )\n}\n\n/** JSON stringification that never throws on cyclic or exotic values. */\nfunction safeJson(v: unknown): string {\n try {\n return JSON.stringify(v) ?? String(v)\n } catch {\n return '[unserializable]'\n }\n}\n\n/**\n * Project the vendored `sphere(radius, options?)` verbatim (P25: the raw\n * morph form is what portable libraries call — upstream brepjs signatures,\n * no op projection).\n */\nexport { primitiveSphere as sphere }\n/** Project the vendored `cylinder(radius, height, options?)` verbatim. */\nexport { primitiveCylinder as cylinder }\n/** Project the vendored `cone(bottomRadius, topRadius, height, options?)`. */\nexport const cone = wrapDual(\n 'cone',\n ['bottomRadius', 'topRadius', 'height'],\n primitiveCone as CompatOp\n)\n/** Project the vendored `torus(majorRadius, minorRadius, options?)`. */\nexport const torus = wrapDual('torus', ['majorRadius', 'minorRadius'], primitiveTorus as CompatOp)\n/** Project the vendored `ellipsoid(rx, ry, rz, options?)`. */\nexport const ellipsoid = wrapDual('ellipsoid', ['rx', 'ry', 'rz'], primitiveEllipsoid as CompatOp)\n\nimport {\n fuse as vendoredFuse,\n cut as vendoredCut,\n intersect as vendoredIntersect,\n} from '../../vendored/brepjs/topology/api.js'\nimport {\n extrude as vendoredExtrude,\n revolve as vendoredRevolve,\n loft as vendoredLoft,\n} from '../../vendored/brepjs/operations/api.js'\n\n/** Fuse two shapeables into one 3D result. */\nexport const fuse = wrapGuarded('fuse', vendoredFuse)\n/** Cut the second shapeable out of the first. */\nexport const cut = wrapGuarded('cut', vendoredCut)\n/** Extrude a planar profile along a height or direction vector. */\nexport const extrude = wrapGuarded('extrude', vendoredExtrude)\n/** Revolve a planar profile around an axis with optional angle. */\nexport const revolve = wrapGuarded('revolve', vendoredRevolve)\n/** Loft through a set of wire profiles. */\nexport const loft = wrapGuarded('loft', vendoredLoft)\n\n/** Intersect two shapeables (common 3D volume). */\nexport const intersect = wrapGuarded('intersect', vendoredIntersect)\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ①b library-building factories (P24, §8.1): spur gears, planetary trains, threads.\n// Both morphs of these factories are brep-only builders gated by the single-kernel\n// assert (wrapGuarded); the kernel is bound at the host boundary (D10).\n// ─────────────────────────────────────────────────────────────────────────────\n\nimport {\n makeExternalGear as vendoredMakeExternalGear,\n makeInternalGear as vendoredMakeInternalGear,\n makePlanetaryGear as vendoredMakePlanetaryGear,\n} from '../../vendored/brepjs/gear/gearFns.js'\nimport { thread as vendoredThread } from '../../vendored/brepjs/operations/threadFns.js'\n\n/**\n * Build an external spur gear.\n * @param params - the external-gear parameters (`teeth`, `moduleSize`, `thickness`, …).\n * @returns `Ok` with the gear solid + geometry, or `Err` for invalid parameters.\n */\nexport const makeExternalGear = wrapGuarded('makeExternalGear', vendoredMakeExternalGear)\n/**\n * Build an internal (ring) spur gear.\n * @param params - the internal-gear parameters, including the optional ring wall thickness.\n * @returns `Ok` with the gear solid + geometry, or `Err` for invalid parameters.\n */\nexport const makeInternalGear = wrapGuarded('makeInternalGear', vendoredMakeInternalGear)\n/**\n * Build a planetary gear train (sun + planets + ring).\n * @param params - the planetary-gear parameters.\n * @returns `Ok` with the sun/planet/ring solids and mesh diagnostics, or `Err`.\n */\nexport const makePlanetaryGear = wrapGuarded('makePlanetaryGear', vendoredMakePlanetaryGear)\n/**\n * Build a helical screw-thread ridge.\n * @param options - the thread profile (`radius`, `pitch`, `height`, …).\n * @returns `Ok` with the thread-ridge solid, or `Err` for invalid parameters.\n */\nexport const thread = wrapGuarded('thread', vendoredThread)\n\nexport type {\n ExternalGearParams,\n InternalGearParams,\n PlanetaryGearParams,\n GearResult,\n PlanetaryGearAssembly,\n} from '../../vendored/brepjs/gear/gearFns.js'\nexport type { ThreadOptions } from '../../vendored/brepjs/operations/threadFns.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ② sub-shape queries + measurements\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport {\n getEdges,\n getFaces,\n getWires,\n getVertices,\n getShells,\n getSolids,\n getCompSolids,\n getBounds,\n vertexPosition,\n} from '../../vendored/brepjs/topology/topologyQueryFns.js'\n\nexport type { Bounds3D } from '../../vendored/brepjs/topology/topologyQueryFns.js'\n\nexport {\n measureVolume,\n measureArea,\n measureLength,\n} from '../../vendored/brepjs/measurement/measureFns.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ③ sketching DSL + drawing factories\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport { default as Sketcher } from '../../vendored/brepjs/sketching/sketcher.js'\nexport { default as FaceSketcher } from '../../vendored/brepjs/sketching/faceSketcher.js'\n\nexport {\n drawCircle,\n drawEllipse,\n drawRoundedRectangle,\n drawRectangle,\n drawSingleCircle,\n drawSingleEllipse,\n drawPolysides,\n drawText,\n} from '../../vendored/brepjs/sketching/drawingFactories.js'\n\nexport { draw } from '../../vendored/brepjs/sketching/drawingPen.js'\nexport { makeBaseBox } from '../../vendored/brepjs/sketching/shortcuts.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ④ combinators / pure helpers / types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport {\n ok,\n err,\n isOk,\n isErr,\n unwrap,\n unwrapOr,\n map,\n andThen,\n} from '../../vendored/brepjs/core/result.js'\nexport type { Result, Ok, Err } from '../../vendored/brepjs/core/result.js'\n\nexport {\n vecAdd,\n vecSub,\n vecScale,\n vecDot,\n vecCross,\n vecLength,\n vecNormalize,\n} from '../../vendored/brepjs/core/vecOps.js'\n\nexport {\n createPlane,\n createNamedPlane,\n resolvePlane,\n} from '../../vendored/brepjs/core/planeOps.js'\n\nexport { kernelError, validationError } from '../../vendored/brepjs/core/errors.js'\nexport type { BrepError } from '../../vendored/brepjs/core/errors.js'\n\nexport { DEG2RAD, RAD2DEG } from '../../vendored/brepjs/core/constants.js'\n\nexport type {\n Vertex,\n Edge,\n Wire,\n Face,\n Shell,\n Solid,\n CompSolid,\n Shape3D,\n ValidSolid,\n ClosedWire,\n AnyShape,\n} from '../../vendored/brepjs/core/shapeTypes.js'\n\nexport type { GearGeometry } from '../../vendored/brepjs/gear/gearMath.js'\n\nexport type { Plane, PlaneName, PlaneInput } from '../../vendored/brepjs/core/planeTypes.js'\n\nexport type { Vec3, PointInput } from '../../vendored/brepjs/core/types.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ⑤ raw 2D-morph + transform + face ports (P25: sheetmetal 单一说明符面)\n//\n// The sheetmetal authoring path consumes the vendored morph semantics exactly\n// (handles in, handles out, `Result` only where the vendored chain returns\n// one). These are projected verbatim from the ported tree — same names, same\n// signatures as upstream brepjs — so portable library sources only change the\n// import specifier line (§8.2).\n// ─────────────────────────────────────────────────────────────────────────────\n\nimport {\n line as rawLine,\n wire as rawWire,\n wireLoop as rawWireLoop,\n face as rawFace,\n polygon as rawPolygon,\n} from '../../vendored/brepjs/topology/primitiveFns.js'\nimport {\n outerWire as rawOuterWire,\n getSurfaceType as rawSurfaceType,\n pointOnSurface as rawPointOnSurface,\n normalAt as rawNormalAt,\n faceCenter as rawFaceCenter,\n} from '../../vendored/brepjs/topology/faceFns.js'\nimport { sharedEdges as rawSharedEdges } from '../../vendored/brepjs/topology/adjacencyFns.js'\nimport {\n curveStartPoint as rawCurveStartPoint,\n curveEndPoint as rawCurveEndPoint,\n} from '../../vendored/brepjs/topology/curveFns.js'\nimport { translate as rawTranslate } from '../../vendored/brepjs/topology/transformFns.js'\nimport { rotate as rawRotate } from '../../vendored/brepjs/topology/transformFns.js'\nimport { isSolid as rawIsSolid } from '../../vendored/brepjs/core/shapeTypes.js'\nimport { isPlanarWire as rawIsPlanarWire } from '../../vendored/brepjs/core/validityTypes.js'\nimport { isValid as rawIsValid } from '../../vendored/brepjs/topology/healingFns.js'\nimport type { AnyShape } from '../../vendored/brepjs/core/shapeTypes.js'\nimport type { Vec3 } from '../../vendored/brepjs/core/types.js'\n\nexport {\n rawLine as line,\n rawWire as wire,\n rawWireLoop as wireLoop,\n rawFace as face,\n rawPolygon as polygon,\n rawOuterWire as outerWire,\n rawSurfaceType as getSurfaceType,\n rawPointOnSurface as pointOnSurface,\n rawNormalAt as normalAt,\n rawFaceCenter as faceCenter,\n rawSharedEdges as sharedEdges,\n rawCurveStartPoint as curveStartPoint,\n rawCurveEndPoint as curveEndPoint,\n rawTranslate as translate,\n rawIsSolid as isSolid,\n rawIsPlanarWire as isPlanarWire,\n rawIsValid as isValid,\n}\n\n// Upstream brepjs 18's `rotate` takes an axis through an `{ at, axis }` options\n// object; the vendored tree (P5-locked commit) is the four-argument positional\n// form. Export the upstream-aligned wrap so library code written for brepjs\n// rotates with `rotate(shape, angle, { at?, axis? })`.\n/**\n * Rotate a shape by an angle in degrees around an axis.\n * @param shape - The shape to rotate.\n * @param angle - Rotation angle in degrees.\n * @param options - Axis and pivot (`at`) for the rotation; defaults to the Z\n * axis through the origin, matching upstream brepjs.\n * @returns A new rotated shape.\n */\nexport function rotate<T extends AnyShape>(\n shape: T,\n angle: number,\n options: { at?: Vec3; axis?: Vec3 } = {}\n): T {\n return rawRotate(shape, angle, options.at ?? [0, 0, 0], options.axis ?? [0, 0, 1]);\n}"]}
@@ -1,110 +0,0 @@
1
- /**
2
- * stdlib compound — group/assembly 库函数(compound Shape + AssemblyBehavior)
3
- *
4
- *
5
- * 从 src/ops/assemble.ts 迁出并改写为 stdlib 形态:
6
- * - `group(params)` → compound Shape(kind='compound',children 为成员 Shape 引用)
7
- * - `assembly(params)` → compound Shape + AssemblyBehavior(约束列表 + solve 方法)
8
- * - 装配求解(P1 起)委派 api/assembly/(brepjs solverAdapter 内核):
9
- * do_assemble/solve 触发求解 → 引擎应用
10
- * (mesh 顶点烘焙 + BREP 刚体变换 + 下游传播)。
11
- * P2-f5:旧装配算法与自有四元数实现已删除,求解全链路走 api/assembly。
12
- *
13
- * compound 自身无独立 mesh——几何由 children 承载,意义是结构(层级)。
14
- * do_assemble 编译为 `await ctx.<asm>.do_assemble()`:调用 compound 的求解方法,
15
- * 对约束定位的成员施加装配变换(mesh 顶点烘焙 + BREP 刚体变换 + 下游传播)。
16
- */
17
- import type { Shape } from '../mesh/types.js';
18
- import { type CompoundShape } from '../shape.js';
19
- import { type AssemblyTransform } from '../runtime-state.js';
20
- import { type AssemblySolveResult } from './assembly/solve.js';
21
- import { type JointSpec } from './assembly/joints.js';
22
- import type { AssemblyConstraint } from './assembly/types.js';
23
- import type { SolverStyle } from './assembly/solvers/types.js';
24
- /** Parameters for the `group` stdlib function: an optional name and ordered members. */
25
- export interface GroupParams {
26
- name?: string;
27
- /** Compound members: read-only references, never mutated by group/assembly. */
28
- members?: Shape[];
29
- memberNames?: string[];
30
- }
31
- /** Parameters for the `assembly` stdlib function: group params plus assembly constraints. */
32
- export interface AssemblyParams extends GroupParams {
33
- constraints?: AssemblyConstraint[];
34
- /** P3:运动副声明(可选;parent/child 必须是 members 里的名字)。 */
35
- joints?: JointSpec[];
36
- /** P3:驱动值覆盖(键 = child 成员名;值 = 主 DOF 数值或多 DOF 数组)。 */
37
- drive?: Record<string, number | number[]>;
38
- /** cq-compat:成员颜色(sRGB 0..1),导出 STEP 时写入 XCAF。 */
39
- memberColors?: Record<string, [number, number, number]>;
40
- /** P1:求解风格。'chain'(默认,vendored brepjs 解析链式)| 'global'(CadQuery 兼容全局最小二乘)。 */
41
- solver?: SolverStyle;
42
- }
43
- export type { AssemblyConstraint, FaceMateConstraint, FaceMateFace, EntityRef, FaceRef, EdgeRef, MateConstraint, AlignConstraint, CoincidentConstraint, ConcentricConstraint, DistanceConstraint, AngleConstraint, ParallelConstraint, PerpendicularConstraint, FixedConstraint, StructuralConstraint, AssemblyVec3, } from './assembly/types.js';
44
- export type { AssemblySolveResult } from './assembly/solve.js';
45
- export { applyTransform } from '../mesh/rigid-transform.js';
46
- /** Behavior attached to an assembly compound: its members, constraints, and solver. */
47
- export interface AssemblyBehavior {
48
- name?: string;
49
- memberNames: string[];
50
- constraints: AssemblyConstraint[];
51
- /** P3:运动副声明(无 joints 时为空数组)。 */
52
- joints?: JointSpec[];
53
- /** P3:驱动值覆盖(键 = child 成员名;缺省 undefined = 用 joint 存储值)。 */
54
- drive?: Record<string, number | number[]>;
55
- /** cq-compat:成员颜色(sRGB 0..1)。 */
56
- memberColors?: Record<string, [number, number, number]>;
57
- /** P1:求解风格。 */
58
- solver?: SolverStyle;
59
- /** 只求解(P6):返回"成员下标 → 变换"列表。不改写入参、不传播;可重复调用(幂等)。 */
60
- solve(): AssemblyTransform[];
61
- /** 只求解并带诊断量(P1):transforms + dof/converged/unsupported(方案 P1⑤);P3 增 kinematics/warnings。 */
62
- solveDetailed(): AssemblySolveResult;
63
- }
64
- /**
65
- * `cad.group({ name, members })` → compound Shape。
66
- * members 是成员 Shape(编译产物 ctx.<var> 引用),成员名经 keep() 反查。
67
- *
68
- * 函数体 keep 声明(keep-syntax 设计 §2.5):group 保留其成员且可见(R6)。
69
- */
70
- /**
71
- * 分组:零约束,保持当前布局。结构语句,无几何输出,成员用变量名引用。
72
- * @group 结构
73
- * @inputs 1
74
- * @async false
75
- * @qual ok
76
- * @name group
77
- * @deprecated **`../3d_editor` 消费面**(原 `@deprecated` 措辞已于 2026-09-22 校正):该 op 为编辑器应用提供(无几何输出,服务于编辑器画布与时间线),不属 faijs 平台面,但**不是废弃项**——它服务真实负载。**变更其 API 形态必须同步更新 `../3d_editor`**(见 `docs/plans/2026-09-22-topology-identity-development-plan.md` §2)。**平台侧需要几何复合体请用 `cad.compound`**(内核 `makeCompound`,持 OCCT 句柄,可变换/可导出)。
78
- * @returns CompoundShape 复合几何(kind='compound',children 为成员 Shape 引用)。
79
- * @param params.name - 组名。type:string
80
- * @param params.members - 成员(编译产物 ctx.<var> 引用;结构语句里是裸变量引用,非字符串数组)。type:Shape[]
81
- * @note members 在 .fai.js 里是裸变量引用(编译为 ctx.<var>),字符串数组形态的成员名经 keep() 反查兼容历史 IR。
82
- * @example
83
- * const part0 = cad.box(30, 20, 10, { centered: true })
84
- * cad.group({ name: '底板组', members: [part0] })
85
- */
86
- export declare function group(params: GroupParams): CompoundShape;
87
- /**
88
- * 装配:成员 + 约束。结构语句,无几何输出,成员用变量名引用、实体用 EntityRef / 拓扑引用。
89
- * 求解内核复用 vendored brepjs solverAdapter.solveConstraints(链式拓扑调度 / DOF / converged /
90
- * unsupported 诊断);输出为 per-member 终态变换(每成员一条,恒等位姿不输出)。
91
- * @group 结构
92
- * @inputs 1
93
- * @async false
94
- * @qual warn
95
- * @name assembly
96
- * @deprecated **`../3d_editor` 消费面**(原 `@deprecated` 措辞已于 2026-09-22 校正):该 op 为编辑器应用提供(成员以编辑器结构语句形态声明,服务于画布与时间线),不属 faijs 平台面,但**不是废弃项**——它服务真实负载。**变更其 API 形态必须同步更新 `../3d_editor`**(见 `docs/plans/2026-09-22-topology-identity-development-plan.md` §2)。faijs 平台面不提供等价 op(需要时须按平台需求另行设计,不得直接搬用本 op)。
97
- * @returns CompoundShape + AssemblyBehavior(含 do_assemble / solve 方法)。
98
- * @note 约束类型(a=参考、b=从动,移动 b 去贴合 a):`mate` 面对面贴合(法向反向+面中心重合,遗留 face_mate 的新名,求解降级为 concentric + 轴编码);`align` 同向对齐(法向同向+面中心重合);`coincident` 共面/共点/共线(保留面内 2 个平移 DOF);`concentric` 轴重合(孔轴配合,圆柱/圆锥面需 hint.axis,直边/圆边需 EdgeHint.axis);`distance` 定距(mm,带 value);`angle` 夹角(deg,带 value);`parallel`/`perpendicular` 平行/垂直(angle 0°/90° 语法糖);`fixed` 锚定部件(地基);`face_mate` 为遗留别名(规范化为 mate,新代码不再使用)。
99
- * @note EntityRef 四种形态:`{ part, face: { topoRef } | { surfaceType?, center, normal } }`、`{ part, edge: { topoRef } | { axis: { origin, direction } } }`、`{ part, point: [x,y,z] }`、`{ part, faceIndex }`(1 起,仅调试简写)。
100
- * @note 不收敛(实体类型不匹配/环/参考不可达)→ 抛错并带 unsupported 明细;成员名为空串 → 求解前抛错;mesh 快照缺 axis 的圆柱/圆锥面作轴实体 → E_TOPO_NOT_FOUND(绝不静默降级)。`mate`(中心重合)与 `coincident`(只共面)是两种不同语义,不互相映射。
101
- * @note 早期文档/示例曾用 `fixedPartId`/`movingPartId`/`faceRowIndex`/`faceId`/`invalid`——这些键在代码中不存在。真实契约是 `fixedPartName`/`movingPartName` + `fixedFace`/`movingFace`(遗留 face_mate)。`faceId` 字段随 §6.2 移除,不再写入。
102
- * @param params.name - 装配名。type:string
103
- * @param params.members - 成员(裸变量引用)。type:Shape[]
104
- * @param params.constraints - 约束数组(遗留 face_mate 形态或上述新形态 { type, a, b })。type:AssemblyConstraint[]
105
- * @example
106
- * let asm1 = cad.assembly({ name: '主轴组件', members: [part0, part1, part2], constraints: [ { type: 'fixed', part: 'part0' }, { type: 'mate', a: { part: 'part0', face: { topoRef: { kind: 'face', origin: 'part0', role: 'box:top', hint: { kind: 'face', surfaceType: 'plane' } } } }, b: { part: 'part1', face: { topoRef: { kind: 'face', origin: 'part1', role: 'box:bottom', hint: { kind: 'face', surfaceType: 'plane' } } } } }, { type: 'concentric', a: { part: 'part1', face: { topoRef: { kind: 'face', origin: 'part1', role: '', hint: { kind: 'face', surfaceType: 'cylinder' } } } }, b: { part: 'part2', face: { topoRef: { kind: 'face', origin: 'part2', role: 'cylinder:lateral', hint: { kind: 'face', surfaceType: 'cylinder' } } } } } ] })
107
- * asm1.solve()
108
- */
109
- export declare function assembly(params: AssemblyParams): CompoundShape;
110
- //# sourceMappingURL=compound.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compound.d.ts","sourceRoot":"","sources":["../../src/api/compound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAwC,KAAK,aAAa,EAAE,MAAM,UAAU,CA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