fluidcad 0.0.33 → 0.0.35

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 (363) hide show
  1. package/README.md +72 -2
  2. package/bin/commands/init.js +55 -0
  3. package/bin/commands/login.js +120 -0
  4. package/bin/commands/mcp.js +33 -0
  5. package/bin/commands/pack.js +49 -0
  6. package/bin/commands/publish.js +136 -0
  7. package/bin/commands/serve.js +77 -0
  8. package/bin/fluidcad.js +21 -107
  9. package/bin/lib/api-client.js +40 -0
  10. package/bin/lib/browser.js +16 -0
  11. package/bin/lib/config.js +39 -0
  12. package/bin/lib/model-config.js +38 -0
  13. package/bin/lib/workspace.js +57 -0
  14. package/lib/dist/common/scene-object.d.ts +2 -1
  15. package/lib/dist/common/scene-object.js +3 -2
  16. package/lib/dist/common/shape-factory.d.ts +2 -1
  17. package/lib/dist/common/shape-factory.js +4 -0
  18. package/lib/dist/common/transformable-primitive.d.ts +6 -5
  19. package/lib/dist/common/transformable-primitive.js +8 -7
  20. package/lib/dist/common/vertex.js +0 -1
  21. package/lib/dist/core/2d/aline.d.ts +4 -3
  22. package/lib/dist/core/2d/aline.js +3 -2
  23. package/lib/dist/core/2d/arc.d.ts +3 -2
  24. package/lib/dist/core/2d/arc.js +4 -3
  25. package/lib/dist/core/2d/bezier.d.ts +8 -6
  26. package/lib/dist/core/2d/circle.d.ts +4 -3
  27. package/lib/dist/core/2d/circle.js +3 -2
  28. package/lib/dist/core/2d/ellipse.d.ts +5 -4
  29. package/lib/dist/core/2d/ellipse.js +5 -4
  30. package/lib/dist/core/2d/hline.d.ts +4 -3
  31. package/lib/dist/core/2d/hline.js +5 -3
  32. package/lib/dist/core/2d/line.js +1 -0
  33. package/lib/dist/core/2d/offset.d.ts +3 -2
  34. package/lib/dist/core/2d/offset.js +6 -5
  35. package/lib/dist/core/2d/polygon.d.ts +5 -4
  36. package/lib/dist/core/2d/polygon.js +10 -9
  37. package/lib/dist/core/2d/rect.d.ts +4 -3
  38. package/lib/dist/core/2d/rect.js +10 -9
  39. package/lib/dist/core/2d/slot.d.ts +14 -6
  40. package/lib/dist/core/2d/slot.js +19 -8
  41. package/lib/dist/core/2d/tarc.d.ts +20 -2
  42. package/lib/dist/core/2d/tarc.js +24 -0
  43. package/lib/dist/core/2d/vline.d.ts +4 -3
  44. package/lib/dist/core/2d/vline.js +5 -3
  45. package/lib/dist/core/chamfer.d.ts +5 -4
  46. package/lib/dist/core/chamfer.js +7 -6
  47. package/lib/dist/core/color.d.ts +3 -2
  48. package/lib/dist/core/color.js +2 -1
  49. package/lib/dist/core/cut.d.ts +4 -3
  50. package/lib/dist/core/cut.js +5 -4
  51. package/lib/dist/core/cylinder.d.ts +2 -1
  52. package/lib/dist/core/cylinder.js +2 -1
  53. package/lib/dist/core/draft.d.ts +3 -2
  54. package/lib/dist/core/draft.js +3 -2
  55. package/lib/dist/core/extrude.d.ts +4 -3
  56. package/lib/dist/core/extrude.js +5 -4
  57. package/lib/dist/core/fillet.d.ts +5 -4
  58. package/lib/dist/core/fillet.js +6 -5
  59. package/lib/dist/core/index.d.ts +1 -0
  60. package/lib/dist/core/index.js +1 -0
  61. package/lib/dist/core/interfaces.d.ts +55 -25
  62. package/lib/dist/core/param.d.ts +74 -0
  63. package/lib/dist/core/param.js +147 -0
  64. package/lib/dist/core/repeat.d.ts +2 -1
  65. package/lib/dist/core/repeat.js +72 -54
  66. package/lib/dist/core/revolve.d.ts +2 -1
  67. package/lib/dist/core/revolve.js +3 -2
  68. package/lib/dist/core/rib.d.ts +3 -2
  69. package/lib/dist/core/rib.js +6 -2
  70. package/lib/dist/core/rotate.d.ts +5 -4
  71. package/lib/dist/core/rotate.js +4 -3
  72. package/lib/dist/core/shell.d.ts +3 -2
  73. package/lib/dist/core/shell.js +3 -2
  74. package/lib/dist/core/sphere.d.ts +3 -2
  75. package/lib/dist/core/sphere.js +2 -1
  76. package/lib/dist/core/translate.d.ts +7 -6
  77. package/lib/dist/core/translate.js +6 -5
  78. package/lib/dist/features/2d/arc.d.ts +8 -2
  79. package/lib/dist/features/2d/arc.js +94 -17
  80. package/lib/dist/features/2d/back.js +3 -2
  81. package/lib/dist/features/2d/bezier.js +16 -16
  82. package/lib/dist/features/2d/circle.js +4 -0
  83. package/lib/dist/features/2d/ellipse.js +4 -0
  84. package/lib/dist/features/2d/hline.d.ts +3 -0
  85. package/lib/dist/features/2d/hline.js +9 -2
  86. package/lib/dist/features/2d/line.d.ts +3 -0
  87. package/lib/dist/features/2d/line.js +11 -3
  88. package/lib/dist/features/2d/sketch.d.ts +4 -0
  89. package/lib/dist/features/2d/sketch.js +25 -0
  90. package/lib/dist/features/2d/slot.d.ts +5 -0
  91. package/lib/dist/features/2d/slot.js +52 -7
  92. package/lib/dist/features/2d/tarc-constrained.d.ts +2 -0
  93. package/lib/dist/features/2d/tarc-constrained.js +8 -0
  94. package/lib/dist/features/2d/tarc-radius-to-object.d.ts +16 -0
  95. package/lib/dist/features/2d/tarc-radius-to-object.js +58 -0
  96. package/lib/dist/features/2d/tarc-to-object.d.ts +18 -0
  97. package/lib/dist/features/2d/tarc-to-object.js +66 -0
  98. package/lib/dist/features/2d/tarc-to-point-tangent.d.ts +2 -0
  99. package/lib/dist/features/2d/tarc-to-point-tangent.js +6 -0
  100. package/lib/dist/features/2d/tarc-to-point.d.ts +2 -0
  101. package/lib/dist/features/2d/tarc-to-point.js +6 -0
  102. package/lib/dist/features/2d/tarc-with-tangent.d.ts +2 -0
  103. package/lib/dist/features/2d/tarc-with-tangent.js +6 -0
  104. package/lib/dist/features/2d/tarc.d.ts +2 -0
  105. package/lib/dist/features/2d/tarc.js +6 -0
  106. package/lib/dist/features/2d/vline.d.ts +3 -0
  107. package/lib/dist/features/2d/vline.js +9 -2
  108. package/lib/dist/features/copy-circular.d.ts +4 -3
  109. package/lib/dist/features/copy-circular.js +16 -9
  110. package/lib/dist/features/copy-circular2d.js +16 -9
  111. package/lib/dist/features/copy-linear.d.ts +4 -3
  112. package/lib/dist/features/copy-linear.js +18 -12
  113. package/lib/dist/features/copy-linear2d.js +18 -12
  114. package/lib/dist/features/extrude-base.d.ts +13 -3
  115. package/lib/dist/features/extrude-base.js +32 -3
  116. package/lib/dist/features/extrude-to-face.js +1 -5
  117. package/lib/dist/features/extrude-two-distances.js +1 -2
  118. package/lib/dist/features/extrude.js +1 -2
  119. package/lib/dist/features/mirror-feature.d.ts +3 -2
  120. package/lib/dist/features/mirror-feature.js +1 -1
  121. package/lib/dist/features/mirror-shape2d.js +2 -2
  122. package/lib/dist/features/repeat-base.d.ts +13 -0
  123. package/lib/dist/features/repeat-base.js +21 -0
  124. package/lib/dist/features/repeat-circular.d.ts +8 -7
  125. package/lib/dist/features/repeat-circular.js +7 -3
  126. package/lib/dist/features/repeat-linear.d.ts +9 -7
  127. package/lib/dist/features/repeat-linear.js +9 -3
  128. package/lib/dist/features/repeat-matrix.d.ts +3 -1
  129. package/lib/dist/features/repeat-matrix.js +7 -2
  130. package/lib/dist/features/shell.d.ts +4 -1
  131. package/lib/dist/features/shell.js +14 -3
  132. package/lib/dist/helpers/clone-transform.d.ts +2 -1
  133. package/lib/dist/index.d.ts +12 -1
  134. package/lib/dist/index.js +11 -4
  135. package/lib/dist/io/file-import.d.ts +7 -0
  136. package/lib/dist/io/file-import.js +30 -10
  137. package/lib/dist/math/lazy-matrix.d.ts +36 -0
  138. package/lib/dist/math/lazy-matrix.js +134 -0
  139. package/lib/dist/oc/boolean-ops.d.ts +2 -2
  140. package/lib/dist/oc/constraints/constraint-solver-adaptor.d.ts +5 -0
  141. package/lib/dist/oc/constraints/constraint-solver-adaptor.js +16 -0
  142. package/lib/dist/oc/constraints/constraint-solver.d.ts +4 -0
  143. package/lib/dist/oc/constraints/curve/curve-constraint-solver.d.ts +4 -0
  144. package/lib/dist/oc/constraints/curve/curve-constraint-solver.js +3 -0
  145. package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.d.ts +6 -1
  146. package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.js +4 -0
  147. package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.d.ts +8 -0
  148. package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.js +111 -0
  149. package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.d.ts +8 -0
  150. package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.js +161 -0
  151. package/lib/dist/oc/mesh.d.ts +9 -4
  152. package/lib/dist/oc/mesh.js +14 -13
  153. package/lib/dist/oc/shell-ops.d.ts +2 -1
  154. package/lib/dist/oc/shell-ops.js +5 -2
  155. package/lib/dist/param-registry.d.ts +34 -0
  156. package/lib/dist/param-registry.js +60 -0
  157. package/lib/dist/rendering/mesh-builder.d.ts +3 -0
  158. package/lib/dist/rendering/mesh-builder.js +10 -5
  159. package/lib/dist/rendering/render-edge.d.ts +2 -1
  160. package/lib/dist/rendering/render-edge.js +2 -2
  161. package/lib/dist/rendering/render-face.d.ts +2 -1
  162. package/lib/dist/rendering/render-face.js +2 -2
  163. package/lib/dist/rendering/render-solid.d.ts +2 -1
  164. package/lib/dist/rendering/render-solid.js +2 -2
  165. package/lib/dist/rendering/render-wire.d.ts +2 -1
  166. package/lib/dist/rendering/render-wire.js +2 -2
  167. package/lib/dist/rendering/render.d.ts +3 -0
  168. package/lib/dist/rendering/render.js +7 -2
  169. package/lib/dist/scene-manager.d.ts +4 -2
  170. package/lib/dist/scene-manager.js +12 -4
  171. package/lib/dist/tests/features/2d/arc.test.js +64 -0
  172. package/lib/dist/tests/features/2d/back.test.js +17 -1
  173. package/lib/dist/tests/features/2d/tarc.test.js +157 -0
  174. package/lib/dist/tests/features/copy-circular.test.js +1 -1
  175. package/lib/dist/tests/features/copy-linear.test.js +10 -10
  176. package/lib/dist/tests/features/repeat-user-repro-cache.test.d.ts +1 -0
  177. package/lib/dist/tests/features/repeat-user-repro-cache.test.js +97 -0
  178. package/lib/dist/tests/features/repeat-user-repro.test.d.ts +1 -0
  179. package/lib/dist/tests/features/repeat-user-repro.test.js +60 -0
  180. package/lib/dist/tests/features/shell.test.js +36 -0
  181. package/lib/dist/tests/global-setup.js +2 -1
  182. package/lib/dist/tests/helpers/extract-blocks.d.ts +9 -0
  183. package/lib/dist/tests/helpers/extract-blocks.js +56 -0
  184. package/lib/dist/tests/llm-docs-examples.test.d.ts +1 -0
  185. package/lib/dist/tests/llm-docs-examples.test.js +62 -0
  186. package/lib/dist/tests/setup.js +2 -1
  187. package/lib/dist/tsconfig.tsbuildinfo +1 -1
  188. package/llm-docs/.coverage-allowlist.txt +9 -0
  189. package/llm-docs/api/arc.md +48 -0
  190. package/llm-docs/api/axis.md +42 -0
  191. package/llm-docs/api/bezier.md +41 -0
  192. package/llm-docs/api/booleans.md +44 -0
  193. package/llm-docs/api/chamfer.md +40 -0
  194. package/llm-docs/api/circle.md +36 -0
  195. package/llm-docs/api/color.md +34 -0
  196. package/llm-docs/api/connect.md +41 -0
  197. package/llm-docs/api/constraint-qualifiers.md +48 -0
  198. package/llm-docs/api/copy.md +63 -0
  199. package/llm-docs/api/cursor-lines.md +50 -0
  200. package/llm-docs/api/cursor-move.md +61 -0
  201. package/llm-docs/api/cut.md +55 -0
  202. package/llm-docs/api/draft.md +36 -0
  203. package/llm-docs/api/edge-filter.md +57 -0
  204. package/llm-docs/api/ellipse.md +34 -0
  205. package/llm-docs/api/extrude.md +74 -0
  206. package/llm-docs/api/face-filter.md +61 -0
  207. package/llm-docs/api/fillet.md +51 -0
  208. package/llm-docs/api/index.json +139 -0
  209. package/llm-docs/api/line.md +42 -0
  210. package/llm-docs/api/load.md +37 -0
  211. package/llm-docs/api/local.md +38 -0
  212. package/llm-docs/api/loft.md +37 -0
  213. package/llm-docs/api/mirror.md +44 -0
  214. package/llm-docs/api/offset.md +36 -0
  215. package/llm-docs/api/part.md +40 -0
  216. package/llm-docs/api/plane.md +44 -0
  217. package/llm-docs/api/polygon.md +37 -0
  218. package/llm-docs/api/primitive-solids.md +39 -0
  219. package/llm-docs/api/project-intersect.md +48 -0
  220. package/llm-docs/api/rect.md +48 -0
  221. package/llm-docs/api/remove.md +32 -0
  222. package/llm-docs/api/repeat.md +79 -0
  223. package/llm-docs/api/revolve.md +38 -0
  224. package/llm-docs/api/rib.md +40 -0
  225. package/llm-docs/api/rotate.md +37 -0
  226. package/llm-docs/api/select.md +41 -0
  227. package/llm-docs/api/shell.md +41 -0
  228. package/llm-docs/api/sketch.md +76 -0
  229. package/llm-docs/api/slot.md +36 -0
  230. package/llm-docs/api/split-trim.md +42 -0
  231. package/llm-docs/api/sweep.md +43 -0
  232. package/llm-docs/api/tarc.md +45 -0
  233. package/llm-docs/api/tcircle.md +38 -0
  234. package/llm-docs/api/tline.md +42 -0
  235. package/llm-docs/api/translate.md +40 -0
  236. package/llm-docs/api/types/aline.md +35 -0
  237. package/llm-docs/api/types/arc-angles.md +29 -0
  238. package/llm-docs/api/types/arc-points.md +48 -0
  239. package/llm-docs/api/types/axis-like.md +38 -0
  240. package/llm-docs/api/types/axis.md +21 -0
  241. package/llm-docs/api/types/boolean-operation.md +50 -0
  242. package/llm-docs/api/types/circular-repeat-options.md +31 -0
  243. package/llm-docs/api/types/common.md +32 -0
  244. package/llm-docs/api/types/cut.md +125 -0
  245. package/llm-docs/api/types/draft.md +21 -0
  246. package/llm-docs/api/types/extrudable-geometry.md +23 -0
  247. package/llm-docs/api/types/extrude.md +194 -0
  248. package/llm-docs/api/types/geometry.md +51 -0
  249. package/llm-docs/api/types/hline.md +35 -0
  250. package/llm-docs/api/types/linear-repeat-options.md +31 -0
  251. package/llm-docs/api/types/loft.md +154 -0
  252. package/llm-docs/api/types/mirror.md +35 -0
  253. package/llm-docs/api/types/offset.md +31 -0
  254. package/llm-docs/api/types/plane-like.md +35 -0
  255. package/llm-docs/api/types/plane-transform-options.md +29 -0
  256. package/llm-docs/api/types/plane.md +21 -0
  257. package/llm-docs/api/types/point-like.md +22 -0
  258. package/llm-docs/api/types/point2dlike.md +26 -0
  259. package/llm-docs/api/types/polygon.md +46 -0
  260. package/llm-docs/api/types/rect.md +128 -0
  261. package/llm-docs/api/types/revolve.md +102 -0
  262. package/llm-docs/api/types/rib.md +133 -0
  263. package/llm-docs/api/types/scene-object.md +33 -0
  264. package/llm-docs/api/types/select.md +21 -0
  265. package/llm-docs/api/types/shell.md +54 -0
  266. package/llm-docs/api/types/slot.md +43 -0
  267. package/llm-docs/api/types/sweep.md +189 -0
  268. package/llm-docs/api/types/tangent-arc-two-objects.md +46 -0
  269. package/llm-docs/api/types/transformable.md +93 -0
  270. package/llm-docs/api/types/trim.md +27 -0
  271. package/llm-docs/api/types/two-objects-tangent-line.md +46 -0
  272. package/llm-docs/api/types/vertex.md +17 -0
  273. package/llm-docs/api/types/vline.md +35 -0
  274. package/llm-docs/concepts/coordinate-system.md +45 -0
  275. package/llm-docs/concepts/history-and-rollback.md +40 -0
  276. package/llm-docs/concepts/last-selection.md +49 -0
  277. package/llm-docs/concepts/scene-graph.md +37 -0
  278. package/llm-docs/index.json +1750 -0
  279. package/mcp/dist/client.d.ts +65 -0
  280. package/mcp/dist/client.js +255 -0
  281. package/mcp/dist/discovery.d.ts +11 -0
  282. package/mcp/dist/discovery.js +78 -0
  283. package/mcp/dist/docs-index.d.ts +81 -0
  284. package/mcp/dist/docs-index.js +261 -0
  285. package/mcp/dist/resources.d.ts +4 -0
  286. package/mcp/dist/resources.js +115 -0
  287. package/mcp/dist/server.d.ts +12 -0
  288. package/mcp/dist/server.js +502 -0
  289. package/mcp/dist/tools/coordination.d.ts +9 -0
  290. package/mcp/dist/tools/coordination.js +46 -0
  291. package/mcp/dist/tools/docs.d.ts +66 -0
  292. package/mcp/dist/tools/docs.js +122 -0
  293. package/mcp/dist/tools/engine.d.ts +72 -0
  294. package/mcp/dist/tools/engine.js +190 -0
  295. package/mcp/dist/tools/inspection.d.ts +75 -0
  296. package/mcp/dist/tools/inspection.js +121 -0
  297. package/mcp/dist/tools/screenshot.d.ts +63 -0
  298. package/mcp/dist/tools/screenshot.js +263 -0
  299. package/mcp/dist/tools/source.d.ts +84 -0
  300. package/mcp/dist/tools/source.js +434 -0
  301. package/mcp/dist/tools/workspaces.d.ts +13 -0
  302. package/mcp/dist/tools/workspaces.js +33 -0
  303. package/mcp/dist/types.d.ts +18 -0
  304. package/mcp/dist/types.js +11 -0
  305. package/package.json +27 -7
  306. package/server/dist/api.d.ts +37 -0
  307. package/server/dist/api.js +44 -0
  308. package/server/dist/code-editor.d.ts +100 -0
  309. package/server/dist/code-editor.js +528 -2
  310. package/server/dist/fluidcad-server.d.ts +118 -1
  311. package/server/dist/fluidcad-server.js +350 -62
  312. package/server/dist/global-registry.d.ts +30 -0
  313. package/server/dist/global-registry.js +126 -0
  314. package/server/dist/host/blocked-imports.d.ts +8 -0
  315. package/server/dist/host/blocked-imports.js +30 -0
  316. package/server/dist/{vite-manager.d.ts → host/local-scene-host.d.ts} +3 -1
  317. package/server/dist/{vite-manager.js → host/local-scene-host.js} +6 -26
  318. package/server/dist/host/scene-host.d.ts +19 -0
  319. package/server/dist/host/scene-host.js +1 -0
  320. package/server/dist/index.js +175 -123
  321. package/server/dist/instance-file.d.ts +31 -0
  322. package/server/dist/instance-file.js +73 -0
  323. package/server/dist/lint-fluid-js.d.ts +15 -0
  324. package/server/dist/lint-fluid-js.js +271 -0
  325. package/server/dist/model-package/capture-params.d.ts +19 -0
  326. package/server/dist/model-package/capture-params.js +42 -0
  327. package/server/dist/model-package/pack.d.ts +23 -0
  328. package/server/dist/model-package/pack.js +229 -0
  329. package/server/dist/model-package/types.d.ts +78 -0
  330. package/server/dist/model-package/types.js +17 -0
  331. package/server/dist/routes/editor.d.ts +24 -0
  332. package/server/dist/routes/editor.js +44 -0
  333. package/server/dist/routes/export.d.ts +1 -1
  334. package/server/dist/routes/export.js +45 -8
  335. package/server/dist/routes/health.d.ts +7 -0
  336. package/server/dist/routes/health.js +14 -0
  337. package/server/dist/routes/hit-test.d.ts +3 -0
  338. package/server/dist/routes/hit-test.js +17 -0
  339. package/server/dist/routes/lint.d.ts +10 -0
  340. package/server/dist/routes/lint.js +28 -0
  341. package/server/dist/routes/pack.d.ts +10 -0
  342. package/server/dist/routes/pack.js +47 -0
  343. package/server/dist/routes/params.d.ts +3 -0
  344. package/server/dist/routes/params.js +75 -0
  345. package/server/dist/routes/render.d.ts +33 -0
  346. package/server/dist/routes/render.js +34 -0
  347. package/server/dist/routes/scene.d.ts +5 -0
  348. package/server/dist/routes/scene.js +48 -0
  349. package/server/dist/routes/screenshot.js +68 -1
  350. package/server/dist/routes/sketch-edits.d.ts +3 -0
  351. package/server/dist/routes/sketch-edits.js +542 -0
  352. package/server/dist/routes/timeline.d.ts +3 -0
  353. package/server/dist/routes/timeline.js +49 -0
  354. package/server/dist/server-core.d.ts +53 -0
  355. package/server/dist/server-core.js +147 -0
  356. package/server/dist/ws-protocol.d.ts +156 -3
  357. package/ui/dist/assets/index-CDJmUpFI.css +2 -0
  358. package/ui/dist/assets/index-MRqwG9Vh.js +5417 -0
  359. package/ui/dist/index.html +2 -2
  360. package/server/dist/routes/actions.d.ts +0 -3
  361. package/server/dist/routes/actions.js +0 -309
  362. package/ui/dist/assets/index-CFi9p7wR.js +0 -4946
  363. package/ui/dist/assets/index-DR7c2Qk9.css +0 -2
@@ -1,27 +1,28 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
3
  import { IExtrudableGeometry, ISceneObject } from "../interfaces.js";
4
+ import { type NumberParam } from "../param.js";
4
5
  interface EllipseFunction {
5
6
  /**
6
7
  * Draws an ellipse at the current position.
7
8
  * @param rx - Semi-radius along the plane's X axis
8
9
  * @param ry - Semi-radius along the plane's Y axis
9
10
  */
10
- (rx: number, ry: number): IExtrudableGeometry;
11
+ (rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
11
12
  /**
12
13
  * Draws an ellipse at a given center.
13
14
  * @param center - The center point
14
15
  * @param rx - Semi-radius along the plane's X axis
15
16
  * @param ry - Semi-radius along the plane's Y axis
16
17
  */
17
- (center: Point2DLike, rx: number, ry: number): IExtrudableGeometry;
18
+ (center: Point2DLike, rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
18
19
  /**
19
20
  * Draws an ellipse on a specific plane.
20
21
  * @param targetPlane - The plane to draw on
21
22
  * @param rx - Semi-radius along the plane's X axis
22
23
  * @param ry - Semi-radius along the plane's Y axis
23
24
  */
24
- (targetPlane: PlaneLike | ISceneObject, rx: number, ry: number): IExtrudableGeometry;
25
+ (targetPlane: PlaneLike | ISceneObject, rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
25
26
  /**
26
27
  * Draws an ellipse at a given center on a specific plane.
27
28
  * @param targetPlane - The plane to draw on
@@ -29,7 +30,7 @@ interface EllipseFunction {
29
30
  * @param rx - Semi-radius along the plane's X axis
30
31
  * @param ry - Semi-radius along the plane's Y axis
31
32
  */
32
- (targetPlane: PlaneLike | ISceneObject, center: Point2DLike, rx: number, ry: number): IExtrudableGeometry;
33
+ (targetPlane: PlaneLike | ISceneObject, center: Point2DLike, rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
33
34
  }
34
35
  declare const _default: EllipseFunction;
35
36
  export default _default;
@@ -7,6 +7,7 @@ import { registerBuilder } from "../../index.js";
7
7
  import { isPlaneLike } from "../../math/plane.js";
8
8
  import { SceneObject } from "../../common/scene-object.js";
9
9
  import { resolvePlane } from "../../helpers/resolve.js";
10
+ import { resolveParam } from "../param.js";
10
11
  function toPoint2D(p) {
11
12
  if (p instanceof Point2D) {
12
13
  return p;
@@ -35,16 +36,16 @@ function build(context) {
35
36
  }
36
37
  const argCount = arguments.length - argOffset;
37
38
  if (argCount === 2) {
38
- const rx = arguments[argOffset];
39
- const ry = arguments[argOffset + 1];
39
+ const rx = resolveParam(arguments[argOffset]);
40
+ const ry = resolveParam(arguments[argOffset + 1]);
40
41
  const e = new Ellipse(rx, ry, planeObj);
41
42
  context.addSceneObject(e);
42
43
  return e;
43
44
  }
44
45
  if (argCount === 3) {
45
46
  const centerArg = arguments[argOffset];
46
- const rx = arguments[argOffset + 1];
47
- const ry = arguments[argOffset + 2];
47
+ const rx = resolveParam(arguments[argOffset + 1]);
48
+ const ry = resolveParam(arguments[argOffset + 2]);
48
49
  if (planeObj) {
49
50
  // Standalone (plane, center, rx, ry): center is plane-local. Move
50
51
  // can't run outside a sketch, so resolve the center eagerly into the
@@ -1,13 +1,14 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
3
  import { IHLine, ISceneObject } from "../interfaces.js";
4
+ import { type NumberParam } from "../param.js";
4
5
  interface HLineFunction {
5
6
  /**
6
7
  * Draws a horizontal line of the given distance.
7
8
  * Chain `.centered()` to center the line on the current position.
8
9
  * @param distance - The line length
9
10
  */
10
- (distance: number): IHLine;
11
+ (distance: NumberParam): IHLine;
11
12
  /**
12
13
  * Draws a horizontal line that ends where it intersects the target geometry.
13
14
  * The nearest intersection (in either direction along the X axis) is used.
@@ -20,7 +21,7 @@ interface HLineFunction {
20
21
  * @param start - The start point
21
22
  * @param distance - The line length
22
23
  */
23
- (start: Point2DLike, distance: number): IHLine;
24
+ (start: Point2DLike, distance: NumberParam): IHLine;
24
25
  /**
25
26
  * Draws a horizontal line from a start point that ends where it intersects
26
27
  * the target geometry. The nearest intersection (in either direction along
@@ -34,7 +35,7 @@ interface HLineFunction {
34
35
  * @param targetPlane - The plane to draw on
35
36
  * @param distance - The line length
36
37
  */
37
- (targetPlane: PlaneLike | ISceneObject, distance: number): IHLine;
38
+ (targetPlane: PlaneLike | ISceneObject, distance: NumberParam): IHLine;
38
39
  }
39
40
  declare const _default: HLineFunction;
40
41
  export default _default;
@@ -6,6 +6,7 @@ import { registerBuilder } from "../../index.js";
6
6
  import { isPlaneLike } from "../../math/plane.js";
7
7
  import { SceneObject } from "../../common/scene-object.js";
8
8
  import { resolvePlane } from "../../helpers/resolve.js";
9
+ import { isNumberParam, resolveParam } from "../param.js";
9
10
  function build(context) {
10
11
  return function line() {
11
12
  let planeObj = null;
@@ -35,18 +36,19 @@ function build(context) {
35
36
  context.addSceneObject(hline);
36
37
  return hline;
37
38
  }
38
- if (argOffset === 0 && typeof arguments[0] !== 'number') {
39
+ if (argOffset === 0 && !isNumberParam(arguments[0])) {
39
40
  // hLine(start, distance) or hLine(start, target)
40
41
  const start = normalizePoint2D(arguments[0]);
41
42
  const second = arguments[1];
42
43
  const distanceOrTarget = second instanceof SceneObject
43
44
  ? second
44
- : second;
45
+ : resolveParam(second);
45
46
  const hline = new HorizontalLine(distanceOrTarget, planeObj);
47
+ hline.setHasExplicitStart();
46
48
  context.addSceneObjects([new Move(start), hline]);
47
49
  return hline;
48
50
  }
49
- const distance = arguments[argOffset];
51
+ const distance = resolveParam(arguments[argOffset]);
50
52
  const hline = new HorizontalLine(distance, planeObj);
51
53
  context.addSceneObject(hline);
52
54
  return hline;
@@ -33,6 +33,7 @@ function build(context) {
33
33
  const start = normalizePoint2D(arguments[argOffset]);
34
34
  const end = normalizePoint2D(arguments[argOffset + 1]);
35
35
  line = new LineTo(end, planeObj);
36
+ line.setHasExplicitStart();
36
37
  context.addSceneObjects([new Move(start), line]);
37
38
  }
38
39
  else {
@@ -1,13 +1,14 @@
1
1
  import { PlaneLike } from "../../math/plane.js";
2
2
  import { IOffset, ISceneObject } from "../interfaces.js";
3
3
  import { Extrudable } from "../../helpers/types.js";
4
+ import { type NumberParam, type BooleanParam } from "../param.js";
4
5
  interface OffsetFunction {
5
6
  /**
6
7
  * Offsets the current sketch geometry by the given distance.
7
8
  * @param distance - The offset distance (defaults to 1)
8
9
  * @param removeOriginal - Whether to remove the original geometry
9
10
  */
10
- (distance?: number, removeOriginal?: boolean): IOffset;
11
+ (distance?: NumberParam, removeOriginal?: BooleanParam): IOffset;
11
12
  /**
12
13
  * Offsets source geometries onto a target plane.
13
14
  * @param targetPlane - The plane to offset onto
@@ -15,7 +16,7 @@ interface OffsetFunction {
15
16
  * @param removeOriginal - Whether to remove the original geometry
16
17
  * @param sourceGeometries - The geometries to offset
17
18
  */
18
- (targetPlane: PlaneLike | ISceneObject, distance: number, removeOriginal: boolean, ...sourceGeometries: Extrudable[]): IOffset;
19
+ (targetPlane: PlaneLike | ISceneObject, distance: NumberParam, removeOriginal: BooleanParam, ...sourceGeometries: Extrudable[]): IOffset;
19
20
  }
20
21
  declare const _default: OffsetFunction;
21
22
  export default _default;
@@ -1,25 +1,26 @@
1
1
  import { Offset } from "../../features/2d/offset.js";
2
2
  import { registerBuilder } from "../../index.js";
3
3
  import { resolvePlane } from "../../helpers/resolve.js";
4
+ import { isNumberParam, isBooleanParam, resolveParam } from "../param.js";
4
5
  function build(context) {
5
6
  return function offset(...args) {
6
7
  // Plane-first mode: offset(plane, distance, removeOriginal, ...sourceGeometries)
7
8
  // Detected when first arg is not a number/undefined.
8
- if (args.length > 0 && args[0] !== undefined && typeof args[0] !== 'number' && typeof args[0] !== 'boolean') {
9
+ if (args.length > 0 && args[0] !== undefined && !isNumberParam(args[0]) && !isBooleanParam(args[0])) {
9
10
  if (context.getActiveSketch() !== null) {
10
11
  throw new Error("offset(plane, ...) cannot be used inside a sketch. Use offset(...) instead.");
11
12
  }
12
13
  const planeObj = resolvePlane(args[0], context);
13
- const distance = args[1] ?? 1;
14
- const removeOriginal = args[2] ?? false;
14
+ const distance = resolveParam(args[1]) ?? 1;
15
+ const removeOriginal = resolveParam(args[2]) ?? false;
15
16
  const sourceObjects = args.slice(3);
16
17
  const off = new Offset(distance, removeOriginal, sourceObjects, planeObj);
17
18
  context.addSceneObject(off);
18
19
  return off;
19
20
  }
20
21
  // In-sketch mode: offset(distance, removeOriginal)
21
- const distance = args[0] ?? 1;
22
- const removeOriginal = args[1] ?? false;
22
+ const distance = isNumberParam(args[0]) ? resolveParam(args[0]) : 1;
23
+ const removeOriginal = isBooleanParam(args[1]) ? resolveParam(args[1]) : false;
23
24
  const off = new Offset(distance, removeOriginal);
24
25
  context.addSceneObject(off);
25
26
  return off;
@@ -2,6 +2,7 @@ import { Point2DLike } from "../../math/point.js";
2
2
  import { PolygonMode } from "../../features/2d/polygon.js";
3
3
  import { PlaneLike } from "../../math/plane.js";
4
4
  import { IPolygon, ISceneObject } from "../interfaces.js";
5
+ import { type NumberParam } from "../param.js";
5
6
  interface PolygonFunction {
6
7
  /**
7
8
  * Draws a regular polygon with the given number of sides and diameter.
@@ -9,7 +10,7 @@ interface PolygonFunction {
9
10
  * @param diameter - The circumscribed or inscribed diameter
10
11
  * @param mode - `'inscribed'` or `'circumscribed'` (defaults to `'inscribed'`)
11
12
  */
12
- (numberOfSides: number, diameter: number, mode?: PolygonMode): IPolygon;
13
+ (numberOfSides: NumberParam, diameter: NumberParam, mode?: PolygonMode): IPolygon;
13
14
  /**
14
15
  * Draws a regular polygon at a given center point.
15
16
  * @param center - The center point
@@ -17,14 +18,14 @@ interface PolygonFunction {
17
18
  * @param diameter - The circumscribed or inscribed diameter
18
19
  * @param mode - `'inscribed'` or `'circumscribed'` (defaults to `'inscribed'`)
19
20
  */
20
- (center: Point2DLike, numberOfSides: number, diameter: number, mode?: PolygonMode): IPolygon;
21
+ (center: Point2DLike, numberOfSides: NumberParam, diameter: NumberParam, mode?: PolygonMode): IPolygon;
21
22
  /**
22
23
  * Draws a regular polygon on a specific plane.
23
24
  * @param targetPlane - The plane to draw on
24
25
  * @param numberOfSides - The number of sides
25
26
  * @param diameter - The circumscribed or inscribed diameter
26
27
  */
27
- (targetPlane: PlaneLike | ISceneObject, numberOfSides: number, diameter: number): IPolygon;
28
+ (targetPlane: PlaneLike | ISceneObject, numberOfSides: NumberParam, diameter: NumberParam): IPolygon;
28
29
  /**
29
30
  * Draws a regular polygon with a given mode on a specific plane.
30
31
  * @param targetPlane - The plane to draw on
@@ -32,7 +33,7 @@ interface PolygonFunction {
32
33
  * @param diameter - The circumscribed or inscribed diameter
33
34
  * @param mode - `'inscribed'` or `'circumscribed'`
34
35
  */
35
- (targetPlane: PlaneLike | ISceneObject, numberOfSides: number, diameter: number, mode: PolygonMode): IPolygon;
36
+ (targetPlane: PlaneLike | ISceneObject, numberOfSides: NumberParam, diameter: NumberParam, mode: PolygonMode): IPolygon;
36
37
  }
37
38
  declare const _default: PolygonFunction;
38
39
  export default _default;
@@ -6,6 +6,7 @@ import { registerBuilder } from "../../index.js";
6
6
  import { isPlaneLike } from "../../math/plane.js";
7
7
  import { SceneObject } from "../../common/scene-object.js";
8
8
  import { resolvePlane } from "../../helpers/resolve.js";
9
+ import { isNumberParam, resolveParam } from "../param.js";
9
10
  function build(context) {
10
11
  return function polygon() {
11
12
  let numberOfSides;
@@ -30,24 +31,24 @@ function build(context) {
30
31
  }
31
32
  const argCount = arguments.length - argOffset;
32
33
  if (argCount === 2) {
33
- numberOfSides = arguments[argOffset];
34
- diameter = arguments[argOffset + 1];
34
+ numberOfSides = resolveParam(arguments[argOffset]);
35
+ diameter = resolveParam(arguments[argOffset + 1]);
35
36
  mode = 'inscribed';
36
37
  poly = new Polygon(numberOfSides, diameter, mode, planeObj);
37
38
  context.addSceneObject(poly);
38
39
  }
39
40
  else if (argCount === 3) {
40
- if (typeof arguments[argOffset] === 'number') {
41
- numberOfSides = arguments[argOffset];
42
- diameter = arguments[argOffset + 1];
41
+ if (isNumberParam(arguments[argOffset])) {
42
+ numberOfSides = resolveParam(arguments[argOffset]);
43
+ diameter = resolveParam(arguments[argOffset + 1]);
43
44
  mode = arguments[argOffset + 2];
44
45
  poly = new Polygon(numberOfSides, diameter, mode, planeObj);
45
46
  context.addSceneObject(poly);
46
47
  }
47
48
  else {
48
49
  center = normalizePoint2D(arguments[argOffset]);
49
- numberOfSides = arguments[argOffset + 1];
50
- diameter = arguments[argOffset + 2];
50
+ numberOfSides = resolveParam(arguments[argOffset + 1]);
51
+ diameter = resolveParam(arguments[argOffset + 2]);
51
52
  mode = 'inscribed';
52
53
  poly = new Polygon(numberOfSides, diameter, mode, planeObj);
53
54
  context.addSceneObjects([new Move(center), poly]);
@@ -55,8 +56,8 @@ function build(context) {
55
56
  }
56
57
  else if (argCount === 4) {
57
58
  center = normalizePoint2D(arguments[argOffset]);
58
- numberOfSides = arguments[argOffset + 1];
59
- diameter = arguments[argOffset + 2];
59
+ numberOfSides = resolveParam(arguments[argOffset + 1]);
60
+ diameter = resolveParam(arguments[argOffset + 2]);
60
61
  mode = arguments[argOffset + 3];
61
62
  poly = new Polygon(numberOfSides, diameter, mode, planeObj);
62
63
  context.addSceneObjects([new Move(center), poly]);
@@ -1,27 +1,28 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
3
  import { IRect, ISceneObject } from "../interfaces.js";
4
+ import { type NumberParam } from "../param.js";
4
5
  interface RectFunction {
5
6
  /**
6
7
  * Draws a rectangle with the given width and optional height.
7
8
  * @param width - The rectangle width
8
9
  * @param height - The rectangle height (defaults to width)
9
10
  */
10
- (width: number, height?: number): IRect;
11
+ (width: NumberParam, height?: NumberParam): IRect;
11
12
  /**
12
13
  * Draws a rectangle at a given start point.
13
14
  * @param start - The start point (bottom-left corner)
14
15
  * @param width - The rectangle width
15
16
  * @param height - The rectangle height (defaults to width)
16
17
  */
17
- (start: Point2DLike, width: number, height?: number): IRect;
18
+ (start: Point2DLike, width: NumberParam, height?: NumberParam): IRect;
18
19
  /**
19
20
  * Draws a rectangle with given dimensions on a specific plane.
20
21
  * @param targetPlane - The plane to draw on
21
22
  * @param width - The rectangle width
22
23
  * @param height - The rectangle height
23
24
  */
24
- (targetPlane: PlaneLike | ISceneObject, width: number, height: number): IRect;
25
+ (targetPlane: PlaneLike | ISceneObject, width: NumberParam, height: NumberParam): IRect;
25
26
  }
26
27
  declare const _default: RectFunction;
27
28
  export default _default;
@@ -6,6 +6,7 @@ import { registerBuilder } from "../../index.js";
6
6
  import { isPlaneLike } from "../../math/plane.js";
7
7
  import { SceneObject } from "../../common/scene-object.js";
8
8
  import { resolvePlane } from "../../helpers/resolve.js";
9
+ import { isNumberParam, resolveParam } from "../param.js";
9
10
  function build(context) {
10
11
  return function cRect() {
11
12
  // Detect plane as first argument (only valid outside a sketch)
@@ -16,8 +17,8 @@ function build(context) {
16
17
  throw new Error("rect(plane, ...) cannot be used inside a sketch. Use rect(...) instead.");
17
18
  }
18
19
  const planeObj = resolvePlane(firstArg, context);
19
- const width = arguments[1];
20
- const height = arguments[2];
20
+ const width = resolveParam(arguments[1]);
21
+ const height = resolveParam(arguments[2]);
21
22
  const rect = new Rect(width, height, planeObj);
22
23
  context.addSceneObject(rect);
23
24
  return rect;
@@ -25,22 +26,22 @@ function build(context) {
25
26
  }
26
27
  const argCount = arguments.length;
27
28
  if (argCount === 1) {
28
- const width = arguments[0];
29
+ const width = resolveParam(arguments[0]);
29
30
  const rect = new Rect(width, width);
30
31
  context.addSceneObject(rect);
31
32
  return rect;
32
33
  }
33
34
  else if (argCount === 2) {
34
- if (typeof arguments[0] === 'number') {
35
- const width = arguments[0];
36
- const height = arguments[1];
35
+ if (isNumberParam(arguments[0])) {
36
+ const width = resolveParam(arguments[0]);
37
+ const height = resolveParam(arguments[1]);
37
38
  const rect = new Rect(width, height);
38
39
  context.addSceneObject(rect);
39
40
  return rect;
40
41
  }
41
42
  else {
42
43
  const start = normalizePoint2D(arguments[0]);
43
- const width = arguments[1];
44
+ const width = resolveParam(arguments[1]);
44
45
  const rect = new Rect(width, width);
45
46
  context.addSceneObjects([new Move(start), rect]);
46
47
  return rect;
@@ -48,8 +49,8 @@ function build(context) {
48
49
  }
49
50
  else if (argCount === 3) {
50
51
  const start = normalizePoint2D(arguments[0]);
51
- const width = arguments[1];
52
- const height = arguments[2];
52
+ const width = resolveParam(arguments[1]);
53
+ const height = resolveParam(arguments[2]);
53
54
  const rect = new Rect(width, height);
54
55
  context.addSceneObjects([new Move(start), rect]);
55
56
  return rect;
@@ -1,41 +1,49 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
3
  import { ISlot, ISceneObject } from "../interfaces.js";
4
+ import { type NumberParam, type BooleanParam } from "../param.js";
4
5
  interface SlotFunction {
5
6
  /**
6
7
  * Draws a slot with the given length and end radius.
7
8
  * @param distance - The slot length
8
9
  * @param radius - The end cap radius
9
10
  */
10
- (distance: number, radius: number): ISlot;
11
+ (distance: NumberParam, radius: NumberParam): ISlot;
11
12
  /**
12
13
  * Draws a slot on a specific plane.
13
14
  * @param targetPlane - The plane to draw on
14
15
  * @param distance - The slot length
15
16
  * @param radius - The end cap radius
16
17
  */
17
- (targetPlane: PlaneLike | ISceneObject, distance: number, radius: number): ISlot;
18
+ (targetPlane: PlaneLike | ISceneObject, distance: NumberParam, radius: NumberParam): ISlot;
18
19
  /**
19
20
  * Draws a slot from a start point with the given length and end radius.
20
21
  * @param start - The start point
21
22
  * @param distance - The slot length
22
23
  * @param radius - The end cap radius
23
24
  */
24
- (start: Point2DLike, distance: number, radius: number): ISlot;
25
+ (start: Point2DLike, distance: NumberParam, radius: NumberParam): ISlot;
26
+ /**
27
+ * Draws a slot between two cap-center points with the given radius.
28
+ * @param start - Center of the first cap
29
+ * @param end - Center of the second cap
30
+ * @param radius - The end cap radius
31
+ */
32
+ (start: Point2DLike, end: Point2DLike, radius: number): ISlot;
25
33
  /**
26
34
  * Creates a slot from a geometry edge with the given radius.
27
35
  * @param geometry - The source geometry edge
28
36
  * @param radius - The end cap radius
29
37
  * @param deleteSource - Whether to delete the source geometry (defaults to true)
30
38
  */
31
- (geometry: ISceneObject, radius: number, deleteSource?: boolean): ISlot;
39
+ (geometry: ISceneObject, radius: NumberParam, deleteSource?: BooleanParam): ISlot;
32
40
  /**
33
41
  * Creates a slot from a geometry edge on a specific plane.
34
42
  * @param targetPlane - The plane to draw on
35
43
  * @param geometry - The source geometry edge
36
44
  * @param radius - The end cap radius
37
45
  */
38
- (targetPlane: PlaneLike | ISceneObject, geometry: ISceneObject, radius: number): ISlot;
46
+ (targetPlane: PlaneLike | ISceneObject, geometry: ISceneObject, radius: NumberParam): ISlot;
39
47
  /**
40
48
  * Creates a slot from a geometry edge, optionally keeping the source, on a specific plane.
41
49
  * @param targetPlane - The plane to draw on
@@ -43,7 +51,7 @@ interface SlotFunction {
43
51
  * @param radius - The end cap radius
44
52
  * @param deleteSource - Whether to delete the source geometry
45
53
  */
46
- (targetPlane: PlaneLike | ISceneObject, geometry: ISceneObject, radius: number, deleteSource: boolean): ISlot;
54
+ (targetPlane: PlaneLike | ISceneObject, geometry: ISceneObject, radius: NumberParam, deleteSource: BooleanParam): ISlot;
47
55
  }
48
56
  declare const _default: SlotFunction;
49
57
  export default _default;
@@ -7,6 +7,7 @@ import { registerBuilder } from "../../index.js";
7
7
  import { SceneObject } from "../../common/scene-object.js";
8
8
  import { isPlaneLike } from "../../math/plane.js";
9
9
  import { resolvePlane } from "../../helpers/resolve.js";
10
+ import { isNumberParam, isBooleanParam, resolveParam } from "../param.js";
10
11
  function build(context) {
11
12
  return function slot() {
12
13
  const inSketch = context.getActiveSketch() !== null;
@@ -29,10 +30,10 @@ function build(context) {
29
30
  // SlotFromEdge path: first non-plane arg is a SceneObject (geometry)
30
31
  if (arguments[argOffset] instanceof SceneObject && !isPoint2DLike(arguments[argOffset])) {
31
32
  const geometry = arguments[argOffset];
32
- const radius = arguments[argOffset + 1];
33
+ const radius = resolveParam(arguments[argOffset + 1]);
33
34
  let deleteSource = true;
34
- if (arguments.length > argOffset + 2 && typeof arguments[argOffset + 2] === 'boolean') {
35
- deleteSource = arguments[argOffset + 2];
35
+ if (arguments.length > argOffset + 2 && isBooleanParam(arguments[argOffset + 2])) {
36
+ deleteSource = resolveParam(arguments[argOffset + 2]);
36
37
  }
37
38
  const slotFromEdge = new SlotFromEdge(geometry, radius, deleteSource, planeObj);
38
39
  context.addSceneObject(slotFromEdge);
@@ -40,18 +41,28 @@ function build(context) {
40
41
  }
41
42
  const argCount = arguments.length - argOffset;
42
43
  // slot(distance, radius)
43
- if (argCount === 2 && typeof arguments[argOffset] === 'number') {
44
- const distance = arguments[argOffset];
45
- const radius = arguments[argOffset + 1];
44
+ if (argCount === 2 && isNumberParam(arguments[argOffset])) {
45
+ const distance = resolveParam(arguments[argOffset]);
46
+ const radius = resolveParam(arguments[argOffset + 1]);
46
47
  const s = new Slot(distance, radius, planeObj);
47
48
  context.addSceneObject(s);
48
49
  return s;
49
50
  }
51
+ // slot(start, end, radius) — in-sketch only
52
+ if (argCount === 3 && argOffset === 0
53
+ && isPoint2DLike(arguments[0]) && isPoint2DLike(arguments[1])) {
54
+ const start = normalizePoint2D(arguments[0]);
55
+ const end = normalizePoint2D(arguments[1]);
56
+ const radius = arguments[2];
57
+ const s = Slot.fromTwoPoints(start, end, radius, planeObj);
58
+ context.addSceneObjects([new Move(start), s]);
59
+ return s;
60
+ }
50
61
  // slot(start, distance, radius) — in-sketch only
51
62
  if (argCount === 3 && argOffset === 0) {
52
63
  const start = normalizePoint2D(arguments[0]);
53
- const distance = arguments[1];
54
- const radius = arguments[2];
64
+ const distance = resolveParam(arguments[1]);
65
+ const radius = resolveParam(arguments[2]);
55
66
  const s = new Slot(distance, radius, planeObj);
56
67
  context.addSceneObjects([new Move(start), s]);
57
68
  return s;
@@ -1,7 +1,25 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { QualifiedSceneObject } from "../../features/2d/constraints/qualified-geometry.js";
3
- import { IGeometry, ISceneObject, ITangentArcTwoObjects } from "../interfaces.js";
3
+ import { IGeometry, ISceneObject, ITangentArcToObject, ITangentArcTwoObjects } from "../interfaces.js";
4
4
  interface TArcFunction {
5
+ /**
6
+ * Draws a tangent arc from the current position using the current tangent
7
+ * direction, ending tangent to a target line. The radius is solved
8
+ * automatically; the arc must be tangent to the target but does not need
9
+ * to touch its finite extent. By default the arc curves to the left of
10
+ * the start tangent — chain `.flip()` to curve to the right instead.
11
+ * @param target - The target line (or a qualified line)
12
+ */
13
+ (target: ISceneObject | QualifiedSceneObject): ITangentArcToObject;
14
+ /**
15
+ * Draws a tangent arc from the current position using the current tangent
16
+ * direction, with the given radius, ending at the first intersection with
17
+ * the target geometry along the arc's sweep direction. A negative radius
18
+ * flips the sweep direction. Supported targets: lines, circles, and arcs.
19
+ * @param radius - The arc radius. A negative value flips the sweep direction.
20
+ * @param target - The target geometry to intersect with
21
+ */
22
+ (radius: number, target: ISceneObject | QualifiedSceneObject): IGeometry;
5
23
  /**
6
24
  * Draws a tangent arc with a given radius and end angle.
7
25
  * @param radius - The arc radius (defaults to 100). A negative value flips the sweep direction.
@@ -34,7 +52,7 @@ interface TArcFunction {
34
52
  */
35
53
  (startPoint: Point2DLike, endPoint: Point2DLike, tangent: Point2DLike): IGeometry;
36
54
  /**
37
- * Draws a tangent arc between two geometry objects.
55
+ * Draws all possible tangent arcs between two geometry objects.
38
56
  * @param c1 - The first geometry object
39
57
  * @param c2 - The second geometry object
40
58
  * @param radius - The arc radius
@@ -3,13 +3,37 @@ import { TangentArc } from "../../features/2d/tarc.js";
3
3
  import { TangentArcToPoint } from "../../features/2d/tarc-to-point.js";
4
4
  import { TangentArcToPointTangent } from "../../features/2d/tarc-to-point-tangent.js";
5
5
  import { TangentArcWithTangent } from "../../features/2d/tarc-with-tangent.js";
6
+ import { TangentArcToObject } from "../../features/2d/tarc-to-object.js";
7
+ import { TangentArcRadiusToObject } from "../../features/2d/tarc-radius-to-object.js";
6
8
  import { Move } from "../../features/2d/move.js";
7
9
  import { normalizePoint2D } from "../../helpers/normalize.js";
8
10
  import { registerBuilder } from "../../index.js";
9
11
  import { QualifiedSceneObject } from "../../features/2d/constraints/qualified-geometry.js";
10
12
  import { TangentArcTwoObjects } from "../../features/2d/tarc-constrained.js";
13
+ import { SceneObject } from "../../common/scene-object.js";
11
14
  function build(context) {
12
15
  return function tarc() {
16
+ // tArc(target): single scene-object target, radius solved automatically.
17
+ // LazyVertex extends SceneObject but represents a point — fall through to the
18
+ // Point2DLike branch below so tArc(lazyVertex) becomes tArc(endPoint).
19
+ if (arguments.length === 1 &&
20
+ ((arguments[0] instanceof SceneObject && !isPoint2DLike(arguments[0])) ||
21
+ arguments[0] instanceof QualifiedSceneObject)) {
22
+ const target = QualifiedSceneObject.from(arguments[0]);
23
+ const arc = new TangentArcToObject(target);
24
+ context.addSceneObject(arc);
25
+ return arc;
26
+ }
27
+ // tArc(radius, target): explicit radius, end at first intersection with target
28
+ if (arguments.length === 2 &&
29
+ typeof arguments[0] === 'number' &&
30
+ (arguments[1] instanceof SceneObject || arguments[1] instanceof QualifiedSceneObject)) {
31
+ const radius = arguments[0];
32
+ const target = QualifiedSceneObject.from(arguments[1]);
33
+ const arc = new TangentArcRadiusToObject(radius, target);
34
+ context.addSceneObject(arc);
35
+ return arc;
36
+ }
13
37
  // tarc(c1, c2, radius): fillet arc tangent to two circles/points
14
38
  if ((arguments.length === 3 || arguments.length === 4) && typeof arguments[2] === 'number') {
15
39
  const o1 = isPoint2DLike(arguments[0]) ? normalizePoint2D(arguments[0]) : arguments[0];
@@ -1,13 +1,14 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
3
  import { IVLine, ISceneObject } from "../interfaces.js";
4
+ import { type NumberParam } from "../param.js";
4
5
  interface VLineFunction {
5
6
  /**
6
7
  * Draws a vertical line of the given distance.
7
8
  * Chain `.centered()` to center the line on the current position.
8
9
  * @param distance - The line length
9
10
  */
10
- (distance: number): IVLine;
11
+ (distance: NumberParam): IVLine;
11
12
  /**
12
13
  * Draws a vertical line that ends where it intersects the target geometry.
13
14
  * The nearest intersection (in either direction along the Y axis) is used.
@@ -20,7 +21,7 @@ interface VLineFunction {
20
21
  * @param start - The start point
21
22
  * @param distance - The line length
22
23
  */
23
- (start: Point2DLike, distance: number): IVLine;
24
+ (start: Point2DLike, distance: NumberParam): IVLine;
24
25
  /**
25
26
  * Draws a vertical line from a start point that ends where it intersects
26
27
  * the target geometry. The nearest intersection (in either direction along
@@ -34,7 +35,7 @@ interface VLineFunction {
34
35
  * @param targetPlane - The plane to draw on
35
36
  * @param distance - The line length
36
37
  */
37
- (targetPlane: PlaneLike | ISceneObject, distance: number): IVLine;
38
+ (targetPlane: PlaneLike | ISceneObject, distance: NumberParam): IVLine;
38
39
  }
39
40
  declare const _default: VLineFunction;
40
41
  export default _default;