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,4 +1,5 @@
1
1
  import { GeometrySceneObject } from "./geometry.js";
2
+ import { SceneObject } from "../../common/scene-object.js";
2
3
  import { LazyVertex } from "../lazy-vertex.js";
3
4
  import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
4
5
  import { ITangentArcTwoObjects } from "../../core/interfaces.js";
@@ -11,6 +12,7 @@ export declare class TangentArcTwoObjects extends GeometrySceneObject implements
11
12
  build(): void;
12
13
  start(index?: number): LazyVertex;
13
14
  end(index?: number): LazyVertex;
15
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
14
16
  compareTo(other: TangentArcTwoObjects): boolean;
15
17
  getType(): string;
16
18
  getUniqueType(): string;
@@ -1,6 +1,7 @@
1
1
  import { GeometrySceneObject } from "./geometry.js";
2
2
  import { LazyVertex } from "../lazy-vertex.js";
3
3
  import { Vertex } from "../../common/vertex.js";
4
+ import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
4
5
  import { createConstraintSolver } from "../../oc/constraints/create-solver.js";
5
6
  export class TangentArcTwoObjects extends GeometrySceneObject {
6
7
  c1;
@@ -41,6 +42,13 @@ export class TangentArcTwoObjects extends GeometrySceneObject {
41
42
  end(index = 0) {
42
43
  return new LazyVertex(this.generateUniqueName(`end-vertex-${index}`), () => [this.getState('end')]);
43
44
  }
45
+ createCopy(remap) {
46
+ const remappedC1Object = remap.get(this.c1.object) || this.c1.object;
47
+ const remappedC2Object = remap.get(this.c2.object) || this.c2.object;
48
+ const c1 = new QualifiedSceneObject(remappedC1Object, this.c1.qualifier);
49
+ const c2 = new QualifiedSceneObject(remappedC2Object, this.c2.qualifier);
50
+ return new TangentArcTwoObjects(c1, c2, this.radius, this.mustTouch);
51
+ }
44
52
  compareTo(other) {
45
53
  if (!(other instanceof TangentArcTwoObjects)) {
46
54
  return false;
@@ -0,0 +1,16 @@
1
+ import { GeometrySceneObject } from "./geometry.js";
2
+ import { SceneObject } from "../../common/scene-object.js";
3
+ import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
4
+ export declare class TangentArcRadiusToObject extends GeometrySceneObject {
5
+ radius: number;
6
+ target: QualifiedSceneObject;
7
+ constructor(radius: number, target: QualifiedSceneObject);
8
+ build(): void;
9
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
10
+ compareTo(other: TangentArcRadiusToObject): boolean;
11
+ getType(): string;
12
+ getUniqueType(): string;
13
+ serialize(): {
14
+ radius: number;
15
+ };
16
+ }
@@ -0,0 +1,58 @@
1
+ import { GeometrySceneObject } from "./geometry.js";
2
+ import { Vertex } from "../../common/vertex.js";
3
+ import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
4
+ import { solveTangentArcRadiusToObject } from "../../oc/constraints/geometric/tangent-arc-radius-to-object.js";
5
+ export class TangentArcRadiusToObject extends GeometrySceneObject {
6
+ radius;
7
+ target;
8
+ constructor(radius, target) {
9
+ super();
10
+ this.radius = radius;
11
+ this.target = target;
12
+ }
13
+ build() {
14
+ const plane = this.sketch.getPlane();
15
+ const startPoint = this.getCurrentPosition();
16
+ const startTangent = this.sketch.getTangentAt(this);
17
+ const targetShape = this.target.toQualifiedShape();
18
+ const result = solveTangentArcRadiusToObject(plane, startPoint, startTangent, this.radius, targetShape);
19
+ for (let i = 0; i < result.edges.length; i++) {
20
+ this.setState(`edge-${i}`, result.edges[i]);
21
+ }
22
+ if (result.edges.length > 0) {
23
+ const lastEdge = result.edges[result.edges.length - 1];
24
+ const localStart = plane.worldToLocal(lastEdge.getFirstVertex().toPoint());
25
+ const localEnd = plane.worldToLocal(lastEdge.getLastVertex().toPoint());
26
+ this.setState('start', Vertex.fromPoint2D(localStart));
27
+ this.setState('end', Vertex.fromPoint2D(localEnd));
28
+ if (result.endTangent) {
29
+ this.setTangent(result.endTangent);
30
+ }
31
+ this.setCurrentPosition(localEnd);
32
+ }
33
+ this.addShapes(result.edges);
34
+ }
35
+ createCopy(remap) {
36
+ const remappedObject = remap.get(this.target.object) || this.target.object;
37
+ const target = new QualifiedSceneObject(remappedObject, this.target.qualifier);
38
+ return new TangentArcRadiusToObject(this.radius, target);
39
+ }
40
+ compareTo(other) {
41
+ if (!(other instanceof TangentArcRadiusToObject)) {
42
+ return false;
43
+ }
44
+ if (!super.compareTo(other)) {
45
+ return false;
46
+ }
47
+ return this.radius === other.radius && this.target.compareTo(other.target);
48
+ }
49
+ getType() {
50
+ return 'tarc';
51
+ }
52
+ getUniqueType() {
53
+ return 'tarc-radius-to-object';
54
+ }
55
+ serialize() {
56
+ return { radius: this.radius };
57
+ }
58
+ }
@@ -0,0 +1,18 @@
1
+ import { GeometrySceneObject } from "./geometry.js";
2
+ import { SceneObject } from "../../common/scene-object.js";
3
+ import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
4
+ import { ITangentArcToObject } from "../../core/interfaces.js";
5
+ export declare class TangentArcToObject extends GeometrySceneObject implements ITangentArcToObject {
6
+ target: QualifiedSceneObject;
7
+ private flipped;
8
+ constructor(target: QualifiedSceneObject);
9
+ flip(): this;
10
+ build(): void;
11
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
12
+ compareTo(other: TangentArcToObject): boolean;
13
+ getType(): string;
14
+ getUniqueType(): string;
15
+ serialize(): {
16
+ flipped: boolean;
17
+ };
18
+ }
@@ -0,0 +1,66 @@
1
+ import { GeometrySceneObject } from "./geometry.js";
2
+ import { Vertex } from "../../common/vertex.js";
3
+ import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
4
+ import { createConstraintSolver } from "../../oc/constraints/create-solver.js";
5
+ export class TangentArcToObject extends GeometrySceneObject {
6
+ target;
7
+ flipped = false;
8
+ constructor(target) {
9
+ super();
10
+ this.target = target;
11
+ }
12
+ flip() {
13
+ this.flipped = true;
14
+ return this;
15
+ }
16
+ build() {
17
+ const plane = this.sketch.getPlane();
18
+ const startPoint = this.getCurrentPosition();
19
+ const startTangent = this.sketch.getTangentAt(this);
20
+ const targetShape = this.target.toQualifiedShape();
21
+ const solver = createConstraintSolver(false);
22
+ const result = solver.getTangentArcFromPointTangent(plane, startPoint, startTangent, targetShape, this.flipped);
23
+ for (let i = 0; i < result.edges.length; i++) {
24
+ this.setState(`edge-${i}`, result.edges[i]);
25
+ }
26
+ if (result.edges.length > 0) {
27
+ const lastEdge = result.edges[result.edges.length - 1];
28
+ const localStart = plane.worldToLocal(lastEdge.getFirstVertex().toPoint());
29
+ const localEnd = plane.worldToLocal(lastEdge.getLastVertex().toPoint());
30
+ this.setState('start', Vertex.fromPoint2D(localStart));
31
+ this.setState('end', Vertex.fromPoint2D(localEnd));
32
+ if (result.endTangent) {
33
+ this.setTangent(result.endTangent);
34
+ }
35
+ this.setCurrentPosition(localEnd);
36
+ }
37
+ this.addShapes(result.edges);
38
+ }
39
+ createCopy(remap) {
40
+ const remappedObject = remap.get(this.target.object) || this.target.object;
41
+ const target = new QualifiedSceneObject(remappedObject, this.target.qualifier);
42
+ const copy = new TangentArcToObject(target);
43
+ if (this.flipped) {
44
+ copy.flip();
45
+ }
46
+ return copy;
47
+ }
48
+ compareTo(other) {
49
+ if (!(other instanceof TangentArcToObject)) {
50
+ return false;
51
+ }
52
+ if (!super.compareTo(other)) {
53
+ return false;
54
+ }
55
+ return this.target.compareTo(other.target) && this.flipped === other.flipped;
56
+ }
57
+ getType() {
58
+ return 'tarc';
59
+ }
60
+ getUniqueType() {
61
+ return 'tarc-to-object';
62
+ }
63
+ serialize() {
64
+ return { flipped: this.flipped };
65
+ }
66
+ }
@@ -1,3 +1,4 @@
1
+ import { SceneObject } from "../../common/scene-object.js";
1
2
  import { GeometrySceneObject } from "./geometry.js";
2
3
  import { LazyVertex } from "../lazy-vertex.js";
3
4
  export declare class TangentArcToPointTangent extends GeometrySceneObject {
@@ -5,6 +6,7 @@ export declare class TangentArcToPointTangent extends GeometrySceneObject {
5
6
  startTangent: LazyVertex;
6
7
  constructor(endPoint: LazyVertex, startTangent: LazyVertex);
7
8
  build(): void;
9
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
8
10
  compareTo(other: TangentArcToPointTangent): boolean;
9
11
  getType(): string;
10
12
  getUniqueType(): string;
@@ -60,8 +60,14 @@ export class TangentArcToPointTangent extends GeometrySceneObject {
60
60
  this.setState('start', Vertex.fromPoint2D(startPoint));
61
61
  this.setState('end', Vertex.fromPoint2D(targetPoint));
62
62
  this.addShape(edge);
63
+ const centerVertex = Vertex.fromPoint2D(centerPoint);
64
+ centerVertex.markAsMetaShape();
65
+ this.addShape(centerVertex);
63
66
  this.setCurrentPosition(targetPoint);
64
67
  }
68
+ createCopy(remap) {
69
+ return new TangentArcToPointTangent(this.endPoint, this.startTangent);
70
+ }
65
71
  compareTo(other) {
66
72
  if (!(other instanceof TangentArcToPointTangent)) {
67
73
  return false;
@@ -1,9 +1,11 @@
1
+ import { SceneObject } from "../../common/scene-object.js";
1
2
  import { GeometrySceneObject } from "./geometry.js";
2
3
  import { LazyVertex } from "../lazy-vertex.js";
3
4
  export declare class TangentArcToPoint extends GeometrySceneObject {
4
5
  endPoint: LazyVertex;
5
6
  constructor(endPoint: LazyVertex);
6
7
  build(): void;
8
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
7
9
  compareTo(other: TangentArcToPoint): boolean;
8
10
  getType(): string;
9
11
  getUniqueType(): string;
@@ -58,8 +58,14 @@ export class TangentArcToPoint extends GeometrySceneObject {
58
58
  this.setState('start', Vertex.fromPoint2D(startPoint));
59
59
  this.setState('end', Vertex.fromPoint2D(targetPoint));
60
60
  this.addShape(edge);
61
+ const centerVertex = Vertex.fromPoint2D(centerPoint);
62
+ centerVertex.markAsMetaShape();
63
+ this.addShape(centerVertex);
61
64
  this.setCurrentPosition(targetPoint);
62
65
  }
66
+ createCopy(remap) {
67
+ return new TangentArcToPoint(this.endPoint);
68
+ }
63
69
  compareTo(other) {
64
70
  if (!(other instanceof TangentArcToPoint)) {
65
71
  return false;
@@ -1,3 +1,4 @@
1
+ import { SceneObject } from "../../common/scene-object.js";
1
2
  import { LazyVertex } from "../lazy-vertex.js";
2
3
  import { GeometrySceneObject } from "./geometry.js";
3
4
  export declare class TangentArcWithTangent extends GeometrySceneObject {
@@ -6,6 +7,7 @@ export declare class TangentArcWithTangent extends GeometrySceneObject {
6
7
  startTangent: LazyVertex;
7
8
  constructor(radius: number, endAngle: number, startTangent: LazyVertex);
8
9
  build(): void;
10
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
9
11
  compareTo(other: TangentArcWithTangent): boolean;
10
12
  getType(): string;
11
13
  getUniqueType(): string;
@@ -44,8 +44,14 @@ export class TangentArcWithTangent extends GeometrySceneObject {
44
44
  const ty = sign * Math.cos(endAngleRad);
45
45
  this.setTangent(new Point2D(tx, ty));
46
46
  this.addShape(edge);
47
+ const centerVertex = Vertex.fromPoint2D(centerPoint);
48
+ centerVertex.markAsMetaShape();
49
+ this.addShape(centerVertex);
47
50
  this.setCurrentPosition(endPoint);
48
51
  }
52
+ createCopy(remap) {
53
+ return new TangentArcWithTangent(this.radius, this.endAngle, this.startTangent);
54
+ }
49
55
  compareTo(other) {
50
56
  if (!(other instanceof TangentArcWithTangent)) {
51
57
  return false;
@@ -1,9 +1,11 @@
1
+ import { SceneObject } from "../../common/scene-object.js";
1
2
  import { GeometrySceneObject } from "./geometry.js";
2
3
  export declare class TangentArc extends GeometrySceneObject {
3
4
  radius: number;
4
5
  endAngle: number;
5
6
  constructor(radius: number, endAngle: number);
6
7
  build(): void;
8
+ createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
7
9
  compareTo(other: TangentArc): boolean;
8
10
  getType(): string;
9
11
  serialize(): {
@@ -46,8 +46,14 @@ export class TangentArc extends GeometrySceneObject {
46
46
  const ty = sign * Math.cos(endAngleRad);
47
47
  this.setTangent(new Point2D(tx, ty));
48
48
  this.addShape(edge);
49
+ const centerVertex = Vertex.fromPoint2D(centerPoint);
50
+ centerVertex.markAsMetaShape();
51
+ this.addShape(centerVertex);
49
52
  this.setCurrentPosition(endPoint);
50
53
  }
54
+ createCopy(remap) {
55
+ return new TangentArc(this.radius, this.endAngle);
56
+ }
51
57
  compareTo(other) {
52
58
  if (!(other instanceof TangentArc)) {
53
59
  return false;
@@ -6,8 +6,10 @@ export declare class VerticalLine extends GeometrySceneObject implements IVLine
6
6
  distanceOrTarget: number | SceneObject;
7
7
  private targetPlane;
8
8
  private _centered;
9
+ private _hasExplicitStart;
9
10
  constructor(distanceOrTarget: number | SceneObject, targetPlane?: PlaneObjectBase);
10
11
  centered(value?: boolean): this;
12
+ setHasExplicitStart(value?: boolean): this;
11
13
  build(): void;
12
14
  getDependencies(): SceneObject[];
13
15
  createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
@@ -17,5 +19,6 @@ export declare class VerticalLine extends GeometrySceneObject implements IVLine
17
19
  serialize(): {
18
20
  distance: number;
19
21
  centered: boolean;
22
+ hasExplicitStart: boolean;
20
23
  };
21
24
  }
@@ -8,6 +8,7 @@ export class VerticalLine extends GeometrySceneObject {
8
8
  distanceOrTarget;
9
9
  targetPlane;
10
10
  _centered = false;
11
+ _hasExplicitStart = false;
11
12
  constructor(distanceOrTarget, targetPlane = null) {
12
13
  super();
13
14
  this.distanceOrTarget = distanceOrTarget;
@@ -17,6 +18,10 @@ export class VerticalLine extends GeometrySceneObject {
17
18
  this._centered = value;
18
19
  return this;
19
20
  }
21
+ setHasExplicitStart(value = true) {
22
+ this._hasExplicitStart = value;
23
+ return this;
24
+ }
20
25
  build() {
21
26
  const plane = this.targetPlane?.getPlane() || this.sketch.getPlane();
22
27
  const currentPos = this.targetPlane
@@ -78,6 +83,7 @@ export class VerticalLine extends GeometrySceneObject {
78
83
  : this.distanceOrTarget;
79
84
  const copy = new VerticalLine(distanceOrTarget, targetPlane);
80
85
  copy.centered(this._centered);
86
+ copy._hasExplicitStart = this._hasExplicitStart;
81
87
  return copy;
82
88
  }
83
89
  compareTo(other) {
@@ -104,7 +110,7 @@ export class VerticalLine extends GeometrySceneObject {
104
110
  else if (this.distanceOrTarget !== other.distanceOrTarget) {
105
111
  return false;
106
112
  }
107
- return this._centered === other._centered;
113
+ return this._centered === other._centered && this._hasExplicitStart === other._hasExplicitStart;
108
114
  }
109
115
  getType() {
110
116
  return 'line';
@@ -115,7 +121,8 @@ export class VerticalLine extends GeometrySceneObject {
115
121
  serialize() {
116
122
  return {
117
123
  distance: typeof this.distanceOrTarget === 'number' ? this.distanceOrTarget : null,
118
- centered: this._centered
124
+ centered: this._centered,
125
+ hasExplicitStart: this._hasExplicitStart,
119
126
  };
120
127
  }
121
128
  }
@@ -1,14 +1,15 @@
1
1
  import { BuildSceneObjectContext, SceneObject } from "../common/scene-object.js";
2
2
  import { Axis } from "../math/axis.js";
3
+ import { type NumberParam } from "../core/param.js";
3
4
  export type CircularCopyOptions = {
4
- count: number;
5
+ count: NumberParam;
5
6
  centered?: boolean;
6
7
  skip?: number[];
7
8
  } & ({
8
- offset: number;
9
+ offset: NumberParam;
9
10
  angle?: never;
10
11
  } | {
11
- angle: number;
12
+ angle: NumberParam;
12
13
  offset?: never;
13
14
  });
14
15
  export declare class CopyCircular extends SceneObject {
@@ -2,6 +2,7 @@ import { SceneObject } from "../common/scene-object.js";
2
2
  import { Matrix4 } from "../math/matrix4.js";
3
3
  import { rad } from "../helpers/math-helpers.js";
4
4
  import { ShapeOps } from "../oc/shape-ops.js";
5
+ import { resolveParam } from "../core/param.js";
5
6
  export class CopyCircular extends SceneObject {
6
7
  axis;
7
8
  options;
@@ -17,13 +18,21 @@ export class CopyCircular extends SceneObject {
17
18
  if (!this.targetObjects) {
18
19
  objects = context.getActiveSceneObjects();
19
20
  }
20
- const { count, centered, skip } = this.options;
21
+ const originalShapes = objects.flatMap(obj => obj.getShapes());
22
+ for (const obj of objects) {
23
+ obj.removeShapes(this);
24
+ }
25
+ for (const shape of originalShapes) {
26
+ this.addShape(shape);
27
+ }
28
+ const count = resolveParam(this.options.count);
29
+ const { centered, skip } = this.options;
21
30
  let offset;
22
31
  if ('offset' in this.options && this.options.offset !== undefined) {
23
- offset = this.options.offset;
32
+ offset = resolveParam(this.options.offset);
24
33
  }
25
34
  else {
26
- offset = this.options.angle / count;
35
+ offset = resolveParam(this.options.angle) / count;
27
36
  }
28
37
  const startOffset = centered ? -(count * offset) / 2 : 0;
29
38
  for (let i = 1; i < count; i++) {
@@ -31,12 +40,10 @@ export class CopyCircular extends SceneObject {
31
40
  continue;
32
41
  const angle = startOffset + offset * i;
33
42
  const matrix = Matrix4.fromRotationAroundAxis(this.axis.origin, this.axis.direction, rad(angle));
34
- for (const obj of objects) {
35
- for (const shape of obj.getShapes()) {
36
- const transformed = ShapeOps.transform(shape, matrix);
37
- transformed.setMeshSource(shape, matrix);
38
- this.addShape(transformed);
39
- }
43
+ for (const shape of originalShapes) {
44
+ const transformed = ShapeOps.transform(shape, matrix);
45
+ transformed.setMeshSource(shape, matrix);
46
+ this.addShape(transformed);
40
47
  }
41
48
  }
42
49
  }
@@ -2,6 +2,7 @@ import { Matrix4 } from "../math/matrix4.js";
2
2
  import { rad } from "../helpers/math-helpers.js";
3
3
  import { ShapeOps } from "../oc/shape-ops.js";
4
4
  import { GeometrySceneObject } from "./2d/geometry.js";
5
+ import { resolveParam } from "../core/param.js";
5
6
  export class CopyCircular2D extends GeometrySceneObject {
6
7
  center;
7
8
  options;
@@ -21,16 +22,24 @@ export class CopyCircular2D extends GeometrySceneObject {
21
22
  else {
22
23
  objects = allSiblings;
23
24
  }
25
+ const originalShapes = objects.flatMap(obj => obj.getShapes());
26
+ for (const obj of objects) {
27
+ obj.removeShapes(this);
28
+ }
29
+ for (const shape of originalShapes) {
30
+ this.addShape(shape);
31
+ }
24
32
  const plane = this.sketch.getPlane();
25
33
  const origin = plane.localToWorld(this.center.asPoint2D());
26
34
  const direction = plane.normal;
27
- const { count, centered, skip } = this.options;
35
+ const count = resolveParam(this.options.count);
36
+ const { centered, skip } = this.options;
28
37
  let offset;
29
38
  if ('offset' in this.options && this.options.offset !== undefined) {
30
- offset = this.options.offset;
39
+ offset = resolveParam(this.options.offset);
31
40
  }
32
41
  else {
33
- offset = this.options.angle / count;
42
+ offset = resolveParam(this.options.angle) / count;
34
43
  }
35
44
  const startOffset = centered ? -(count * offset) / 2 : 0;
36
45
  for (let i = 1; i < count; i++) {
@@ -38,12 +47,10 @@ export class CopyCircular2D extends GeometrySceneObject {
38
47
  continue;
39
48
  const angle = startOffset + offset * i;
40
49
  const matrix = Matrix4.fromRotationAroundAxis(origin, direction, rad(angle));
41
- for (const obj of objects) {
42
- for (const shape of obj.getShapes()) {
43
- const transformed = ShapeOps.transform(shape, matrix);
44
- transformed.setMeshSource(shape, matrix);
45
- this.addShape(transformed);
46
- }
50
+ for (const shape of originalShapes) {
51
+ const transformed = ShapeOps.transform(shape, matrix);
52
+ transformed.setMeshSource(shape, matrix);
53
+ this.addShape(transformed);
47
54
  }
48
55
  }
49
56
  this.setCurrentPosition(this.center.asPoint2D());
@@ -1,14 +1,15 @@
1
1
  import { BuildSceneObjectContext, SceneObject } from "../common/scene-object.js";
2
2
  import { Axis } from "../math/axis.js";
3
+ import { type NumberParam } from "../core/param.js";
3
4
  export type LinearCopyOptions = {
4
- count: number | number[];
5
+ count: NumberParam | number[];
5
6
  centered?: boolean;
6
7
  skip?: number[][];
7
8
  } & ({
8
- offset: number | number[];
9
+ offset: NumberParam | number[];
9
10
  length?: never;
10
11
  } | {
11
- length: number | number[];
12
+ length: NumberParam | number[];
12
13
  offset?: never;
13
14
  });
14
15
  export declare class CopyLinear extends SceneObject {
@@ -1,6 +1,7 @@
1
1
  import { SceneObject } from "../common/scene-object.js";
2
2
  import { Matrix4 } from "../math/matrix4.js";
3
3
  import { ShapeOps } from "../oc/shape-ops.js";
4
+ import { resolveParam } from "../core/param.js";
4
5
  export class CopyLinear extends SceneObject {
5
6
  axes;
6
7
  options;
@@ -16,15 +17,22 @@ export class CopyLinear extends SceneObject {
16
17
  if (!this.targetObjects) {
17
18
  objects = context.getActiveSceneObjects();
18
19
  }
19
- const { count, centered, skip } = this.options;
20
- const counts = Array.isArray(count)
21
- ? count
22
- : this.axes.map(() => count);
20
+ const originalShapes = objects.flatMap(obj => obj.getShapes());
21
+ for (const obj of objects) {
22
+ obj.removeShapes(this);
23
+ }
24
+ for (const shape of originalShapes) {
25
+ this.addShape(shape);
26
+ }
27
+ const { centered, skip } = this.options;
28
+ const counts = Array.isArray(this.options.count)
29
+ ? this.options.count
30
+ : this.axes.map(() => resolveParam(this.options.count));
23
31
  const offsets = 'offset' in this.options && this.options.offset !== undefined
24
- ? (Array.isArray(this.options.offset) ? this.options.offset : this.axes.map(() => this.options.offset))
32
+ ? (Array.isArray(this.options.offset) ? this.options.offset : this.axes.map(() => resolveParam(this.options.offset)))
25
33
  : null;
26
34
  const lengths = 'length' in this.options && this.options.length !== undefined
27
- ? (Array.isArray(this.options.length) ? this.options.length : this.axes.map(() => this.options.length))
35
+ ? (Array.isArray(this.options.length) ? this.options.length : this.axes.map(() => resolveParam(this.options.length)))
28
36
  : null;
29
37
  const axisOffsets = this.axes.map((_, a) => {
30
38
  if (offsets) {
@@ -58,12 +66,10 @@ export class CopyLinear extends SceneObject {
58
66
  const translation = this.axes[a].direction.multiply(distance);
59
67
  matrix = matrix.multiply(Matrix4.fromTranslationVector(translation));
60
68
  }
61
- for (const obj of objects) {
62
- for (const shape of obj.getShapes()) {
63
- const transformed = ShapeOps.transform(shape, matrix);
64
- transformed.setMeshSource(shape, matrix);
65
- this.addShape(transformed);
66
- }
69
+ for (const shape of originalShapes) {
70
+ const transformed = ShapeOps.transform(shape, matrix);
71
+ transformed.setMeshSource(shape, matrix);
72
+ this.addShape(transformed);
67
73
  }
68
74
  }
69
75
  }
@@ -2,6 +2,7 @@ import { Matrix4 } from "../math/matrix4.js";
2
2
  import { ShapeOps } from "../oc/shape-ops.js";
3
3
  import { GeometrySceneObject } from "./2d/geometry.js";
4
4
  import { AxisObjectBase } from "./axis-renderable-base.js";
5
+ import { resolveParam } from "../core/param.js";
5
6
  export class CopyLinear2D extends GeometrySceneObject {
6
7
  axes;
7
8
  options;
@@ -21,16 +22,23 @@ export class CopyLinear2D extends GeometrySceneObject {
21
22
  else {
22
23
  objects = allSiblings;
23
24
  }
25
+ const originalShapes = objects.flatMap(obj => obj.getShapes());
26
+ for (const obj of objects) {
27
+ obj.removeShapes(this);
28
+ }
29
+ for (const shape of originalShapes) {
30
+ this.addShape(shape);
31
+ }
24
32
  const resolvedAxes = this.axes.map(a => a instanceof AxisObjectBase ? a.getAxis() : a);
25
- const { count, centered, skip } = this.options;
26
- const counts = Array.isArray(count)
27
- ? count
28
- : resolvedAxes.map(() => count);
33
+ const { centered, skip } = this.options;
34
+ const counts = Array.isArray(this.options.count)
35
+ ? this.options.count
36
+ : resolvedAxes.map(() => resolveParam(this.options.count));
29
37
  const offsets = 'offset' in this.options && this.options.offset !== undefined
30
- ? (Array.isArray(this.options.offset) ? this.options.offset : resolvedAxes.map(() => this.options.offset))
38
+ ? (Array.isArray(this.options.offset) ? this.options.offset : resolvedAxes.map(() => resolveParam(this.options.offset)))
31
39
  : null;
32
40
  const lengths = 'length' in this.options && this.options.length !== undefined
33
- ? (Array.isArray(this.options.length) ? this.options.length : resolvedAxes.map(() => this.options.length))
41
+ ? (Array.isArray(this.options.length) ? this.options.length : resolvedAxes.map(() => resolveParam(this.options.length)))
34
42
  : null;
35
43
  const axisOffsets = resolvedAxes.map((_, a) => {
36
44
  if (offsets) {
@@ -64,12 +72,10 @@ export class CopyLinear2D extends GeometrySceneObject {
64
72
  const translation = resolvedAxes[a].direction.multiply(distance);
65
73
  matrix = matrix.multiply(Matrix4.fromTranslationVector(translation));
66
74
  }
67
- for (const obj of objects) {
68
- for (const shape of obj.getShapes()) {
69
- const transformed = ShapeOps.transform(shape, matrix);
70
- transformed.setMeshSource(shape, matrix);
71
- this.addShape(transformed);
72
- }
75
+ for (const shape of originalShapes) {
76
+ const transformed = ShapeOps.transform(shape, matrix);
77
+ transformed.setMeshSource(shape, matrix);
78
+ this.addShape(transformed);
73
79
  }
74
80
  }
75
81
  }