Expand description
ifc — the facade. Pick your codecs and domains as cargo features.
§The shape of the library
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.
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"));Modules§
- codec
- The serialization seam.
Structs§
- Applied
- What a committed transaction did.
- Entity
- One IFC entity instance.
- Entity
Id - An entity’s identifier as it appeared in the file (
#42→42). - Header
- Metadata describing the file and the schema it claims to follow.
- Model
- A parsed IFC file: header, entities, and indices over them.
- Parse
Options - A STEP reader with an explicit policy: recovery, eager decoding, or a
memory-mapped read (
StepReader::read_path_mapped). Malformed-record policy, re-exported so consumers need not depend onopenbim-stepdirectly to configure a reader. Parse behavior toggles. - Step
Codec - The STEP physical file codec (
.ifc). The STEP physical file codec. - Step
Reader - A STEP reader with an explicit policy: recovery, eager decoding, or a
memory-mapped read (
StepReader::read_path_mapped). A STEP codec carrying an explicit parse policy. - Transaction
- A batch of edits, validated together and applied as a unit.
Enums§
- Conflict
- A reason a transaction cannot be committed.
- Model
Error - Errors from reading, writing, or querying a model.
- OnMalformed
- A STEP reader with an explicit policy: recovery, eager decoding, or a
memory-mapped read (
StepReader::read_path_mapped). Malformed-record policy, re-exported so consumers need not depend onopenbim-stepdirectly to configure a reader. What to do when a data record cannot be parsed. - Value
- One attribute slot in an entity.
Traits§
- Codec
- Read and write one concrete IFC serialization.
Functions§
- codecs
- Every codec compiled into this build.
- compiled_
features - The feature set this build was compiled with, for diagnostics.
- from_
step_ bytes - Parse a
.ifc(STEP physical file) buffer without importingCodecor namingifc_step::StepCodecdirectly. - read_
path - Read a file, choosing the codec by content sniffing then extension.