@ifc-lite/create 3.1.0 → 4.0.0

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 (208) hide show
  1. package/README.md +9 -0
  2. package/dist/ifc-creator-math.d.ts +5 -7
  3. package/dist/ifc-creator-math.d.ts.map +1 -1
  4. package/dist/ifc-creator-math.js +8 -15
  5. package/dist/ifc-creator-math.js.map +1 -1
  6. package/dist/in-store/anchor.d.ts +25 -0
  7. package/dist/in-store/anchor.d.ts.map +1 -1
  8. package/dist/in-store/auto-space-detect.d.ts +1 -1
  9. package/dist/in-store/auto-space-detect.js +1 -1
  10. package/dist/in-store/beam.d.ts +10 -1
  11. package/dist/in-store/beam.d.ts.map +1 -1
  12. package/dist/in-store/beam.js +14 -25
  13. package/dist/in-store/beam.js.map +1 -1
  14. package/dist/in-store/column.d.ts +18 -1
  15. package/dist/in-store/column.d.ts.map +1 -1
  16. package/dist/in-store/column.js +37 -29
  17. package/dist/in-store/column.js.map +1 -1
  18. package/dist/in-store/copy-frame.d.ts +52 -0
  19. package/dist/in-store/copy-frame.d.ts.map +1 -0
  20. package/dist/in-store/copy-frame.js +99 -0
  21. package/dist/in-store/copy-frame.js.map +1 -0
  22. package/dist/in-store/copy-product.d.ts +96 -0
  23. package/dist/in-store/copy-product.d.ts.map +1 -0
  24. package/dist/in-store/copy-product.js +318 -0
  25. package/dist/in-store/copy-product.js.map +1 -0
  26. package/dist/in-store/curtain-wall.d.ts +87 -0
  27. package/dist/in-store/curtain-wall.d.ts.map +1 -0
  28. package/dist/in-store/curtain-wall.js +237 -0
  29. package/dist/in-store/curtain-wall.js.map +1 -0
  30. package/dist/in-store/door.d.ts +10 -4
  31. package/dist/in-store/door.d.ts.map +1 -1
  32. package/dist/in-store/door.js +23 -17
  33. package/dist/in-store/door.js.map +1 -1
  34. package/dist/in-store/element-type.d.ts +40 -0
  35. package/dist/in-store/element-type.d.ts.map +1 -0
  36. package/dist/in-store/element-type.js +60 -0
  37. package/dist/in-store/element-type.js.map +1 -0
  38. package/dist/in-store/extract-grids.d.ts +46 -0
  39. package/dist/in-store/extract-grids.d.ts.map +1 -0
  40. package/dist/in-store/extract-grids.js +211 -0
  41. package/dist/in-store/extract-grids.js.map +1 -0
  42. package/dist/in-store/extract-walls.d.ts +12 -23
  43. package/dist/in-store/extract-walls.d.ts.map +1 -1
  44. package/dist/in-store/extract-walls.js +14 -83
  45. package/dist/in-store/extract-walls.js.map +1 -1
  46. package/dist/in-store/generate-spaces.d.ts +1 -1
  47. package/dist/in-store/grid.d.ts +118 -0
  48. package/dist/in-store/grid.d.ts.map +1 -0
  49. package/dist/in-store/grid.js +194 -0
  50. package/dist/in-store/grid.js.map +1 -0
  51. package/dist/in-store/host-geometry-frame.d.ts +44 -0
  52. package/dist/in-store/host-geometry-frame.d.ts.map +1 -0
  53. package/dist/in-store/host-geometry-frame.js +146 -0
  54. package/dist/in-store/host-geometry-frame.js.map +1 -0
  55. package/dist/in-store/hosted-element-edit.d.ts +29 -0
  56. package/dist/in-store/hosted-element-edit.d.ts.map +1 -0
  57. package/dist/in-store/hosted-element-edit.js +120 -0
  58. package/dist/in-store/hosted-element-edit.js.map +1 -0
  59. package/dist/in-store/hosted-element.d.ts +41 -0
  60. package/dist/in-store/hosted-element.d.ts.map +1 -0
  61. package/dist/in-store/hosted-element.js +124 -0
  62. package/dist/in-store/hosted-element.js.map +1 -0
  63. package/dist/in-store/hosted-fill-read.d.ts +56 -0
  64. package/dist/in-store/hosted-fill-read.d.ts.map +1 -0
  65. package/dist/in-store/hosted-fill-read.js +197 -0
  66. package/dist/in-store/hosted-fill-read.js.map +1 -0
  67. package/dist/in-store/hosted-fill.d.ts +48 -0
  68. package/dist/in-store/hosted-fill.d.ts.map +1 -0
  69. package/dist/in-store/hosted-fill.js +58 -0
  70. package/dist/in-store/hosted-fill.js.map +1 -0
  71. package/dist/in-store/hosted-global-id.d.ts +8 -0
  72. package/dist/in-store/hosted-global-id.d.ts.map +1 -0
  73. package/dist/in-store/hosted-global-id.js +53 -0
  74. package/dist/in-store/hosted-global-id.js.map +1 -0
  75. package/dist/in-store/hosted-placement-edit.d.ts +30 -0
  76. package/dist/in-store/hosted-placement-edit.d.ts.map +1 -0
  77. package/dist/in-store/hosted-placement-edit.js +123 -0
  78. package/dist/in-store/hosted-placement-edit.js.map +1 -0
  79. package/dist/in-store/hosted-scale-chain.d.ts +12 -0
  80. package/dist/in-store/hosted-scale-chain.d.ts.map +1 -0
  81. package/dist/in-store/hosted-scale-chain.js +74 -0
  82. package/dist/in-store/hosted-scale-chain.js.map +1 -0
  83. package/dist/in-store/hosted-shape-edit.d.ts +9 -0
  84. package/dist/in-store/hosted-shape-edit.d.ts.map +1 -0
  85. package/dist/in-store/hosted-shape-edit.js +79 -0
  86. package/dist/in-store/hosted-shape-edit.js.map +1 -0
  87. package/dist/in-store/index.d.ts +59 -0
  88. package/dist/in-store/index.d.ts.map +1 -0
  89. package/dist/in-store/index.js +64 -0
  90. package/dist/in-store/index.js.map +1 -0
  91. package/dist/in-store/material.d.ts +62 -0
  92. package/dist/in-store/material.d.ts.map +1 -0
  93. package/dist/in-store/material.js +107 -0
  94. package/dist/in-store/material.js.map +1 -0
  95. package/dist/in-store/member.d.ts +8 -2
  96. package/dist/in-store/member.d.ts.map +1 -1
  97. package/dist/in-store/member.js +12 -14
  98. package/dist/in-store/member.js.map +1 -1
  99. package/dist/in-store/opening.d.ts +45 -0
  100. package/dist/in-store/opening.d.ts.map +1 -0
  101. package/dist/in-store/opening.js +104 -0
  102. package/dist/in-store/opening.js.map +1 -0
  103. package/dist/in-store/placement-frame.d.ts +9 -4
  104. package/dist/in-store/placement-frame.d.ts.map +1 -1
  105. package/dist/in-store/placement-frame.js +39 -39
  106. package/dist/in-store/placement-frame.js.map +1 -1
  107. package/dist/in-store/profile.d.ts +141 -0
  108. package/dist/in-store/profile.d.ts.map +1 -0
  109. package/dist/in-store/profile.js +174 -0
  110. package/dist/in-store/profile.js.map +1 -0
  111. package/dist/in-store/railing.d.ts +65 -0
  112. package/dist/in-store/railing.d.ts.map +1 -0
  113. package/dist/in-store/railing.js +112 -0
  114. package/dist/in-store/railing.js.map +1 -0
  115. package/dist/in-store/rel-connects-path.d.ts +43 -0
  116. package/dist/in-store/rel-connects-path.d.ts.map +1 -0
  117. package/dist/in-store/rel-connects-path.js +65 -0
  118. package/dist/in-store/rel-connects-path.js.map +1 -0
  119. package/dist/in-store/relate.d.ts +32 -0
  120. package/dist/in-store/relate.d.ts.map +1 -0
  121. package/dist/in-store/relate.js +39 -0
  122. package/dist/in-store/relate.js.map +1 -0
  123. package/dist/in-store/resolve-anchor.d.ts +21 -1
  124. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  125. package/dist/in-store/resolve-anchor.js +6 -2
  126. package/dist/in-store/resolve-anchor.js.map +1 -1
  127. package/dist/in-store/resolve-host.d.ts +16 -0
  128. package/dist/in-store/resolve-host.d.ts.map +1 -0
  129. package/dist/in-store/resolve-host.js +333 -0
  130. package/dist/in-store/resolve-host.js.map +1 -0
  131. package/dist/in-store/resolve-relations.d.ts +23 -0
  132. package/dist/in-store/resolve-relations.d.ts.map +1 -0
  133. package/dist/in-store/resolve-relations.js +57 -0
  134. package/dist/in-store/resolve-relations.js.map +1 -0
  135. package/dist/in-store/resolve-source.d.ts.map +1 -1
  136. package/dist/in-store/resolve-source.js +59 -63
  137. package/dist/in-store/resolve-source.js.map +1 -1
  138. package/dist/in-store/schema-attributes.d.ts +33 -0
  139. package/dist/in-store/schema-attributes.d.ts.map +1 -0
  140. package/dist/in-store/schema-attributes.js +102 -0
  141. package/dist/in-store/schema-attributes.js.map +1 -0
  142. package/dist/in-store/space-footprints.d.ts +55 -0
  143. package/dist/in-store/space-footprints.d.ts.map +1 -0
  144. package/dist/in-store/space-footprints.js +260 -0
  145. package/dist/in-store/space-footprints.js.map +1 -0
  146. package/dist/in-store/space.d.ts.map +1 -1
  147. package/dist/in-store/space.js +15 -3
  148. package/dist/in-store/space.js.map +1 -1
  149. package/dist/in-store/spatial-children.d.ts +1 -1
  150. package/dist/in-store/spatial-children.js +1 -1
  151. package/dist/in-store/stair-edit.d.ts +24 -0
  152. package/dist/in-store/stair-edit.d.ts.map +1 -0
  153. package/dist/in-store/stair-edit.js +190 -0
  154. package/dist/in-store/stair-edit.js.map +1 -0
  155. package/dist/in-store/stair.d.ts +58 -0
  156. package/dist/in-store/stair.d.ts.map +1 -0
  157. package/dist/in-store/stair.js +156 -0
  158. package/dist/in-store/stair.js.map +1 -0
  159. package/dist/in-store/wall-join-apply.d.ts +74 -0
  160. package/dist/in-store/wall-join-apply.d.ts.map +1 -0
  161. package/dist/in-store/wall-join-apply.js +137 -0
  162. package/dist/in-store/wall-join-apply.js.map +1 -0
  163. package/dist/in-store/wall-join-edit.d.ts +70 -0
  164. package/dist/in-store/wall-join-edit.d.ts.map +1 -0
  165. package/dist/in-store/wall-join-edit.js +217 -0
  166. package/dist/in-store/wall-join-edit.js.map +1 -0
  167. package/dist/in-store/wall-join-read.d.ts +60 -0
  168. package/dist/in-store/wall-join-read.d.ts.map +1 -0
  169. package/dist/in-store/wall-join-read.js +230 -0
  170. package/dist/in-store/wall-join-read.js.map +1 -0
  171. package/dist/in-store/wall-join.d.ts +122 -0
  172. package/dist/in-store/wall-join.d.ts.map +1 -0
  173. package/dist/in-store/wall-join.js +231 -0
  174. package/dist/in-store/wall-join.js.map +1 -0
  175. package/dist/in-store/wall-opening-fit.d.ts +11 -0
  176. package/dist/in-store/wall-opening-fit.d.ts.map +1 -0
  177. package/dist/in-store/wall-opening-fit.js +27 -0
  178. package/dist/in-store/wall-opening-fit.js.map +1 -0
  179. package/dist/in-store/wall.d.ts +32 -0
  180. package/dist/in-store/wall.d.ts.map +1 -1
  181. package/dist/in-store/wall.js +77 -13
  182. package/dist/in-store/wall.js.map +1 -1
  183. package/dist/in-store/window.d.ts +7 -0
  184. package/dist/in-store/window.d.ts.map +1 -1
  185. package/dist/in-store/window.js +24 -17
  186. package/dist/in-store/window.js.map +1 -1
  187. package/dist/index.d.ts +1 -31
  188. package/dist/index.d.ts.map +1 -1
  189. package/dist/index.js +2 -34
  190. package/dist/index.js.map +1 -1
  191. package/dist/landxml/cant-superelevation.d.ts +28 -0
  192. package/dist/landxml/cant-superelevation.d.ts.map +1 -0
  193. package/dist/landxml/cant-superelevation.js +31 -0
  194. package/dist/landxml/cant-superelevation.js.map +1 -0
  195. package/dist/landxml/landxml-to-ifc.d.ts +8 -2
  196. package/dist/landxml/landxml-to-ifc.d.ts.map +1 -1
  197. package/dist/landxml/landxml-to-ifc.js +34 -2
  198. package/dist/landxml/landxml-to-ifc.js.map +1 -1
  199. package/dist/landxml/refusals.d.ts.map +1 -1
  200. package/dist/landxml/refusals.js +8 -3
  201. package/dist/landxml/refusals.js.map +1 -1
  202. package/dist/landxml/result-types.d.ts +44 -0
  203. package/dist/landxml/result-types.d.ts.map +1 -1
  204. package/dist/landxml/writers.d.ts +4 -0
  205. package/dist/landxml/writers.d.ts.map +1 -1
  206. package/dist/landxml/writers.js +4 -2
  207. package/dist/landxml/writers.js.map +1 -1
  208. package/package.json +8 -7
@@ -0,0 +1,333 @@
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
+ * Resolve a `HostAnchor` — everything an opening or a hosted door/window needs
6
+ * to know about the wall or slab it is cut into — from a parsed store plus the
7
+ * live mutation overlay, so a host authored earlier in the same session works
8
+ * exactly like one read from the file.
9
+ *
10
+ * The in-store builders stay pure: this is the only place that walks the host
11
+ * graph. It reads the host's placement, its containing storey (via
12
+ * IfcRelContainedInSpatialStructure) and the bounds of its Body geometry, from
13
+ * which the opening builder derives the default cut depth.
14
+ */
15
+ import { firstProjAxis } from '@ifc-lite/data';
16
+ import { axis2d, axis3d, applyFrame, composeFrame, contextDimension, pointOf, refId, num, transformBounds, unit, vec3 } from './host-geometry-frame.js';
17
+ import { AnchorEntityReader, resolveSpatialAnchor } from './resolve-anchor.js';
18
+ const HOST_KINDS = new Map([
19
+ ['IFCWALL', 'wall'],
20
+ ['IFCWALLSTANDARDCASE', 'wall'],
21
+ ['IFCWALLELEMENTEDCASE', 'wall'],
22
+ ['IFCSLAB', 'slab'],
23
+ ['IFCSLABSTANDARDCASE', 'slab'],
24
+ ['IFCSLABELEMENTEDCASE', 'slab'],
25
+ ]);
26
+ export function resolveHostAnchor(store, hostExpressId, view) {
27
+ const reader = new AnchorEntityReader(store, view);
28
+ const host = reader.entity(hostExpressId);
29
+ if (!host)
30
+ throw new Error(`resolveHostAnchor: host #${hostExpressId} does not exist`);
31
+ const hostKind = HOST_KINDS.get(host.type.toUpperCase());
32
+ if (!hostKind) {
33
+ throw new Error(`resolveHostAnchor: #${hostExpressId} is an ${host.type}; openings are supported in IfcWall and IfcSlab hosts`);
34
+ }
35
+ const hostPlacementId = refId(named(host, 'ObjectPlacement', 5));
36
+ if (hostPlacementId === null || reader.entity(hostPlacementId)?.type.toUpperCase() !== 'IFCLOCALPLACEMENT') {
37
+ throw new Error(`resolveHostAnchor: host #${hostExpressId} has no IfcLocalPlacement to cut the opening in`);
38
+ }
39
+ const storeyId = containingStorey(reader, hostExpressId);
40
+ if (storeyId === null) {
41
+ throw new Error(`resolveHostAnchor: host #${hostExpressId} is not contained in a spatial structure element (IfcRelContainedInSpatialStructure)`);
42
+ }
43
+ const anchor = resolveSpatialAnchor(store, storeyId, view);
44
+ const shapeId = refId(named(host, 'Representation', 6));
45
+ const hostBounds = shapeId === null ? null : bodyBounds(reader, shapeId);
46
+ return { ...anchor, hostId: hostExpressId, hostKind, hostPlacementId, hostBounds };
47
+ }
48
+ /**
49
+ * The extent of `productId`'s Body geometry in its PARENT placement's frame
50
+ * (native units): the body bounds taken through the product's own
51
+ * RelativePlacement. For an opening placed relative to its host, that is the
52
+ * cut's extent in the host's frame, whatever profile or orientation the
53
+ * authoring tool gave it. Null when the product has no readable body.
54
+ */
55
+ export function placedBodyExtent(store, productId, view) {
56
+ const reader = new AnchorEntityReader(store, view);
57
+ const product = reader.entity(productId);
58
+ if (!product)
59
+ return null;
60
+ const shapeId = refId(named(product, 'Representation', 6));
61
+ const local = shapeId === null ? null : bodyBounds(reader, shapeId);
62
+ const placementId = refId(named(product, 'ObjectPlacement', 5));
63
+ const placement = placementId === null ? null : reader.entity(placementId);
64
+ if (!local || placement?.type.toUpperCase() !== 'IFCLOCALPLACEMENT' || refId(placement.attributes[1]) === null)
65
+ return null;
66
+ const frame = axis3d(reader, placement.attributes[1]);
67
+ if (!frame)
68
+ return null;
69
+ return transformBounds(local, frame);
70
+ }
71
+ /** Package-private Model Body bounds before ObjectPlacement. Plan annotation
72
+ * representations are not physical volume; unreadable 3D parts still refuse. */
73
+ export function localBodyExtent(store, productId, view) {
74
+ const reader = new AnchorEntityReader(store, view);
75
+ const product = reader.entity(productId);
76
+ const shapeId = product ? refId(named(product, 'Representation', 6)) : null;
77
+ return shapeId === null ? null : bodyBounds(reader, shapeId);
78
+ }
79
+ function named(record, name, fallback) {
80
+ const index = record.names.indexOf(name);
81
+ return record.attributes[index >= 0 ? index : fallback];
82
+ }
83
+ function containingStorey(reader, hostId) {
84
+ for (const relId of reader.ids('IFCRELCONTAINEDINSPATIALSTRUCTURE')) {
85
+ const rel = reader.entity(relId);
86
+ const related = rel ? named(rel, 'RelatedElements', 4) : null;
87
+ if (!rel || !Array.isArray(related) || !related.some((v) => refId(v) === hostId))
88
+ continue;
89
+ return refId(named(rel, 'RelatingStructure', 5));
90
+ }
91
+ return null;
92
+ }
93
+ // ---------------------------------------------------------------------------
94
+ // Body bounds
95
+ // ---------------------------------------------------------------------------
96
+ function bodyBounds(reader, productShapeId) {
97
+ const shape = reader.entity(productShapeId);
98
+ const reps = shape ? shape.attributes[2] : null;
99
+ if (!Array.isArray(reps))
100
+ return null;
101
+ const points = [];
102
+ for (const repRef of reps) {
103
+ const repId = refId(repRef);
104
+ const rep = repId === null ? null : reader.entity(repId);
105
+ if (!rep)
106
+ return null;
107
+ const identifier = rep.attributes[1];
108
+ if (typeof identifier === 'string' && identifier.toLowerCase() !== 'body')
109
+ continue;
110
+ const contextId = refId(rep.attributes[0]);
111
+ const dimension = contextId === null ? null : contextDimension(reader, contextId);
112
+ if (dimension === null)
113
+ return null;
114
+ if (dimension === 2)
115
+ continue;
116
+ const items = rep.attributes[3];
117
+ if (!Array.isArray(items) || items.length === 0)
118
+ return null;
119
+ for (const item of items) {
120
+ const itemId = refId(item);
121
+ if (itemId === null || !collectItemPoints(reader, itemId, points))
122
+ return null;
123
+ }
124
+ }
125
+ if (points.length === 0)
126
+ return null;
127
+ const min = [Infinity, Infinity, Infinity];
128
+ const max = [-Infinity, -Infinity, -Infinity];
129
+ for (const p of points) {
130
+ for (let i = 0; i < 3; i++) {
131
+ min[i] = Math.min(min[i], p[i]);
132
+ max[i] = Math.max(max[i], p[i]);
133
+ }
134
+ }
135
+ return { min, max };
136
+ }
137
+ /**
138
+ * Points bounding one representation item. A boolean result is bounded by its
139
+ * FirstOperand (a clipping only removes material, so the operand's bounds are
140
+ * conservative). Mapped items compose MappingTarget · MappingOrigin, matching the
141
+ * canonical Rust renderer. An iterative path set preserves two real instances of one map,
142
+ * while a work/point budget also bounds acyclic fan-out (#6232 D5).
143
+ */
144
+ function collectItemPoints(reader, itemId, out) {
145
+ const identity = { o: [0, 0, 0], x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] };
146
+ const stack = [{ id: itemId, frame: identity, exit: false }];
147
+ const path = new Set();
148
+ const records = new Map();
149
+ const mappings = new Map();
150
+ const leaves = new Map();
151
+ let work = 0;
152
+ while (stack.length) {
153
+ const task = stack.pop();
154
+ if (task.exit) {
155
+ path.delete(task.id);
156
+ continue;
157
+ }
158
+ if (++work > 10_000 || path.has(task.id))
159
+ return false;
160
+ path.add(task.id);
161
+ stack.push({ ...task, exit: true });
162
+ if (!records.has(task.id))
163
+ records.set(task.id, reader.entity(task.id));
164
+ const item = records.get(task.id);
165
+ if (!item)
166
+ return false;
167
+ const type = item.type.toUpperCase();
168
+ if (type === 'IFCBOOLEANRESULT' || type === 'IFCBOOLEANCLIPPINGRESULT') {
169
+ const id = refId(item.attributes[1]);
170
+ if (id === null)
171
+ return false;
172
+ stack.push({ id, frame: task.frame, exit: false });
173
+ continue;
174
+ }
175
+ if (type === 'IFCMAPPEDITEM') {
176
+ if (!mappings.has(task.id))
177
+ mappings.set(task.id, mappedItemFrame(reader, item.attributes));
178
+ const mapped = mappings.get(task.id);
179
+ if (!mapped || mapped.items.length > 10_000 - work)
180
+ return false;
181
+ const frame = composeFrame(task.frame, mapped.frame);
182
+ for (const id of mapped.items)
183
+ stack.push({ id, frame, exit: false });
184
+ continue;
185
+ }
186
+ let points = leaves.get(task.id);
187
+ if (!points) {
188
+ points = [];
189
+ if (type === 'IFCEXTRUDEDAREASOLID')
190
+ extrudedPoints(reader, item.attributes, points);
191
+ else if (type === 'IFCTRIANGULATEDFACESET' || type === 'IFCPOLYGONALFACESET') {
192
+ const list = refId(item.attributes[0]);
193
+ const coords = list === null ? null : reader.entity(list)?.attributes[0];
194
+ if (!Array.isArray(coords) || coords.length > 100_000)
195
+ return false;
196
+ for (const c of coords) {
197
+ const p = vec3(c);
198
+ if (!p)
199
+ return false;
200
+ points.push(p);
201
+ }
202
+ }
203
+ leaves.set(task.id, points);
204
+ }
205
+ if (points.length === 0 || out.length + points.length > 100_000)
206
+ return false;
207
+ for (const p of points) {
208
+ const placed = applyFrame(task.frame, p);
209
+ if (!placed.every(Number.isFinite))
210
+ return false;
211
+ out.push(placed);
212
+ }
213
+ }
214
+ return true;
215
+ }
216
+ function mappedItemFrame(reader, attrs) {
217
+ const mapId = refId(attrs[0]), targetId = refId(attrs[1]);
218
+ const map = mapId === null ? null : reader.entity(mapId);
219
+ const target = targetId === null ? null : reader.entity(targetId);
220
+ const originId = map ? refId(map.attributes[0]) : null;
221
+ const origin = originId === null ? null : reader.entity(originId);
222
+ const repId = map ? refId(map.attributes[1]) : null;
223
+ const rep = repId === null ? null : reader.entity(repId);
224
+ if (!map || !target || origin?.type.toUpperCase() !== 'IFCAXIS2PLACEMENT3D' || !pointOf(reader, origin.attributes[0]) || !rep || !Array.isArray(rep.attributes[3]))
225
+ return null;
226
+ const targetType = target.type.toUpperCase();
227
+ if (targetType !== 'IFCCARTESIANTRANSFORMATIONOPERATOR3D' && targetType !== 'IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM')
228
+ return null;
229
+ const a = target.attributes;
230
+ const o = pointOf(reader, a[2]);
231
+ // IfcBaseAxis derives Z first, projects Axis1 off Z, then projects Axis2
232
+ // off both. Axis2's sense permits mirroring; normalizing three unrelated
233
+ // supplied vectors would produce a skew instead of the specified operator.
234
+ // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/lexical/IfcBaseAxis.htm
235
+ const direction = (value, fallback) => value === null || value === undefined ? fallback : pointOf(reader, value, 'IFCDIRECTION');
236
+ const zAxis = unit(direction(a[4], [0, 0, 1]) ?? [0, 0, 0]);
237
+ if (!zAxis)
238
+ return null;
239
+ const project = (v, axes) => {
240
+ const p = [...v];
241
+ for (const axis of axes) {
242
+ const dot = v[0] * axis[0] + v[1] * axis[1] + v[2] * axis[2];
243
+ for (let i = 0; i < 3; i++)
244
+ p[i] -= dot * axis[i];
245
+ }
246
+ return unit(p);
247
+ };
248
+ const xArg = direction(a[0], firstProjAxis(zAxis));
249
+ const xAxis = xArg ? project(xArg, [zAxis]) : null;
250
+ const yArg = direction(a[1], [0, 1, 0]);
251
+ const yAxis = yArg && xAxis ? project(yArg, [zAxis, xAxis]) : null;
252
+ if (!xAxis || !yAxis)
253
+ return null;
254
+ const scale = a[3] === null || a[3] === undefined ? 1 : num(a[3]);
255
+ const scales = [scale, a[5] === null || a[5] === undefined ? scale : num(a[5]), a[6] === null || a[6] === undefined ? scale : num(a[6])];
256
+ if (!o || scales.some(v => v === null || v <= 0))
257
+ return null;
258
+ const [x, y, z] = [xAxis, yAxis, zAxis].map((v, i) => v.map(n => n * scales[i]));
259
+ const source = axis3d(reader, originId);
260
+ if (!source)
261
+ return null;
262
+ const items = rep.attributes[3].map(refId);
263
+ if (items.some(id => id === null) || items.length === 0)
264
+ return null;
265
+ return { items: items, frame: composeFrame({ o, x, y, z }, source) };
266
+ }
267
+ /** IfcExtrudedAreaSolid: SweptArea(0), Position(1), ExtrudedDirection(2), Depth(3). */
268
+ function extrudedPoints(reader, attrs, out) {
269
+ const profileId = refId(attrs[0]);
270
+ const outline = profileId === null ? null : profileOutline(reader, profileId);
271
+ const depth = num(attrs[3]);
272
+ const dir = pointOf(reader, attrs[2], 'IFCDIRECTION');
273
+ if (!outline || depth === null || depth <= 0 || !dir)
274
+ return;
275
+ const len = Math.hypot(dir[0], dir[1], dir[2]);
276
+ if (len === 0)
277
+ return;
278
+ const d = [dir[0] / len * depth, dir[1] / len * depth, dir[2] / len * depth];
279
+ const frame = axis3d(reader, attrs[1]);
280
+ if (!frame)
281
+ return;
282
+ for (const [px, py] of outline) {
283
+ for (const t of [0, 1]) {
284
+ const local = [px + d[0] * t, py + d[1] * t, d[2] * t];
285
+ out.push(applyFrame(frame, local));
286
+ }
287
+ }
288
+ }
289
+ /** Profile outline in the solid's XY, after the profile's own Position. */
290
+ function profileOutline(reader, profileId) {
291
+ const profile = reader.entity(profileId);
292
+ if (!profile)
293
+ return null;
294
+ const type = profile.type.toUpperCase();
295
+ if (type === 'IFCRECTANGLEPROFILEDEF' || type === 'IFCRECTANGLEHOLLOWPROFILEDEF' || type === 'IFCROUNDEDRECTANGLEPROFILEDEF') {
296
+ const xd = num(profile.attributes[3]);
297
+ const yd = num(profile.attributes[4]);
298
+ if (xd === null || yd === null || xd <= 0 || yd <= 0)
299
+ return null;
300
+ const frame = axis2d(reader, profile.attributes[2]);
301
+ if (!frame)
302
+ return null;
303
+ return [[-1, -1], [1, -1], [1, 1], [-1, 1]].map(([sx, sy]) => {
304
+ const x = sx * xd / 2;
305
+ const y = sy * yd / 2;
306
+ return [frame.o[0] + frame.x[0] * x - frame.x[1] * y, frame.o[1] + frame.x[1] * x + frame.x[0] * y];
307
+ });
308
+ }
309
+ if (type === 'IFCARBITRARYCLOSEDPROFILEDEF' || type === 'IFCARBITRARYPROFILEDEFWITHVOIDS') {
310
+ const curveId = refId(profile.attributes[2]);
311
+ const curve = curveId === null ? null : reader.entity(curveId);
312
+ if (!curve)
313
+ return null;
314
+ const curveType = curve.type.toUpperCase();
315
+ let raw = [];
316
+ if (curveType === 'IFCPOLYLINE' && Array.isArray(curve.attributes[0])) {
317
+ raw = curve.attributes[0].map(p => pointOf(reader, p, 'IFCCARTESIANPOINT', 2)?.slice(0, 2));
318
+ }
319
+ else if (curveType === 'IFCINDEXEDPOLYCURVE') {
320
+ const listId = refId(curve.attributes[0]);
321
+ const list = listId === null ? null : reader.entity(listId)?.attributes[0];
322
+ if (Array.isArray(list))
323
+ raw = list;
324
+ }
325
+ const points = raw.map(value => vec3(value, 2));
326
+ if (points.some(p => p === null))
327
+ return null;
328
+ const pts = points.map((p) => [p[0], p[1]]);
329
+ return pts.length >= 3 ? pts : null;
330
+ }
331
+ return null;
332
+ }
333
+ //# sourceMappingURL=resolve-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-host.js","sourceRoot":"","sources":["../../src/in-store/resolve-host.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAA0B,MAAM,0BAA0B,CAAC;AAIhL,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,UAAU,GAAkC,IAAI,GAAG,CAAC;I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C,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Read side for the type and material builders (#6232): the authoring anchor
3
+ * of a model that needs no storey, and the live one-to-many relationships an
4
+ * assignment has to extend or detach from. Both read through the mutation
5
+ * overlay, so a type or relationship authored earlier in the session counts.
6
+ */
7
+ import type { IfcDataStore } from '@ifc-lite/parser';
8
+ import type { MutablePropertyView } from '@ifc-lite/mutations';
9
+ import type { ExistingRelatedList } from './cost.js';
10
+ import type { AuthoringAnchor } from './element-type.js';
11
+ /** Owner history, schema and length unit of a model, with the same IFC2X3 owner-history rule as `resolveSpatialAnchor`. */
12
+ export declare function resolveAuthoringAnchor(store: IfcDataStore, view?: MutablePropertyView | null): AuthoringAnchor;
13
+ /** Every live `IfcRelDefinesByType` / `IfcRelAssociatesMaterial`: RelatedObjects (slot 4) and the relating side (slot 5). */
14
+ export declare function readRelatedLists(store: IfcDataStore, relType: 'IfcRelDefinesByType' | 'IfcRelAssociatesMaterial', view?: MutablePropertyView | null): ExistingRelatedList[];
15
+ /** The live entity's class in `IfcPascalCase`-insensitive form (upper case), or null when it does not exist. */
16
+ export declare function liveEntityType(store: IfcDataStore, id: number, view?: MutablePropertyView | null): string | null;
17
+ /**
18
+ * Whether live entity `id` is an `expected` in the model's schema (the class or
19
+ * a subtype, or a member of the `expected` SELECT), e.g. `'IfcTypeObject'`,
20
+ * `'IfcObject'` or `'IfcMaterialSelect'`. False when the entity is not live.
21
+ */
22
+ export declare function liveEntityConforms(store: IfcDataStore, id: number, expected: string, view?: MutablePropertyView | null): boolean;
23
+ //# sourceMappingURL=resolve-relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-relations.d.ts","sourceRoot":"","sources":["../../src/in-store/resolve-relations.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWzD,2HAA2H;AAC3H,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,eAAe,CAW9G;AAED,6HAA6H;AAC7H,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,qBAAqB,GAAG,0BAA0B,EAC3D,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAChC,mBAAmB,EAAE,CAWvB;AAED,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEhH;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAChC,OAAO,CAKT"}
@@ -0,0 +1,57 @@
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 { AnchorEntityReader } from './resolve-anchor.js';
5
+ import { safeLengthUnitScale } from './length-unit-scale.js';
6
+ import { conformsTo, schemaRegistry } from './schema-attributes.js';
7
+ function refId(value) {
8
+ if (typeof value === 'number' && Number.isInteger(value) && value > 0)
9
+ return value;
10
+ if (typeof value === 'string' && /^#[1-9][0-9]*$/.test(value))
11
+ return Number(value.slice(1));
12
+ return null;
13
+ }
14
+ /** Owner history, schema and length unit of a model, with the same IFC2X3 owner-history rule as `resolveSpatialAnchor`. */
15
+ export function resolveAuthoringAnchor(store, view) {
16
+ const reader = new AnchorEntityReader(store, view);
17
+ const ownerHistoryId = reader.ids('IFCOWNERHISTORY').next().value ?? null;
18
+ const schema = (store.schemaVersion ?? 'IFC4');
19
+ if (schema === 'IFC2X3' && ownerHistoryId === null) {
20
+ throw new Error('resolveAuthoringAnchor: IFC2X3 requires IfcOwnerHistory, but the store has none');
21
+ }
22
+ const lengthUnitScale = store.source.byteLength > 0
23
+ ? safeLengthUnitScale(store.source, store.entityIndex, 'resolveAuthoringAnchor') ?? 1.0
24
+ : 1.0;
25
+ return { ownerHistoryId, schema, lengthUnitScale };
26
+ }
27
+ /** Every live `IfcRelDefinesByType` / `IfcRelAssociatesMaterial`: RelatedObjects (slot 4) and the relating side (slot 5). */
28
+ export function readRelatedLists(store, relType, view) {
29
+ const reader = new AnchorEntityReader(store, view);
30
+ const lists = [];
31
+ for (const relId of reader.ids(relType.toUpperCase())) {
32
+ const rel = reader.entity(relId);
33
+ const related = rel?.attributes[4];
34
+ const relatingId = refId(rel?.attributes[5]);
35
+ if (!Array.isArray(related) || relatingId === null)
36
+ continue;
37
+ lists.push({ relId, relatingId, relatedIds: related.map(refId).filter((id) => id !== null) });
38
+ }
39
+ return lists;
40
+ }
41
+ /** The live entity's class in `IfcPascalCase`-insensitive form (upper case), or null when it does not exist. */
42
+ export function liveEntityType(store, id, view) {
43
+ return new AnchorEntityReader(store, view).entity(id)?.type.toUpperCase() ?? null;
44
+ }
45
+ /**
46
+ * Whether live entity `id` is an `expected` in the model's schema (the class or
47
+ * a subtype, or a member of the `expected` SELECT), e.g. `'IfcTypeObject'`,
48
+ * `'IfcObject'` or `'IfcMaterialSelect'`. False when the entity is not live.
49
+ */
50
+ export function liveEntityConforms(store, id, expected, view) {
51
+ const type = liveEntityType(store, id, view);
52
+ if (type === null)
53
+ return false;
54
+ const schema = (store.schemaVersion ?? 'IFC4');
55
+ return conformsTo(schemaRegistry(schema, 'liveEntityConforms'), type, expected);
56
+ }
57
+ //# sourceMappingURL=resolve-relations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-relations.js","sourceRoot":"","sources":["../../src/in-store/resolve-relations.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEpE,SAAS,KAAK,CAAC,KAAc;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACpF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2HAA2H;AAC3H,MAAM,UAAU,sBAAsB,CAAC,KAAmB,EAAE,IAAiC;IAC3F,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC;IAC1E,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,MAAM,CAAwB,CAAC;IACtE,IAAI,MAAM,KAAK,QAAQ,IAAI,cAAc,KAAK,IAAI,EAAE,CAA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AmB,EAAE,EAAU,EAAE,IAAiC;IAC/F,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAmB,EACnB,EAAU,EACV,QAAgB,EAChB,IAAiC;IAEjC,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7C,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,MAAM,CAAwB,CAAC;IACtE,OAAO,UAAU,CAAC,cAAc,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAClF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-source.d.ts","sourceRoot":"","sources":["../../src/in-store/resolve-source.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG1G,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,gBAAgB,CAAC;AA0ChF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,gBAAgB,CAsHlB"}
1
+ {"version":3,"file":"resolve-source.d.ts","sourceRoot":"","sources":["../../src/in-store/resolve-source.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAA2E,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9H,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG1G,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,gBAAgB,CAAC;AA+BhF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,gBAAgB,CA8HlB"}
@@ -11,7 +11,7 @@
11
11
  * Lives in @ifc-lite/create alongside the in-store builders so the
12
12
  * backend layer can call it without needing parser internals.
13
13
  */
14
- import { EntityExtractor } from '@ifc-lite/parser';
14
+ import { EntityExtractor, effectiveStoreyId, resolveEffectiveRelationshipOverlay } from '@ifc-lite/parser';
15
15
  import { iterateEffectiveEntityIds } from '@ifc-lite/mutations';
16
16
  import { resolvedTypeName } from '@ifc-lite/data';
17
17
  import { asRef, createStyleEntityReader, refList } from './style-entity-reader.js';
@@ -32,23 +32,10 @@ const ASSOCIATION_REL_TYPES = [
32
32
  'IFCRELASSOCIATESCLASSIFICATION',
33
33
  'IFCRELASSOCIATESDOCUMENT',
34
34
  ];
35
- function asString(v) {
36
- if (v === null || v === undefined)
37
- return '$';
38
- if (typeof v === 'number')
39
- return `#${v}`;
40
- if (typeof v === 'string')
41
- return v;
42
- return '$';
43
- }
44
- /**
45
- * Like asString but maps the omitted-token sentinel (`$`) to `null`.
46
- * The editor serialises plain strings as quoted STEP literals, so the
47
- * verbatim `'$'` would land as `'$'` in output instead of the bare token.
48
- */
49
- function asRefOrNull(v) {
50
- const s = asString(v);
51
- return s === '$' ? null : s;
35
+ /** A reference slot as the verbatim `#N` token the editor writes back, or null when omitted. */
36
+ function refToken(v) {
37
+ const id = asRef(v);
38
+ return id === null ? null : `#${id}`;
52
39
  }
53
40
  function asNumber(v) {
54
41
  if (typeof v === 'number')
@@ -67,70 +54,79 @@ export function resolveDuplicateSource(store, sourceExpressId, editor) {
67
54
  if (editor?.getMutationView().isDeleted(sourceExpressId)) {
68
55
  throw new Error(`resolveDuplicateSource: entity #${sourceExpressId} was deleted`);
69
56
  }
70
- // @raw-entity-enumeration-ok point read of the duplicated source product's own placement chain; a deleted source was refused above and a created one has no bytes to duplicate from
71
- const sourceRef = store.entityIndex.byId.get(sourceExpressId);
72
- if (!sourceRef) {
73
- throw new Error(`resolveDuplicateSource: entity #${sourceExpressId} not found`);
74
- }
75
57
  const extractor = new EntityExtractor(store.source);
76
- const sourceEntity = extractor.extractEntity(sourceRef);
58
+ // With a session editor, every record is read as the next export writes it:
59
+ // an element created this session (it has no source bytes) and a moved one
60
+ // (its placement point edited) are duplicated as they are now (#6232 C3).
61
+ const read = editor ? createStyleEntityReader(store, editor) : (id) => {
62
+ // @raw-entity-enumeration-ok point read of the duplicated source product's own placement chain when no session editor was supplied
63
+ const ref = store.entityIndex.byId.get(id);
64
+ return ref ? extractor.extractEntity(ref) : null;
65
+ };
66
+ const sourceEntity = read(sourceExpressId);
77
67
  if (!sourceEntity) {
78
- throw new Error(`resolveDuplicateSource: could not parse #${sourceExpressId}`);
68
+ throw new Error(`resolveDuplicateSource: entity #${sourceExpressId} not found`);
79
69
  }
80
- const attrs = sourceEntity.attributes;
70
+ const attrs = [...sourceEntity.attributes];
81
71
  // OwnerHistory is optional in IFC4, so null is a valid round-trip
82
72
  // value here. The duplicate flow re-emits null on the new entity.
83
- const ownerHistoryId = asNumber(attrs[1]);
84
- const placementId = asNumber(attrs[5]);
85
- const representationId = asNumber(attrs[6]);
73
+ const ownerHistoryId = asRef(attrs[1]);
74
+ const placementId = asRef(attrs[5]);
75
+ const representationId = asRef(attrs[6]);
76
+ // A parsed `#N` is a bare number, which the editor would write back as an
77
+ // INTEGER, not a reference: carry the product's reference slots as `#N`.
78
+ attrs[1] = ownerHistoryId === null ? null : `#${ownerHistoryId}`;
79
+ attrs[6] = representationId === null ? null : `#${representationId}`;
86
80
  if (placementId === null) {
87
81
  throw new Error(`resolveDuplicateSource: #${sourceExpressId} has no ObjectPlacement — only IfcProduct can be duplicated`);
88
82
  }
89
- // @raw-entity-enumeration-ok point read of the duplicated source product's own placement chain; a deleted source was refused above and a created one has no bytes to duplicate from
90
- const placementRef = store.entityIndex.byId.get(placementId);
91
- if (!placementRef) {
92
- throw new Error(`resolveDuplicateSource: placement #${placementId} missing from index`);
93
- }
94
- const placementEntity = extractor.extractEntity(placementRef);
83
+ attrs[5] = `#${placementId}`;
84
+ const placementEntity = read(placementId);
95
85
  if (!placementEntity) {
96
- throw new Error(`resolveDuplicateSource: could not parse placement #${placementId}`);
86
+ throw new Error(`resolveDuplicateSource: could not read placement #${placementId}`);
97
87
  }
98
- const parentPlacementId = asNumber(placementEntity.attributes[0]); // PlacementRelTo
99
- const axisPlacementId = asNumber(placementEntity.attributes[1]); // RelativePlacement
88
+ const parentPlacementId = asRef(placementEntity.attributes[0]); // PlacementRelTo
89
+ const axisPlacementId = asRef(placementEntity.attributes[1]); // RelativePlacement
100
90
  if (axisPlacementId === null) {
101
91
  throw new Error(`resolveDuplicateSource: placement #${placementId} has no RelativePlacement`);
102
92
  }
103
- // @raw-entity-enumeration-ok point read of the duplicated source product's own placement chain; a deleted source was refused above and a created one has no bytes to duplicate from
104
- const axisPlacementRef = store.entityIndex.byId.get(axisPlacementId);
105
- if (!axisPlacementRef) {
106
- throw new Error(`resolveDuplicateSource: axis placement #${axisPlacementId} missing`);
107
- }
108
- const axisEntity = extractor.extractEntity(axisPlacementRef);
93
+ const axisEntity = read(axisPlacementId);
109
94
  if (!axisEntity) {
110
- throw new Error(`resolveDuplicateSource: could not parse axis #${axisPlacementId}`);
95
+ throw new Error(`resolveDuplicateSource: could not read axis #${axisPlacementId}`);
111
96
  }
112
- const locationId = asNumber(axisEntity.attributes[0]); // Location → IfcCartesianPoint
113
- const axisRef = asRefOrNull(axisEntity.attributes[1]); // Axis (optional)
114
- const refDirectionRef = asRefOrNull(axisEntity.attributes[2]); // RefDirection (optional)
97
+ const locationId = asRef(axisEntity.attributes[0]); // Location → IfcCartesianPoint
98
+ const axisRef = refToken(axisEntity.attributes[1]); // Axis (optional)
99
+ const refDirectionRef = refToken(axisEntity.attributes[2]); // RefDirection (optional)
115
100
  let sourceLocation = [0, 0, 0];
116
101
  if (locationId !== null) {
117
- // @raw-entity-enumeration-ok point read of the duplicated source product's own placement chain; a deleted source was refused above and a created one has no bytes to duplicate from
118
- const pointRef = store.entityIndex.byId.get(locationId);
119
- if (pointRef) {
120
- const pointEntity = extractor.extractEntity(pointRef);
121
- const coords = pointEntity?.attributes[0];
122
- if (Array.isArray(coords)) {
123
- sourceLocation = [
124
- asNumber(coords[0]) ?? 0,
125
- asNumber(coords[1]) ?? 0,
126
- asNumber(coords[2]) ?? 0,
127
- ];
128
- }
102
+ const coords = read(locationId)?.attributes[0];
103
+ if (Array.isArray(coords)) {
104
+ sourceLocation = [
105
+ asNumber(coords[0]) ?? 0,
106
+ asNumber(coords[1]) ?? 0,
107
+ asNumber(coords[2]) ?? 0,
108
+ ];
129
109
  }
130
110
  }
131
- // Containing storey lookup via the pre-built spatial hierarchy.
132
- // Falls back to null when the entity sits outside the spatial tree.
133
- const storeyId = store.spatialHierarchy?.elementToStorey?.get(sourceExpressId) ?? null;
111
+ // The duplicate must inherit the storey that saving this session would
112
+ // produce, including edited/deleted containment and aggregate ancestors.
113
+ const view = editor?.getMutationView();
114
+ const createdTypes = new Map(view?.getNewEntities().map((e) => [e.expressId, e.type]) ?? []);
115
+ const spatialContext = view?.hasPendingChanges() ? {
116
+ relationships: resolveEffectiveRelationshipOverlay(store, {
117
+ createdEntities: () => view.getNewEntities(),
118
+ mutatedEntityIds: () => view.getEffectiveChanges().map((change) => change.entityId),
119
+ namedAttributes: (id) => view.getAttributeMutationsForEntity(id)
120
+ .map(({ name, value }) => [name, value]),
121
+ positionalAttributes: (id) => view.getPositionalMutationsForEntity(id) ?? [],
122
+ entityType: (id) => view.getEntityTypeMutation(id)?.newType,
123
+ isDeleted: (id) => view.isDeleted(id),
124
+ }),
125
+ isDeleted: (id) => view.isDeleted(id),
126
+ typeName: (id) => view.getEntityTypeMutation(id)?.newType
127
+ ?? createdTypes.get(id) ?? store.entities.getTypeName(id),
128
+ } : null;
129
+ const storeyId = effectiveStoreyId(store, sourceExpressId, spatialContext) ?? null;
134
130
  // Association rels that reference the source — replayed against
135
131
  // the duplicate by `duplicateInStore` so the exported STEP carries
136
132
  // the same psets / qsets / material / classifications / documents