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
//! `ifc` — the facade. Pick your codecs and domains as cargo features.
//!
//! # The shape of the library
//!
//! ```text
//! codecs model domain views
//! --------------- --------------- ------------------
//! ifc-step \ / ifc-cost
//! ifc-xml >-----> ifc-model <--< ifc-schedule
//! (ifc-json) / (entities) \ ifc-properties, ...
//! ```
//!
//! Two separations hold this together, and both are enforced by tests rather
//! than convention:
//!
//! **1. The model knows no domain semantics.** [`Model`] stores
//! `(id, type_name, attributes)` and nothing else. It has never heard of a
//! cost item. Domain crates are *views* that borrow a `&Model` and interpret
//! it, so a build without them still reads and writes their data untouched.
//!
//! **2. The model knows no serialization.** [`Codec`] is a trait *in the model
//! crate*; `ifc-step` and `ifc-xml` implement it. IFC-JSON would be a third
//! implementation, requiring no change to the model.
//!
//! # Choosing features
//!
//! | Feature | Pulls in | For |
//! | --- | --- | --- |
//! | `step` *(default)* | `ifc-step` | Reading `.ifc` files |
//! | `ifcxml` | `ifc-xml` | Reading/writing `.ifcxml` |
//! | `schema` | `ifc-schema` | Subtype queries, conformant XML names |
//! | `material-templates` | `ifc-material` + template catalog | Material PSD applicability |
//! | `cost`, `schedule`, ... | one domain crate each | Interpreting that domain |
//! | `codecs` | both codecs | |
//! | `domains` | every domain view | |
//! | `full` | everything | |
//!
//! A thin viewer takes `default-features = false, features = ["step"]` and
//! compiles no domain code and no geometry stack, while still round-tripping
//! every entity in the file.
//!
//! ```
//! # #[cfg(feature = "step")] {
//! use ifc::{Codec, StepCodec};
//!
//! let source = b"ISO-10303-21;\nHEADER;\nFILE_DESCRIPTION((''),'2;1');\n\
//! FILE_NAME('t.ifc','',( ''),(''),'','','');\n\
//! FILE_SCHEMA(('IFC4'));\nENDSEC;\nDATA;\n\
//! #1= IFCCOSTITEM('guid',$,'Excavation',$,$,$,$);\n\
//! ENDSEC;\nEND-ISO-10303-21;\n";
//!
//! let model = StepCodec.read_bytes(source).unwrap();
//! assert_eq!(model.len(), 1);
//!
//! // The cost entity is present and re-exportable with no `cost` feature on.
//! let out = StepCodec.write_bytes(&model).unwrap();
//! assert!(String::from_utf8_lossy(&out).contains("IFCCOSTITEM"));
//! # }
//! ```
// The model is always available: it is the common vocabulary.
pub use ;
// `EntityEditor::stage` and the domain writers take a transaction; without
// these a facade user could build an editor but never apply it.
pub use ;
/// The STEP physical file codec (`.ifc`).
pub use StepCodec;
/// A STEP reader with an explicit policy: recovery, eager decoding, or a
/// memory-mapped read ([`StepReader::read_path_mapped`]).
pub use ;
/// The ifcXML codec (`.ifcxml`).
pub use ;
/// The IFC schema as queryable data.
pub use ;
/// The whole schema crate, including the bundled schemas
/// (`schema::ifc4()`, `schema::for_version(..)`) that
/// [`ids_of_type_including_subtypes`] needs as input.
pub use ifc_schema as schema;
// Needs the model's type index and the schema's subtype tree, which ADR 0003
// keeps in separate crates, so the join lives in this orchestration layer.
pub use ids_of_type_including_subtypes;
/// Cost semantics as a borrowed view.
pub use ifc_cost as cost;
/// Property sets and quantities.
pub use ifc_properties as properties;
/// Versioned external PSD/QTO template catalogs and correction profiles.
pub use ifc_template_catalog as property_catalog;
/// Tasks, sequencing, calendars.
pub use ifc_schedule as schedule;
/// Material layer sets, profile sets, constituents.
pub use ifc_material as material;
/// Classification, documents, libraries, and external-reference relationships.
pub use ifc_classification as classification;
/// Approval resource semantics and approval associations.
pub use ifc_approval as approval;
/// Permits, project orders, action requests, and performance history.
pub use ifc_control as control;
/// Tables and time series: value containers indexed by position or time.
pub use ifc_tabular as tabular;
/// Metrics, objectives, and constraint relationships.
pub use ifc_constraint as constraint;
/// Element, resource, and process type definitions.
pub use ifc_element_type as element_type;
/// Built element and distribution occurrence classes.
pub use ifc_occurrence as occurrence;
/// Structural analysis model.
pub use ifc_structural as structural;
/// Construction resources: actors, labour, equipment, crew, material,
/// product, subcontract, resource types, inventory, and usage quantities.
pub use ifc_resource as resource;
/// Distribution systems and ports.
pub use ifc_systems as systems;
/// Presentation styles.
pub use ifc_style as style;
/// Schema and integrity validation.
pub use ifc_validate as validate;
/// Schema-checked construction and editing of entities.
pub use ifc_author as author;
/// Build or edit an entity by naming attributes rather than positioning them.
pub use ;
/// Containment and objectified relationship traversal.
pub use ifc_spatial as spatial;
/// The project/site/building/storey/element tree of a model.
pub use ;
/// Representation selection and, with `geometry`, lowering to the DAG.
///
/// Available under `geometry-select` too: the module is the same, but a
/// select-only build compiles no geometry kernel and therefore exposes no
/// `lower` submodule.
pub use ifc_geometry as geometry;
/// Representation contexts and the selectors that choose 3D or 2D geometry.
///
/// Re-exported at the root because choosing what a drawing draws is a
/// first-class question, not an implementation detail of lowering.
pub use ;
/// Where a product sits in the world.
///
/// Re-exported at the root, and available without the geometry kernel,
/// because every consumer needs world coordinates and a hand-rolled
/// `IfcLocalPlacement` walk is the most commonly botched code in an IFC
/// viewer: the composition order and the unit scaling are both easy to
/// invert.
pub use ;
/// How a product's body is modelled: its representation kind and, for swept
/// solids, the profile parameters, direction and depth in SI and world
/// coordinates.
///
/// Available without the geometry kernel, because a rule check asking "is
/// this beam an extrusion of an HEA300" reads parameters, not a mesh.
pub use ;
/// Map conversion and coordinate reference systems.
pub use ifc_georef as georef;
/// IFC4x3 alignment and linear placement.
pub use ifc_alignment as alignment;
// Answering "will a viewer draw this" needs containment AND representation
// contexts -- two sibling domain crates that ADR 0003 forbids from depending on
// each other, so the check lives in this orchestration layer.
pub use ;
// A door's leaves and a window's panels need the product's placement AND its
// operation type and panel properties -- `ifc-geometry` and `ifc-properties`,
// siblings under ADR 0003 -- so the joins live in this orchestration layer
// (#148, #170). `operation` holds what the two share. Each of the three
// modules gates itself on `all(geometry-select, properties)` with an inner
// `#![cfg]`, so the declarations below compile to nothing without both.
pub use ;
// Each spatial container's elements with their exact properties (#121) joins
// `ifc-spatial` and `ifc-properties`, siblings under ADR 0003. The module
// gates itself on `all(spatial, properties)` with an inner `#![cfg]`.
pub use ;
pub use compiled_features;
pub use ;
pub use from_step_bytes;