1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
//! Attribute positions for the objectified relationships this crate reads.
//!
//! # Why these are constants and not schema lookups
//!
//! These six-slot layouts are fixed across IFC2x3, IFC4 and IFC4x3: the
//! relationship types inherit four attributes from `IfcRoot` and add two of
//! their own. Reading them from the schema would make every traversal depend on
//! a parsed `.exp` file to answer a question whose answer cannot change without
//! a new major schema.
//!
//! # The trap these encode
//!
//! The two relationships this crate cares about **disagree on slot order**:
//!
//! ```text
//! IfcRelAggregates 4 = RelatingObject 5 = RelatedObjects
//! IfcRelContainedInSpatialStructure 4 = RelatedElements 5 = RelatingStructure
//! ```
//!
//! Assuming a uniform "relating first" layout silently inverts containment:
//! elements become the parents of their storey. The positions below were read
//! from IFC4 ADD2 TC1 and are asserted against the shipped schema in
//! `tests/slot_layout.rs`.
/// Slot layout of one objectified relationship.
pub
/// `IfcRelAggregates`: decomposition, e.g. site to building, building to storey.
pub const AGGREGATES: RelSlots = RelSlots ;
/// `IfcRelContainedInSpatialStructure`: elements placed in a spatial container.
///
/// Note the inverted order relative to `AGGREGATES`.
pub const CONTAINED_IN: RelSlots = RelSlots ;
/// `IfcRelReferencedInSpatialStructure`: elements referenced by a spatial
/// structure in addition to the one containing them, e.g. a curtain wall
/// spanning several storeys.
///
/// Same inverted order as `CONTAINED_IN` (IFC2X3 TC1, IFC4 ADD2 TC1 and
/// IFC4X3 ADD2 all declare `RelatedElements` before `RelatingStructure`).
pub const REFERENCED_IN: RelSlots = RelSlots ;
/// `IfcRelNests`: ordered decomposition, e.g. a stair into its flights.
pub const NESTS: RelSlots = RelSlots ;
/// `IfcRelSpaceBoundary`: which element bounds a space, and how.
///
/// Slot 4 is `RelatingSpace`, slot 5 `RelatedBuildingElement`, so this
/// follows the same "relating first" order as `AGGREGATES`.
pub const SPACE_BOUNDARY: RelSlots = RelSlots ;
/// `IfcRelSpaceBoundary1stLevel`: adds `ParentBoundary` at slot 9.
pub const SPACE_BOUNDARY_1ST: RelSlots = RelSlots ;
/// `IfcRelSpaceBoundary2ndLevel`: adds `CorrespondingBoundary` at slot 10.
pub const SPACE_BOUNDARY_2ND: RelSlots = RelSlots ;
/// Every concrete type in the `IfcRelSpaceBoundary` hierarchy.
///
/// `Model::ids_of_type` matches an EXACT type name: it does not resolve
/// subtypes. A file storing `IfcRelSpaceBoundary2ndLevel` -- which is what
/// every real second-level BEM export writes -- would be invisible to a
/// lookup of the supertype alone, and the crate would report a building
/// with no boundaries at all rather than failing.
///
/// The hierarchy is closed at these three in IFC4, so it is enumerated here
/// and asserted against the shipped schemas in `tests/slot_layout.rs`. This
/// crate deliberately does not depend on `ifc-schema` (see `Cargo.toml`), so
/// there is no runtime `is_a` available to do it instead.
pub const SPACE_BOUNDARY_TYPES: =
;
/// `IfcRelCoversBldgElements`: finishes applied to an element.
///
/// A covering is a distinct element from the wall it clads, so a take-off
/// that ignores this double-counts nothing but misses every finish.
pub const COVERS_ELEMENTS: RelSlots = RelSlots ;
/// `IfcRelCoversSpaces`: finishes bounding a space.
///
/// Distinct from `COVERS_ELEMENTS`: the same suspended ceiling can cover a
/// slab (element) and a room (space), and the two answer different
/// questions. Merging them loses which.
pub const COVERS_SPACES: RelSlots = RelSlots ;
/// `IfcRelConnectsElements`: one element connected to another.
///
/// # The slot shift
///
/// This family puts `ConnectionGeometry` FIRST, at slot 4, so its two ends
/// sit at 5 and 6 -- not 4 and 5 like every other relationship in this
/// module. Reading 4/5 here yields the geometry as the relating end and the
/// relating element as the related end: a connection between a shape and a
/// wall, which is silently wrong rather than an error.
pub const CONNECTS_ELEMENTS: RelSlots = RelSlots ;
/// `IfcRelConnectsPathElements`: a connection carrying path priorities.
pub const CONNECTS_PATH_ELEMENTS: RelSlots = RelSlots ;
/// `IfcRelConnectsWithRealizingElements`: a connection realized by others.
pub const CONNECTS_WITH_REALIZING: RelSlots = RelSlots ;
/// Every concrete type in the `IfcRelConnectsElements` hierarchy.
///
/// Same exact-match problem as the space boundaries: a file storing the
/// path-elements form is invisible to a lookup of the supertype.
pub const CONNECTS_ELEMENT_TYPES: = ;
/// `IfcRelInterferesElements`: two elements occupying the same space.
///
/// Note this is NOT a subtype of `IfcRelConnectsElements` and does NOT
/// share its layout: its ends are back at 4 and 5, with the geometry after
/// them. Clash detection reads this.
pub const INTERFERES_ELEMENTS: RelSlots = RelSlots ;
/// `IfcRelAssignsToActor`: who is responsible for an object.
///
/// # The slot-5 trap
///
/// Every `IfcRelAssigns` subtype interposes `RelatedObjectsType` between the
/// two ends:
///
/// ```text
/// 4 = RelatedObjects 5 = RelatedObjectsType 6 = Relating<something>
/// ```
///
/// So the relating end is at **6**, and the related list comes FIRST at 4 --
/// the inverse of the aggregates layout. Slot 5 holds an enumeration, not a
/// reference, so a reader that assumes "relating at 5" silently finds
/// nothing and the assignment disappears without an error.
pub const ASSIGNS_TO_ACTOR: RelSlots = RelSlots ;
/// `IfcRelAssignsToProcess`: which task consumes or produces an object.
pub const ASSIGNS_TO_PROCESS: RelSlots = RelSlots ;
/// `IfcRelAssignsToProduct`: which product an object is assigned to.
pub const ASSIGNS_TO_PRODUCT: RelSlots = RelSlots ;
/// `IfcRelAssignsToGroupByFactor`: group membership carrying a ratio.
///
/// A concrete subtype of `IfcRelAssignsToGroup`, which other crates already
/// read. It is listed here so the type is reachable at all: an exact-name
/// lookup of the supertype does not find it.
pub const ASSIGNS_TO_GROUP_BY_FACTOR: RelSlots = RelSlots ;
/// `IfcRelDeclares`: what a project or library context declares.
///
/// The root of a file's object graph: an `IfcProject` declares its top-level
/// definitions here. Relating-first, 4/5.
pub const DECLARES: RelSlots = RelSlots ;
/// `IfcRelDefinesByObject`: an occurrence defined by another occurrence.
///
/// Related-FIRST: `RelatedObjects` is at 4 and `RelatingObject` at 5, the
/// inverse of `DECLARES` immediately above. This is how a mapped occurrence
/// points at the occurrence it was copied from.
pub const DEFINES_BY_OBJECT: RelSlots = RelSlots ;
/// `IfcRelFlowControlElements`: controls governing a flow element.
///
/// Related-first as well: the controls are at 4, the governed element at 5.
/// A thermostat controlling a boiler is stated this way round.
pub const FLOW_CONTROL_ELEMENTS: RelSlots = RelSlots ;
/// `IfcRelServicesBuildings`: which spatial structures a system serves.
///
/// Relating-first, 4/5. `ifc-systems` documents this layout to contrast it
/// against `IfcRelAssignsToGroup` but does not read it; the traversal lives
/// here with the other spatial relationships.
pub const SERVICES_BUILDINGS: RelSlots = RelSlots ;
/// `IfcRelConnectsWithEccentricity`: a structural connection with an offset.
///
/// A concrete subtype of `IfcRelConnectsStructuralMember`, which
/// `ifc-structural` reads by exact name and therefore misses. Shares the
/// parent's 4/5 layout; the eccentricity itself is at slot 10.
pub const CONNECTS_WITH_ECCENTRICITY: RelSlots = RelSlots ;
/// `IfcRelVoidsElement`: an element voided by an opening.
///
/// The opening is the *related* end: the element owns the void.
pub const VOIDS_ELEMENT: RelSlots = RelSlots ;
/// `IfcRelFillsElement`: an opening filled by an element.
///
/// The direction is inverted relative to `VOIDS_ELEMENT`: here the
/// *opening* is the relating end and the filling element is related.
/// A door fills an opening; the opening does not fill the door.
pub const FILLS_ELEMENT: RelSlots = RelSlots ;
/// `IfcRelProjectsElement`: an element with an added feature, e.g. a ledge.
pub const PROJECTS_ELEMENT: RelSlots = RelSlots ;
/// `IfcRelAdheresToElement`: surface features bound to an element.
pub const ADHERES_TO_ELEMENT: RelSlots = RelSlots ;
/// `IfcRelPositions`: products positioned by a positioning element.
pub const POSITIONS: RelSlots = RelSlots ;
/// `IfcRelAssignsToResource`: objects assigned to a resource.
///
/// `IfcRelAssigns` puts `RelatedObjects` at 4 and `RelatedObjectsType`
/// at 5, so the resource lands at 6 -- not the 4/5 pair the decompose
/// and connect families share.
pub const ASSIGNS_TO_RESOURCE: RelSlots = RelSlots ;
/// `IfcRelAssociatesProfileDef`: a profile associated with objects.
///
/// `IfcRelAssociates` puts `RelatedObjects` at 4, so the profile is at 5.
pub const ASSOCIATES_PROFILE_DEF: RelSlots = RelSlots ;