@ifc-lite/create 4.0.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/README.md +34 -0
  2. package/dist/in-store/align-boxes.d.ts +38 -0
  3. package/dist/in-store/align-boxes.d.ts.map +1 -0
  4. package/dist/in-store/align-boxes.js +97 -0
  5. package/dist/in-store/align-boxes.js.map +1 -0
  6. package/dist/in-store/anchor.d.ts.map +1 -1
  7. package/dist/in-store/anchor.js +13 -2
  8. package/dist/in-store/anchor.js.map +1 -1
  9. package/dist/in-store/beam.d.ts.map +1 -1
  10. package/dist/in-store/beam.js +3 -10
  11. package/dist/in-store/beam.js.map +1 -1
  12. package/dist/in-store/copy-array.d.ts +17 -0
  13. package/dist/in-store/copy-array.d.ts.map +1 -0
  14. package/dist/in-store/copy-array.js +47 -0
  15. package/dist/in-store/copy-array.js.map +1 -0
  16. package/dist/in-store/copy-batch.d.ts +27 -0
  17. package/dist/in-store/copy-batch.d.ts.map +1 -0
  18. package/dist/in-store/copy-batch.js +101 -0
  19. package/dist/in-store/copy-batch.js.map +1 -0
  20. package/dist/in-store/copy-dependent-walk.d.ts +27 -0
  21. package/dist/in-store/copy-dependent-walk.d.ts.map +1 -0
  22. package/dist/in-store/copy-dependent-walk.js +61 -0
  23. package/dist/in-store/copy-dependent-walk.js.map +1 -0
  24. package/dist/in-store/copy-frame.d.ts +4 -3
  25. package/dist/in-store/copy-frame.d.ts.map +1 -1
  26. package/dist/in-store/copy-frame.js +14 -1
  27. package/dist/in-store/copy-frame.js.map +1 -1
  28. package/dist/in-store/copy-product.d.ts +0 -20
  29. package/dist/in-store/copy-product.d.ts.map +1 -1
  30. package/dist/in-store/copy-product.js +35 -35
  31. package/dist/in-store/copy-product.js.map +1 -1
  32. package/dist/in-store/duplicate.d.ts +8 -0
  33. package/dist/in-store/duplicate.d.ts.map +1 -1
  34. package/dist/in-store/duplicate.js +8 -1
  35. package/dist/in-store/duplicate.js.map +1 -1
  36. package/dist/in-store/edit/effective-mutation-view.d.ts +6 -0
  37. package/dist/in-store/edit/effective-mutation-view.d.ts.map +1 -0
  38. package/dist/in-store/edit/effective-mutation-view.js +45 -0
  39. package/dist/in-store/edit/effective-mutation-view.js.map +1 -0
  40. package/dist/in-store/edit/effective-storey.d.ts +13 -0
  41. package/dist/in-store/edit/effective-storey.d.ts.map +1 -0
  42. package/dist/in-store/edit/effective-storey.js +36 -0
  43. package/dist/in-store/edit/effective-storey.js.map +1 -0
  44. package/dist/in-store/edit/effective-storeys.d.ts +9 -0
  45. package/dist/in-store/edit/effective-storeys.d.ts.map +1 -0
  46. package/dist/in-store/edit/effective-storeys.js +16 -0
  47. package/dist/in-store/edit/effective-storeys.js.map +1 -0
  48. package/dist/in-store/edit/hosted-opening-refit.d.ts +29 -0
  49. package/dist/in-store/edit/hosted-opening-refit.d.ts.map +1 -0
  50. package/dist/in-store/edit/hosted-opening-refit.js +168 -0
  51. package/dist/in-store/edit/hosted-opening-refit.js.map +1 -0
  52. package/dist/in-store/edit/length-unit-scale.d.ts +24 -0
  53. package/dist/in-store/edit/length-unit-scale.d.ts.map +1 -0
  54. package/dist/in-store/edit/length-unit-scale.js +37 -0
  55. package/dist/in-store/edit/length-unit-scale.js.map +1 -0
  56. package/dist/in-store/edit/linear-element-edit.d.ts +131 -0
  57. package/dist/in-store/edit/linear-element-edit.d.ts.map +1 -0
  58. package/dist/in-store/edit/linear-element-edit.js +259 -0
  59. package/dist/in-store/edit/linear-element-edit.js.map +1 -0
  60. package/dist/in-store/edit/metadata-clone-effective.d.ts +5 -0
  61. package/dist/in-store/edit/metadata-clone-effective.d.ts.map +1 -0
  62. package/dist/in-store/edit/metadata-clone-effective.js +47 -0
  63. package/dist/in-store/edit/metadata-clone-effective.js.map +1 -0
  64. package/dist/in-store/edit/metadata-clone.d.ts +40 -0
  65. package/dist/in-store/edit/metadata-clone.d.ts.map +1 -0
  66. package/dist/in-store/edit/metadata-clone.js +142 -0
  67. package/dist/in-store/edit/metadata-clone.js.map +1 -0
  68. package/dist/in-store/edit/placement-core.d.ts +140 -0
  69. package/dist/in-store/edit/placement-core.d.ts.map +1 -0
  70. package/dist/in-store/edit/placement-core.js +317 -0
  71. package/dist/in-store/edit/placement-core.js.map +1 -0
  72. package/dist/in-store/edit/polygon-clip.d.ts +58 -0
  73. package/dist/in-store/edit/polygon-clip.d.ts.map +1 -0
  74. package/dist/in-store/edit/polygon-clip.js +153 -0
  75. package/dist/in-store/edit/polygon-clip.js.map +1 -0
  76. package/dist/in-store/edit/read-profile.d.ts +6 -0
  77. package/dist/in-store/edit/read-profile.d.ts.map +1 -0
  78. package/dist/in-store/edit/read-profile.js +95 -0
  79. package/dist/in-store/edit/read-profile.js.map +1 -0
  80. package/dist/in-store/edit/slab-edit-frame.d.ts +40 -0
  81. package/dist/in-store/edit/slab-edit-frame.d.ts.map +1 -0
  82. package/dist/in-store/edit/slab-edit-frame.js +146 -0
  83. package/dist/in-store/edit/slab-edit-frame.js.map +1 -0
  84. package/dist/in-store/edit/slab-edit.d.ts +112 -0
  85. package/dist/in-store/edit/slab-edit.d.ts.map +1 -0
  86. package/dist/in-store/edit/slab-edit.js +275 -0
  87. package/dist/in-store/edit/slab-edit.js.map +1 -0
  88. package/dist/in-store/edit/slab-opening-carry.d.ts +10 -0
  89. package/dist/in-store/edit/slab-opening-carry.d.ts.map +1 -0
  90. package/dist/in-store/edit/slab-opening-carry.js +65 -0
  91. package/dist/in-store/edit/slab-opening-carry.js.map +1 -0
  92. package/dist/in-store/edit/split-guid.d.ts +29 -0
  93. package/dist/in-store/edit/split-guid.d.ts.map +1 -0
  94. package/dist/in-store/edit/split-guid.js +64 -0
  95. package/dist/in-store/edit/split-guid.js.map +1 -0
  96. package/dist/in-store/edit/split-target.d.ts +90 -0
  97. package/dist/in-store/edit/split-target.d.ts.map +1 -0
  98. package/dist/in-store/edit/split-target.js +116 -0
  99. package/dist/in-store/edit/split-target.js.map +1 -0
  100. package/dist/in-store/edit/target.d.ts +8 -0
  101. package/dist/in-store/edit/target.d.ts.map +1 -0
  102. package/dist/in-store/edit/target.js +5 -0
  103. package/dist/in-store/edit/target.js.map +1 -0
  104. package/dist/in-store/edit/trim-extend-geometry.d.ts +99 -0
  105. package/dist/in-store/edit/trim-extend-geometry.d.ts.map +1 -0
  106. package/dist/in-store/edit/trim-extend-geometry.js +105 -0
  107. package/dist/in-store/edit/trim-extend-geometry.js.map +1 -0
  108. package/dist/in-store/edit/wall-axis-edit.d.ts +16 -0
  109. package/dist/in-store/edit/wall-axis-edit.d.ts.map +1 -0
  110. package/dist/in-store/edit/wall-axis-edit.js +40 -0
  111. package/dist/in-store/edit/wall-axis-edit.js.map +1 -0
  112. package/dist/in-store/edit/wall-edit.d.ts +157 -0
  113. package/dist/in-store/edit/wall-edit.d.ts.map +1 -0
  114. package/dist/in-store/edit/wall-edit.js +276 -0
  115. package/dist/in-store/edit/wall-edit.js.map +1 -0
  116. package/dist/in-store/edit/wall-hosted-cuts.d.ts +35 -0
  117. package/dist/in-store/edit/wall-hosted-cuts.d.ts.map +1 -0
  118. package/dist/in-store/edit/wall-hosted-cuts.js +27 -0
  119. package/dist/in-store/edit/wall-hosted-cuts.js.map +1 -0
  120. package/dist/in-store/edit/wall-opening-reassign.d.ts +18 -0
  121. package/dist/in-store/edit/wall-opening-reassign.d.ts.map +1 -0
  122. package/dist/in-store/edit/wall-opening-reassign.js +50 -0
  123. package/dist/in-store/edit/wall-opening-reassign.js.map +1 -0
  124. package/dist/in-store/element-align.d.ts +13 -0
  125. package/dist/in-store/element-align.d.ts.map +1 -0
  126. package/dist/in-store/element-align.js +90 -0
  127. package/dist/in-store/element-align.js.map +1 -0
  128. package/dist/in-store/element-replacement.d.ts +26 -0
  129. package/dist/in-store/element-replacement.d.ts.map +1 -0
  130. package/dist/in-store/element-replacement.js +68 -0
  131. package/dist/in-store/element-replacement.js.map +1 -0
  132. package/dist/in-store/element-size-edit.d.ts +40 -0
  133. package/dist/in-store/element-size-edit.d.ts.map +1 -0
  134. package/dist/in-store/element-size-edit.js +103 -0
  135. package/dist/in-store/element-size-edit.js.map +1 -0
  136. package/dist/in-store/element-split-axis.d.ts +6 -0
  137. package/dist/in-store/element-split-axis.d.ts.map +1 -0
  138. package/dist/in-store/element-split-axis.js +87 -0
  139. package/dist/in-store/element-split-axis.js.map +1 -0
  140. package/dist/in-store/element-split-joined.d.ts +13 -0
  141. package/dist/in-store/element-split-joined.d.ts.map +1 -0
  142. package/dist/in-store/element-split-joined.js +74 -0
  143. package/dist/in-store/element-split-joined.js.map +1 -0
  144. package/dist/in-store/element-split-placement.d.ts +19 -0
  145. package/dist/in-store/element-split-placement.d.ts.map +1 -0
  146. package/dist/in-store/element-split-placement.js +48 -0
  147. package/dist/in-store/element-split-placement.js.map +1 -0
  148. package/dist/in-store/element-split-slab.d.ts +19 -0
  149. package/dist/in-store/element-split-slab.d.ts.map +1 -0
  150. package/dist/in-store/element-split-slab.js +86 -0
  151. package/dist/in-store/element-split-slab.js.map +1 -0
  152. package/dist/in-store/element-split.d.ts +49 -0
  153. package/dist/in-store/element-split.d.ts.map +1 -0
  154. package/dist/in-store/element-split.js +52 -0
  155. package/dist/in-store/element-split.js.map +1 -0
  156. package/dist/in-store/element-transform-edit.d.ts +33 -0
  157. package/dist/in-store/element-transform-edit.d.ts.map +1 -0
  158. package/dist/in-store/element-transform-edit.js +97 -0
  159. package/dist/in-store/element-transform-edit.js.map +1 -0
  160. package/dist/in-store/element-transform-frames.d.ts +45 -0
  161. package/dist/in-store/element-transform-frames.d.ts.map +1 -0
  162. package/dist/in-store/element-transform-frames.js +121 -0
  163. package/dist/in-store/element-transform-frames.js.map +1 -0
  164. package/dist/in-store/element-transform-joins.d.ts +4 -0
  165. package/dist/in-store/element-transform-joins.d.ts.map +1 -0
  166. package/dist/in-store/element-transform-joins.js +62 -0
  167. package/dist/in-store/element-transform-joins.js.map +1 -0
  168. package/dist/in-store/element-transform-plan.d.ts +38 -0
  169. package/dist/in-store/element-transform-plan.d.ts.map +1 -0
  170. package/dist/in-store/element-transform-plan.js +115 -0
  171. package/dist/in-store/element-transform-plan.js.map +1 -0
  172. package/dist/in-store/element-trim-extend.d.ts +25 -0
  173. package/dist/in-store/element-trim-extend.d.ts.map +1 -0
  174. package/dist/in-store/element-trim-extend.js +97 -0
  175. package/dist/in-store/element-trim-extend.js.map +1 -0
  176. package/dist/in-store/extract-grids.d.ts +7 -17
  177. package/dist/in-store/extract-grids.d.ts.map +1 -1
  178. package/dist/in-store/extract-grids.js +11 -2
  179. package/dist/in-store/extract-grids.js.map +1 -1
  180. package/dist/in-store/grid-column.d.ts +23 -0
  181. package/dist/in-store/grid-column.d.ts.map +1 -0
  182. package/dist/in-store/grid-column.js +73 -0
  183. package/dist/in-store/grid-column.js.map +1 -0
  184. package/dist/in-store/grid-intersection-read.d.ts +10 -0
  185. package/dist/in-store/grid-intersection-read.d.ts.map +1 -0
  186. package/dist/in-store/grid-intersection-read.js +45 -0
  187. package/dist/in-store/grid-intersection-read.js.map +1 -0
  188. package/dist/in-store/grid.d.ts +7 -1
  189. package/dist/in-store/grid.d.ts.map +1 -1
  190. package/dist/in-store/grid.js +12 -2
  191. package/dist/in-store/grid.js.map +1 -1
  192. package/dist/in-store/group-evidence.d.ts +49 -0
  193. package/dist/in-store/group-evidence.d.ts.map +1 -0
  194. package/dist/in-store/group-evidence.js +111 -0
  195. package/dist/in-store/group-evidence.js.map +1 -0
  196. package/dist/in-store/group-graph.d.ts +51 -0
  197. package/dist/in-store/group-graph.d.ts.map +1 -0
  198. package/dist/in-store/group-graph.js +207 -0
  199. package/dist/in-store/group-graph.js.map +1 -0
  200. package/dist/in-store/group.d.ts +34 -0
  201. package/dist/in-store/group.d.ts.map +1 -0
  202. package/dist/in-store/group.js +181 -0
  203. package/dist/in-store/group.js.map +1 -0
  204. package/dist/in-store/host-geometry-frame.d.ts +5 -1
  205. package/dist/in-store/host-geometry-frame.d.ts.map +1 -1
  206. package/dist/in-store/host-geometry-frame.js +58 -10
  207. package/dist/in-store/host-geometry-frame.js.map +1 -1
  208. package/dist/in-store/index.d.ts +7 -0
  209. package/dist/in-store/index.d.ts.map +1 -1
  210. package/dist/in-store/index.js +7 -0
  211. package/dist/in-store/index.js.map +1 -1
  212. package/dist/in-store/linear-profile-frame.d.ts +10 -0
  213. package/dist/in-store/linear-profile-frame.d.ts.map +1 -0
  214. package/dist/in-store/linear-profile-frame.js +17 -0
  215. package/dist/in-store/linear-profile-frame.js.map +1 -0
  216. package/dist/in-store/material.d.ts.map +1 -1
  217. package/dist/in-store/material.js +17 -6
  218. package/dist/in-store/material.js.map +1 -1
  219. package/dist/in-store/member.d.ts.map +1 -1
  220. package/dist/in-store/member.js +3 -7
  221. package/dist/in-store/member.js.map +1 -1
  222. package/dist/in-store/ordinary-element.d.ts +47 -0
  223. package/dist/in-store/ordinary-element.d.ts.map +1 -0
  224. package/dist/in-store/ordinary-element.js +38 -0
  225. package/dist/in-store/ordinary-element.js.map +1 -0
  226. package/dist/in-store/placement-frame.d.ts +5 -17
  227. package/dist/in-store/placement-frame.d.ts.map +1 -1
  228. package/dist/in-store/placement-frame.js +59 -43
  229. package/dist/in-store/placement-frame.js.map +1 -1
  230. package/dist/in-store/resolve-anchor.d.ts +3 -2
  231. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  232. package/dist/in-store/resolve-anchor.js +7 -5
  233. package/dist/in-store/resolve-anchor.js.map +1 -1
  234. package/dist/in-store/resolve-relations.d.ts +3 -1
  235. package/dist/in-store/resolve-relations.d.ts.map +1 -1
  236. package/dist/in-store/resolve-relations.js +8 -3
  237. package/dist/in-store/resolve-relations.js.map +1 -1
  238. package/dist/in-store/resolve-source.d.ts.map +1 -1
  239. package/dist/in-store/resolve-source.js +10 -3
  240. package/dist/in-store/resolve-source.js.map +1 -1
  241. package/dist/in-store/room-candidates.d.ts +58 -0
  242. package/dist/in-store/room-candidates.d.ts.map +1 -0
  243. package/dist/in-store/room-candidates.js +135 -0
  244. package/dist/in-store/room-candidates.js.map +1 -0
  245. package/dist/in-store/room-creation-plan.d.ts +16 -0
  246. package/dist/in-store/room-creation-plan.d.ts.map +1 -0
  247. package/dist/in-store/room-creation-plan.js +28 -0
  248. package/dist/in-store/room-creation-plan.js.map +1 -0
  249. package/dist/in-store/room-floor-height.d.ts +24 -0
  250. package/dist/in-store/room-floor-height.d.ts.map +1 -0
  251. package/dist/in-store/room-floor-height.js +32 -0
  252. package/dist/in-store/room-floor-height.js.map +1 -0
  253. package/dist/in-store/room-footprint-native.d.ts +19 -0
  254. package/dist/in-store/room-footprint-native.d.ts.map +1 -0
  255. package/dist/in-store/room-footprint-native.js +117 -0
  256. package/dist/in-store/room-footprint-native.js.map +1 -0
  257. package/dist/in-store/room-layout-cache.d.ts +23 -0
  258. package/dist/in-store/room-layout-cache.d.ts.map +1 -0
  259. package/dist/in-store/room-layout-cache.js +84 -0
  260. package/dist/in-store/room-layout-cache.js.map +1 -0
  261. package/dist/in-store/room-layout-core.d.ts +68 -0
  262. package/dist/in-store/room-layout-core.d.ts.map +1 -0
  263. package/dist/in-store/room-layout-core.js +153 -0
  264. package/dist/in-store/room-layout-core.js.map +1 -0
  265. package/dist/in-store/room-population.d.ts +5 -0
  266. package/dist/in-store/room-population.d.ts.map +1 -0
  267. package/dist/in-store/room-population.js +28 -0
  268. package/dist/in-store/room-population.js.map +1 -0
  269. package/dist/in-store/room-space-meshes.d.ts +15 -0
  270. package/dist/in-store/room-space-meshes.d.ts.map +1 -0
  271. package/dist/in-store/room-space-meshes.js +38 -0
  272. package/dist/in-store/room-space-meshes.js.map +1 -0
  273. package/dist/in-store/room-store.d.ts +55 -0
  274. package/dist/in-store/room-store.d.ts.map +1 -0
  275. package/dist/in-store/room-store.js +173 -0
  276. package/dist/in-store/room-store.js.map +1 -0
  277. package/dist/in-store/room-storey-elevation.d.ts +5 -0
  278. package/dist/in-store/room-storey-elevation.d.ts.map +1 -0
  279. package/dist/in-store/room-storey-elevation.js +42 -0
  280. package/dist/in-store/room-storey-elevation.js.map +1 -0
  281. package/dist/in-store/room-storey-frame.d.ts +47 -0
  282. package/dist/in-store/room-storey-frame.d.ts.map +1 -0
  283. package/dist/in-store/room-storey-frame.js +48 -0
  284. package/dist/in-store/room-storey-frame.js.map +1 -0
  285. package/dist/in-store/room-wall-rects.d.ts +117 -0
  286. package/dist/in-store/room-wall-rects.d.ts.map +1 -0
  287. package/dist/in-store/room-wall-rects.js +157 -0
  288. package/dist/in-store/room-wall-rects.js.map +1 -0
  289. package/dist/in-store/schema-attributes.d.ts +3 -3
  290. package/dist/in-store/schema-attributes.d.ts.map +1 -1
  291. package/dist/in-store/schema-attributes.js +9 -7
  292. package/dist/in-store/schema-attributes.js.map +1 -1
  293. package/dist/in-store/slab.d.ts.map +1 -1
  294. package/dist/in-store/slab.js +1 -4
  295. package/dist/in-store/slab.js.map +1 -1
  296. package/dist/in-store/stair-removal.d.ts +17 -0
  297. package/dist/in-store/stair-removal.d.ts.map +1 -0
  298. package/dist/in-store/stair-removal.js +134 -0
  299. package/dist/in-store/stair-removal.js.map +1 -0
  300. package/dist/in-store/storey-plan-frame.d.ts +2 -1
  301. package/dist/in-store/storey-plan-frame.d.ts.map +1 -1
  302. package/dist/in-store/storey-plan-frame.js +20 -11
  303. package/dist/in-store/storey-plan-frame.js.map +1 -1
  304. package/dist/in-store/storey-reassignment-plan.d.ts +53 -0
  305. package/dist/in-store/storey-reassignment-plan.d.ts.map +1 -0
  306. package/dist/in-store/storey-reassignment-plan.js +237 -0
  307. package/dist/in-store/storey-reassignment-plan.js.map +1 -0
  308. package/dist/in-store/storey-reassignment.d.ts +8 -0
  309. package/dist/in-store/storey-reassignment.d.ts.map +1 -0
  310. package/dist/in-store/storey-reassignment.js +52 -0
  311. package/dist/in-store/storey-reassignment.js.map +1 -0
  312. package/dist/in-store/trim-extend-plan.d.ts +27 -0
  313. package/dist/in-store/trim-extend-plan.d.ts.map +1 -0
  314. package/dist/in-store/trim-extend-plan.js +49 -0
  315. package/dist/in-store/trim-extend-plan.js.map +1 -0
  316. package/dist/in-store/wall-join-edit.d.ts +0 -17
  317. package/dist/in-store/wall-join-edit.d.ts.map +1 -1
  318. package/dist/in-store/wall-join-edit.js +41 -7
  319. package/dist/in-store/wall-join-edit.js.map +1 -1
  320. package/dist/in-store/wall-section-edit.d.ts +16 -0
  321. package/dist/in-store/wall-section-edit.d.ts.map +1 -0
  322. package/dist/in-store/wall-section-edit.js +75 -0
  323. package/dist/in-store/wall-section-edit.js.map +1 -0
  324. package/dist/in-store/wall-size-edit.d.ts +29 -0
  325. package/dist/in-store/wall-size-edit.d.ts.map +1 -0
  326. package/dist/in-store/wall-size-edit.js +65 -0
  327. package/dist/in-store/wall-size-edit.js.map +1 -0
  328. package/dist/index.d.ts +24 -0
  329. package/dist/index.d.ts.map +1 -1
  330. package/dist/index.js +23 -0
  331. package/dist/index.js.map +1 -1
  332. package/dist/landxml/profile-geometry.d.ts +10 -0
  333. package/dist/landxml/profile-geometry.d.ts.map +1 -1
  334. package/dist/landxml/profile-geometry.js +16 -1
  335. package/dist/landxml/profile-geometry.js.map +1 -1
  336. package/package.json +9 -8
@@ -0,0 +1,259 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { fromNativeLength } from '../anchor.js';
5
+ import { profileSectionExtent } from '../profile.js';
6
+ import { sectionFromProfile } from './read-profile.js';
7
+ import { asExpressIdRef, asCoordinateTriple, asDirectionRatios, readAttributes, readPlacementAttributes, resolvePlacementChain, } from './placement-core.js';
8
+ export const MIN_LINEAR_SEGMENT_LENGTH = 0.05; // metres
9
+ const LINEAR_ELEMENT_STEP_TYPES = new Set(['IFCBEAM', 'IFCCOLUMN', 'IFCMEMBER']);
10
+ function stepTypeToLinearType(stepType) {
11
+ switch (stepType.toUpperCase()) {
12
+ case 'IFCBEAM':
13
+ return 'IfcBeam';
14
+ case 'IFCCOLUMN':
15
+ return 'IfcColumn';
16
+ case 'IFCMEMBER':
17
+ return 'IfcMember';
18
+ default:
19
+ return null;
20
+ }
21
+ }
22
+ const EPS = 1e-9;
23
+ function isPoint(value, expected) {
24
+ const p = asCoordinateTriple(value);
25
+ return p !== null && p.every((v, i) => Math.abs(v - expected[i]) < EPS);
26
+ }
27
+ function isDirection(value, expected) {
28
+ const d = asDirectionRatios(value);
29
+ const len = d ? Math.hypot(d[0], d[1], d[2]) : 0;
30
+ return d !== null && len > EPS && d.every((v, i) => Math.abs(v / len - expected[i]) < 1e-6);
31
+ }
32
+ /** An `IfcAxis2Placement3D` (or none) that neither moves nor rotates. */
33
+ function isIdentitySolidPosition(read, positionId) {
34
+ if (positionId === null)
35
+ return true;
36
+ const position = read(positionId);
37
+ if (!position || !isPoint(read(asExpressIdRef(position[0]))?.[0], [0, 0, 0]))
38
+ return false;
39
+ if (position[1] != null && !isDirection(read(asExpressIdRef(position[1]))?.[0], [0, 0, 1]))
40
+ return false;
41
+ return position[2] == null || isDirection(read(asExpressIdRef(position[2]))?.[0], [1, 0, 0]);
42
+ }
43
+ /**
44
+ * Resolve the chain for an IfcBeam / IfcColumn / IfcMember whose
45
+ * representation matches what `addBeamToStore` / `addColumnToStore`
46
+ * / `addMemberToStore` produce. Returns null when the chain doesn't
47
+ * match (mapped representation, non-rectangle profile, missing
48
+ * placement, etc.) so the caller can hide the split affordance.
49
+ */
50
+ export function resolveLinearElementChain(dataStore, view, editor, expressId, lengthUnitScale = 1) {
51
+ const rawType = editor.getEntityType(expressId);
52
+ if (!rawType || !LINEAR_ELEMENT_STEP_TYPES.has(rawType.toUpperCase()))
53
+ return null;
54
+ const elementType = stepTypeToLinearType(rawType);
55
+ if (!elementType)
56
+ return null;
57
+ // ObjectPlacement chain — gives us the start point AND the
58
+ // IfcAxis2Placement3D id for axis lookup.
59
+ const chain = resolvePlacementChain(dataStore, view, editor, expressId);
60
+ if (!chain)
61
+ return null;
62
+ // Pull the axis direction. IfcAxis2Placement3D.Axis (index 1) may
63
+ // be null → implicit world +Z (matches the column builder).
64
+ const axisAttrs = readPlacementAttributes(dataStore, view, editor, chain.axisPlacementId);
65
+ if (!axisAttrs)
66
+ return null;
67
+ const axisDirId = asExpressIdRef(axisAttrs[1]);
68
+ let axisDirection = [0, 0, 1];
69
+ if (axisDirId !== null) {
70
+ const dirAttrs = readPlacementAttributes(dataStore, view, editor, axisDirId);
71
+ if (!dirAttrs)
72
+ return null;
73
+ const ratios = asDirectionRatios(dirAttrs[0]);
74
+ if (!ratios)
75
+ return null;
76
+ // Reject NaN / Infinity components — those would propagate into
77
+ // every downstream split / projection call. The builder writes
78
+ // unit vectors but source-buffer entities can be malformed.
79
+ if (!Number.isFinite(ratios[0]) || !Number.isFinite(ratios[1]) || !Number.isFinite(ratios[2])) {
80
+ return null;
81
+ }
82
+ const len = Math.hypot(ratios[0], ratios[1], ratios[2]);
83
+ // Zero-length or unrepresentable axis isn't translatable; refuse rather than fall
84
+ // back silently to world +Z (which would silently mis-orient
85
+ // every downstream operation).
86
+ if (!Number.isFinite(len) || len < 1e-9)
87
+ return null;
88
+ axisDirection = [ratios[0] / len, ratios[1] / len, ratios[2] / len];
89
+ }
90
+ // Representation chain: same shape as walls but the length lives
91
+ // on the extrusion depth, not the profile XDim.
92
+ const elementAttrs = readAttributes(dataStore, view, editor, expressId);
93
+ if (!elementAttrs)
94
+ return null;
95
+ const productShapeId = asExpressIdRef(elementAttrs[6]);
96
+ if (productShapeId === null)
97
+ return null;
98
+ const productShapeAttrs = readAttributes(dataStore, view, editor, productShapeId);
99
+ if (!productShapeAttrs)
100
+ return null;
101
+ const reps = productShapeAttrs[2];
102
+ if (!Array.isArray(reps) || reps.length === 0)
103
+ return null;
104
+ const shapeRepId = asExpressIdRef(reps[0]);
105
+ if (shapeRepId === null)
106
+ return null;
107
+ const shapeRepAttrs = readAttributes(dataStore, view, editor, shapeRepId);
108
+ if (!shapeRepAttrs)
109
+ return null;
110
+ const items = shapeRepAttrs[3];
111
+ if (!Array.isArray(items) || items.length === 0)
112
+ return null;
113
+ const solidId = asExpressIdRef(items[0]);
114
+ if (solidId === null)
115
+ return null;
116
+ const solidAttrs = readAttributes(dataStore, view, editor, solidId);
117
+ if (!solidAttrs)
118
+ return null;
119
+ // The length runs along the PLACEMENT's axis only when the solid adds no
120
+ // rotation or offset of its own and extrudes along local +Z — the layout
121
+ // the in-store builders write. An imported beam that extrudes along a
122
+ // rotated solid position (AC20's `Unterzug-1`: solid Axis = +Y) must be
123
+ // refused, not cut along the wrong axis (#6233).
124
+ const read = (id) => (id === null ? null : readAttributes(dataStore, view, editor, id));
125
+ if (!isIdentitySolidPosition(read, asExpressIdRef(solidAttrs[1])))
126
+ return null;
127
+ if (solidAttrs[2] != null && !isDirection(read(asExpressIdRef(solidAttrs[2]))?.[0], [0, 0, 1]))
128
+ return null;
129
+ const profileId = asExpressIdRef(solidAttrs[0]);
130
+ const depthRaw = solidAttrs[3];
131
+ if (profileId === null ||
132
+ typeof depthRaw !== 'number' ||
133
+ !Number.isFinite(depthRaw) ||
134
+ depthRaw <= 0) {
135
+ return null;
136
+ }
137
+ // Cross-section dimensions from the IfcRectangleProfileDef
138
+ // (Width = XDim attr 3, Height = YDim attr 4). Not strictly
139
+ // needed for the split math, but exposed so callers building the
140
+ // new element can carry the same cross-section forward. Reject
141
+ // non-finite / non-positive — would silently produce zero-area
142
+ // or NaN-area profiles downstream.
143
+ const profileAttrs = readAttributes(dataStore, view, editor, profileId);
144
+ if (!profileAttrs)
145
+ return null;
146
+ // Centred, unrotated cross-section, as the builders write (the split
147
+ // re-authors a piece with a centred profile).
148
+ const profilePosition = read(asExpressIdRef(profileAttrs[2]));
149
+ if (profileAttrs[2] != null) {
150
+ if (!profilePosition || !isPoint(read(asExpressIdRef(profilePosition[0]))?.[0], [0, 0, 0]))
151
+ return null;
152
+ if (profilePosition[1] != null && !isDirection(read(asExpressIdRef(profilePosition[1]))?.[0], [1, 0, 0]))
153
+ return null;
154
+ }
155
+ // A rectangle reads as its XDim x YDim; the picker's other sections as their
156
+ // outer size, with the section itself carried for whoever writes a piece.
157
+ const profileType = editor.getEntityType(profileId);
158
+ const parsed = profileType ? sectionFromProfile(profileType, profileAttrs, lengthUnitScale, dataStore.schemaVersion ?? 'IFC4') : null;
159
+ if (!parsed)
160
+ return null;
161
+ const section = parsed.Type === 'Rectangle' ? null : parsed;
162
+ const [profileWidth, profileHeight] = profileSectionExtent(parsed);
163
+ const m = (native) => fromNativeLength({ lengthUnitScale }, native);
164
+ const [sx, sy, sz] = chain.coordinates;
165
+ return {
166
+ elementType,
167
+ startPointId: chain.cartesianPointId,
168
+ startCoordinates: [m(sx), m(sy), m(sz)],
169
+ axisDirection,
170
+ extrudedSolidId: solidId,
171
+ profileId,
172
+ depth: m(depthRaw),
173
+ profileWidth,
174
+ profileHeight,
175
+ profile: section,
176
+ lengthUnitScale,
177
+ };
178
+ }
179
+ /**
180
+ * Pure split-geometry math. Splits the linear element at
181
+ * `distance` metres from start. Returns the cut point + remaining
182
+ * lengths so the caller can shrink the source and add the right
183
+ * half via the matching `addBeam` / `addColumn` / `addMember`
184
+ * action.
185
+ *
186
+ * Same min-segment guard as walls (`MIN_LINEAR_SEGMENT_LENGTH`)
187
+ * so dragging the cursor to the very end of a column doesn't
188
+ * produce a sliver.
189
+ */
190
+ export function computeLinearElementSplitGeometry(chain, distance) {
191
+ if (!Number.isFinite(distance)) {
192
+ return { ok: false, reason: 'Split distance must be a finite number' };
193
+ }
194
+ if (distance <= MIN_LINEAR_SEGMENT_LENGTH ||
195
+ distance >= chain.depth - MIN_LINEAR_SEGMENT_LENGTH) {
196
+ return {
197
+ ok: false,
198
+ reason: `Split must be at least ${MIN_LINEAR_SEGMENT_LENGTH} m from each end (element is ${chain.depth.toFixed(2)} m)`,
199
+ };
200
+ }
201
+ const [sx, sy, sz] = chain.startCoordinates;
202
+ const [dx, dy, dz] = chain.axisDirection;
203
+ const cut = [sx + dx * distance, sy + dy * distance, sz + dz * distance];
204
+ const end = [
205
+ sx + dx * chain.depth,
206
+ sy + dy * chain.depth,
207
+ sz + dz * chain.depth,
208
+ ];
209
+ return {
210
+ ok: true,
211
+ geometry: {
212
+ leftDepth: distance,
213
+ cutPoint: cut,
214
+ endPoint: end,
215
+ rightDepth: chain.depth - distance,
216
+ width: chain.profileWidth,
217
+ height: chain.profileHeight,
218
+ },
219
+ };
220
+ }
221
+ /**
222
+ * Project an arbitrary storey-local 3D cursor onto the element's
223
+ * axis and return how far along the element (in metres from start)
224
+ * it lands. Clamps to `[0, depth]`.
225
+ */
226
+ export function projectOntoLinearAxis(chain, pointStoreyLocal) {
227
+ const [px, py, pz] = pointStoreyLocal;
228
+ const [sx, sy, sz] = chain.startCoordinates;
229
+ const [dx, dy, dz] = chain.axisDirection;
230
+ const ux = px - sx;
231
+ const uy = py - sy;
232
+ const uz = pz - sz;
233
+ // Axis is unit-length by resolveLinearElementChain's contract; we
234
+ // still divide through for robustness.
235
+ const denom = dx * dx + dy * dy + dz * dz;
236
+ if (denom < 1e-9)
237
+ return 0;
238
+ const t = (ux * dx + uy * dy + uz * dz) / denom;
239
+ return Math.max(0, Math.min(chain.depth, t));
240
+ }
241
+ /**
242
+ * Shrink the source linear element's extrusion to `newDepth`. Used
243
+ * by the split action's "left half" branch — the source's
244
+ * placement, axis, profile, and Pset relationships all stay; only
245
+ * the IfcExtrudedAreaSolid.Depth changes.
246
+ *
247
+ * Coerce-only: this is the equivalent of `setPositionalAttribute`
248
+ * for a known slot; we expose it via the helper module for
249
+ * symmetry with the other split helpers.
250
+ */
251
+ export function shrinkLinearElementDepth(editor, chain, newDepth) {
252
+ // `newDepth` is metres like the chain; the slot is native units.
253
+ editor.setPositionalAttribute(chain.extrudedSolidId, 3, newDepth / chain.lengthUnitScale);
254
+ }
255
+ // Re-export the asCoordinateTriple helper so callers that import
256
+ // linear-element-edit don't have to reach into placement-core too.
257
+ // Keeps the import surface tight for the slice action.
258
+ export { asCoordinateTriple };
259
+ //# sourceMappingURL=linear-element-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-element-edit.js","sourceRoot":"","sources":["../../../src/in-store/edit/linear-element-edit.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA2B/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAuB,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,CAAC,SAAS;AAUxD,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjF,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,QAAQ,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AA2CD,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB,SAAS,OAAO,CAAC,KAAc,EAAE,QAA2B;IAC1D,MAAM,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,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,CAAC,CAAC;AAC5F,CAAC;AAED,iEAAiE;AACjE,mEAAmE;AACnE,uDAAuD;AACvD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
2
+ /** Atomic split/copy batches share one draft editor; the budget therefore covers
3
+ * the complete operation, including assembly parts and repeated source copies. */
4
+ export declare function cloneEffectiveMetadata(view: MutablePropertyView, editor: StoreEditor, source: number, targets: number[]): void;
5
+ //# sourceMappingURL=metadata-clone-effective.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-clone-effective.d.ts","sourceRoot":"","sources":["../../../src/in-store/edit/metadata-clone-effective.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAS5E;kFACkF;AAClF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAgC9H"}
@@ -0,0 +1,47 @@
1
+ /** #7251: virtual and edited source sets have effective values that raw
2
+ * relationship sharing cannot carry. Use the same overlay API after memberships,
3
+ * preserving the native builder's same-name metadata priority. Current edits
4
+ * are authoritative; append-only history must never resurrect an undone set. */
5
+ const writesByEditor = new WeakMap();
6
+ const MAX_EFFECTIVE_METADATA_WRITES = 10000;
7
+ /** Atomic split/copy batches share one draft editor; the budget therefore covers
8
+ * the complete operation, including assembly parts and repeated source copies. */
9
+ export function cloneEffectiveMetadata(view, editor, source, targets) {
10
+ if (!view.hasChanges(source))
11
+ return;
12
+ const changes = view.getEffectiveChanges().filter(row => row.entityId === source);
13
+ const propertyNames = new Set(changes.filter(row => row.kind === 'pset-added' || row.kind === 'property').map(row => row.setName));
14
+ const quantityNames = new Set(changes.filter(row => row.kind === 'qset-added' || row.kind === 'quantity').map(row => row.setName));
15
+ const properties = view.getForEntity(source).filter(set => propertyNames.has(set.name));
16
+ const quantities = view.getQuantitiesForEntity(source).filter(set => quantityNames.has(set.name));
17
+ const writes = targets.length * (properties.reduce((sum, set) => sum + 1 + set.properties.length
18
+ + set.properties.filter(property => property.dataType !== undefined).length, 0)
19
+ + quantities.reduce((sum, set) => sum + 1 + set.quantities.length, 0));
20
+ const total = (writesByEditor.get(editor) ?? 0) + writes;
21
+ if (total > MAX_EFFECTIVE_METADATA_WRITES)
22
+ throw new Error('Effective metadata cloning exceeds 10000 writes in one operation; no metadata is silently omitted');
23
+ writesByEditor.set(editor, total);
24
+ for (const target of targets) {
25
+ const existingProperties = new Set(view.getForEntity(target).map(set => set.name));
26
+ const existingQuantities = new Set(view.getQuantitiesForEntity(target).map(set => set.name));
27
+ for (const set of properties) {
28
+ if (existingProperties.has(set.name))
29
+ continue;
30
+ view.createPropertySet(target, set.name, set.properties.map(property => ({ name: property.name, value: property.value, type: property.type, unit: property.unit })));
31
+ // The constructor preserves empty/null members; typed values also retain
32
+ // their native declared data type through the normal mutation writer.
33
+ for (const property of set.properties)
34
+ if (property.dataType !== undefined) {
35
+ view.setProperty(target, set.name, property.name, property.value, property.type, property.unit, false, property.dataType);
36
+ }
37
+ existingProperties.add(set.name);
38
+ }
39
+ for (const set of quantities) {
40
+ if (existingQuantities.has(set.name))
41
+ continue;
42
+ view.createQuantitySet(target, set.name, set.quantities.map(quantity => ({ name: quantity.name, value: quantity.value, quantityType: quantity.type, unit: quantity.unit })));
43
+ existingQuantities.add(set.name);
44
+ }
45
+ }
46
+ }
47
+ //# sourceMappingURL=metadata-clone-effective.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-clone-effective.js","sourceRoot":"","sources":["../../../src/in-store/edit/metadata-clone-effective.ts"],"names":[],"mappings":"AAKA;;;gFAGgF;AAChF,MAAM,cAAc,GAAG,IAAI,OAAO,EAAuB,CAAC;AAC1D,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAE5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* products. Used when an authoring operation produces siblings of
5
+ * a source entity (split, duplicate, etc.) — both halves of a split
6
+ * wall should keep the source's FireRating, etc.
7
+ *
8
+ * Strategy: append the target id(s) to each relationship's
9
+ * `RelatedObjects` list rather than cloning the relationship entity
10
+ * itself. Cheaper, less overlay growth, and the IFC schema allows
11
+ * many objects to share a single rel. Downstream tooling (IDS, Pset
12
+ * dumps, exports) reads each rel's RelatedObjects list, so the
13
+ * targets become first-class members.
14
+ *
15
+ * The relationships we touch:
16
+ *
17
+ * IfcRelDefinesByProperties — Psets / Qtos (the big one)
18
+ * IfcRelDefinesByType — occurrence → type binding
19
+ * IfcRelAssociatesClassification
20
+ * IfcRelAssociatesMaterial
21
+ * IfcRelContainedInSpatialStructure — storey containment
22
+ * IfcRelAggregates / IfcRelNests — element assemblies
23
+ *
24
+ * Containment is handled separately by callers that already use
25
+ * `addWallToStore` / `addSlabToStore` etc. (those builders emit a
26
+ * fresh `IfcRelContainedInSpatialStructure` for the new entity), so
27
+ * this helper deliberately skips it.
28
+ *
29
+ * Returns the number of relationships touched so callers can log
30
+ * useful telemetry. Returns 0 silently when the source has no
31
+ * relationships — that's a valid case.
32
+ */
33
+ import { type IfcDataStore } from '@ifc-lite/parser';
34
+ import { type MutablePropertyView, type StoreEditor } from '@ifc-lite/mutations';
35
+ export interface CloneMetadataResult {
36
+ /** Number of relationships that gained at least one target. */
37
+ relationshipsTouched: number;
38
+ }
39
+ export declare function cloneElementMetadata(dataStore: IfcDataStore, view: MutablePropertyView, editor: StoreEditor, sourceExpressId: number, targetExpressIds: number[]): CloneMetadataResult;
40
+ //# sourceMappingURL=metadata-clone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-clone.d.ts","sourceRoot":"","sources":["../../../src/in-store/edit/metadata-clone.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAiC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAqD,KAAK,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiBpI,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AASD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EAAE,GACzB,mBAAmB,CAuErB"}
@@ -0,0 +1,142 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Carry an element's Pset / Qto / classification / material / type
6
+ * relationships from a source IfcProduct onto one or more target
7
+ * products. Used when an authoring operation produces siblings of
8
+ * a source entity (split, duplicate, etc.) — both halves of a split
9
+ * wall should keep the source's FireRating, etc.
10
+ *
11
+ * Strategy: append the target id(s) to each relationship's
12
+ * `RelatedObjects` list rather than cloning the relationship entity
13
+ * itself. Cheaper, less overlay growth, and the IFC schema allows
14
+ * many objects to share a single rel. Downstream tooling (IDS, Pset
15
+ * dumps, exports) reads each rel's RelatedObjects list, so the
16
+ * targets become first-class members.
17
+ *
18
+ * The relationships we touch:
19
+ *
20
+ * IfcRelDefinesByProperties — Psets / Qtos (the big one)
21
+ * IfcRelDefinesByType — occurrence → type binding
22
+ * IfcRelAssociatesClassification
23
+ * IfcRelAssociatesMaterial
24
+ * IfcRelContainedInSpatialStructure — storey containment
25
+ * IfcRelAggregates / IfcRelNests — element assemblies
26
+ *
27
+ * Containment is handled separately by callers that already use
28
+ * `addWallToStore` / `addSlabToStore` etc. (those builders emit a
29
+ * fresh `IfcRelContainedInSpatialStructure` for the new entity), so
30
+ * this helper deliberately skips it.
31
+ *
32
+ * Returns the number of relationships touched so callers can log
33
+ * useful telemetry. Returns 0 silently when the source has no
34
+ * relationships — that's a valid case.
35
+ */
36
+ import { propertyDefinitionRefsOfValue } from '@ifc-lite/parser';
37
+ import { iterateEffectiveEntityIds } from '@ifc-lite/mutations';
38
+ import { readAttributes } from './placement-core.js';
39
+ import { asRef, refList } from '../style-entity-reader.js';
40
+ import { cloneEffectiveMetadata } from './metadata-clone-effective.js';
41
+ import { refToken } from '../copy-frame.js';
42
+ /** Relationship entity types we touch (case follows STEP storage form). */
43
+ const RELATIONSHIPS_TO_CLONE = [
44
+ // [type, related-objects-attribute-index, related-object-is-list-of-refs?]
45
+ ['IFCRELDEFINESBYPROPERTIES', 4],
46
+ ['IFCRELDEFINESBYTYPE', 4],
47
+ ['IFCRELASSOCIATESCLASSIFICATION', 4],
48
+ ['IFCRELASSOCIATESMATERIAL', 4],
49
+ ['IFCRELAGGREGATES', 5],
50
+ ['IFCRELNESTS', 5],
51
+ ];
52
+ /** These schema-known relationship slots are lists of entity references.
53
+ * Parsed numeric IDs must become explicit reference tokens for overlay writes;
54
+ * retaining numeric literals would disconnect every member on STEP export. */
55
+ function appendTargetsToList(raw, targets) {
56
+ return [...refList(raw), ...targets].map(refToken);
57
+ }
58
+ export function cloneElementMetadata(dataStore, view, editor, sourceExpressId, targetExpressIds) {
59
+ if (targetExpressIds.length === 0)
60
+ return { relationshipsTouched: 0 };
61
+ // Dedupe caller-side input so a target listed twice doesn't
62
+ // produce two appends. The per-rel `currentRelated.includes`
63
+ // guard below would catch it on the second pass, but on the
64
+ // first pass both copies would land in the new list.
65
+ const uniqueTargets = Array.from(new Set(targetExpressIds));
66
+ const notSharedProperties = new Set(), notSharedQuantities = new Set();
67
+ if (view.hasChanges(sourceExpressId))
68
+ for (const change of view.getEffectiveChanges()) {
69
+ if (change.entityId !== sourceExpressId || change.setName === undefined)
70
+ continue;
71
+ if (change.kind === 'pset-deleted')
72
+ notSharedProperties.add(change.setName);
73
+ if (change.kind === 'qset-deleted')
74
+ notSharedQuantities.add(change.setName);
75
+ // Edited source values are copied through the effective mutation view
76
+ // below, not by sharing their stale source definition.
77
+ if (change.kind === 'property')
78
+ notSharedProperties.add(change.setName);
79
+ if (change.kind === 'quantity')
80
+ notSharedQuantities.add(change.setName);
81
+ }
82
+ const propertyNames = new Map(), quantityNames = new Map();
83
+ const namesFor = (id, quantity) => {
84
+ const cache = quantity ? quantityNames : propertyNames;
85
+ let names = cache.get(id);
86
+ if (!names) {
87
+ const sets = quantity
88
+ ? view.getQuantitiesForEntity(id)
89
+ : view.getForEntity(id);
90
+ names = new Set(sets.map(set => set.name));
91
+ cache.set(id, names);
92
+ }
93
+ return names;
94
+ };
95
+ let touched = 0;
96
+ for (const [type, index] of RELATIONSHIPS_TO_CLONE) {
97
+ for (const { expressId: relId } of iterateEffectiveEntityIds(dataStore, view, [type])) {
98
+ const attrs = readAttributes(dataStore, view, editor, relId);
99
+ if (!attrs)
100
+ continue;
101
+ const currentRelated = refList(attrs[index]);
102
+ if (!currentRelated.includes(sourceExpressId))
103
+ continue;
104
+ // Skip targets that are already in the list — avoids duplicates
105
+ // when this is called twice for the same operation (idempotent).
106
+ // A set of definitions (#7681) has no one name to compare, so it is shared whole.
107
+ const definitions = type === 'IFCRELDEFINESBYPROPERTIES' ? propertyDefinitionRefsOfValue(attrs[5], asRef) : [];
108
+ const definitionId = definitions.length === 1 ? definitions[0] : null;
109
+ const definitionType = definitionId === null ? null : editor.getEntityType(definitionId)?.toUpperCase();
110
+ const namedSet = definitionType === 'IFCPROPERTYSET' || definitionType === 'IFCELEMENTQUANTITY';
111
+ const readName = namedSet && definitionId !== null ? readAttributes(dataStore, view, editor, definitionId)?.[2] : null;
112
+ const definitionName = typeof readName === 'string' ? readName : null;
113
+ // Logical set deletion is applied during STEP export rather than by
114
+ // editing the source relationship. Sharing that raw membership would
115
+ // restore the deleted set on the new piece.
116
+ if (definitionName !== null && (definitionType === 'IFCELEMENTQUANTITY'
117
+ ? notSharedQuantities : notSharedProperties).has(definitionName))
118
+ continue;
119
+ // A builder may already have authored canonical metadata for this piece.
120
+ // Retain that same-name set (especially its newly measured quantities),
121
+ // and share only distinct imported sets. The source itself is untouched.
122
+ const names = definitionName !== null
123
+ ? (id) => namesFor(id, definitionType === 'IFCELEMENTQUANTITY') : null;
124
+ const additions = uniqueTargets.filter(id => {
125
+ if (currentRelated.includes(id))
126
+ return false;
127
+ return names === null || definitionName === null || !names(id).has(definitionName);
128
+ });
129
+ if (additions.length === 0)
130
+ continue;
131
+ const newList = appendTargetsToList(attrs[index], additions);
132
+ editor.setPositionalAttribute(relId, index, newList);
133
+ if (names && definitionName !== null)
134
+ for (const id of additions)
135
+ names(id).add(definitionName);
136
+ touched++;
137
+ }
138
+ }
139
+ cloneEffectiveMetadata(view, editor, sourceExpressId, uniqueTargets);
140
+ return { relationshipsTouched: touched };
141
+ }
142
+ //# sourceMappingURL=metadata-clone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-clone.js","sourceRoot":"","sources":["../../../src/in-store/edit/metadata-clone.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,6BAA6B,EAAqB,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAsE,MAAM,qBAAqB,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,2EAA2E;AAC3E,MAAM,sBAAsB,GAAG;IAC7B,2EAA2E;IAC3E,CAAC,2BAA2B,EAAE,CAAC,CAAC;IAChC,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC1B,CAAC,gCAAgC,EAAE,CAAC,CAAC;IACrC,CAAC,0BAA0B,EAAE,CAAC,C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