Skip to main content

Crate ifc_schema

Crate ifc_schema 

Source
Expand description

ifc-schema — the IFC schema as data, not as 2,500 generated structs.

§The decision

IfcOpenShell generates a class per IFC entity per schema version. That is a very large amount of code, and it must be regenerated for every schema release. This crate instead reads the normative EXPRESS files into tables and answers questions against them.

The evidence that this is the right call: IFC4x3 renames IfcBuildingElement to IfcBuiltElement and drops IfcProxy and the whole *StandardCase family. Generated types would fork the entire API surface; a table just holds different rows.

§What this crate is for

ModuleRole
versionWhich schema a file declares
expressParsing .exp source (opt-in express feature)
entityEntity descriptors: name, supertype, slots
attributeAttribute descriptors and declared types
typesDefined types, enumerations, selects
registryThe assembled, queryable schema

§Relationship to the model

ifc-model does not depend on this crate. The model stores whatever a file contains, valid or not. The schema is what you consult to interpret what was stored, and it is optional: a file whose schema is unknown still parses, and its entities still round-trip.

§Features

FeatureDefaultProvides
ifc2x3, ifc4, ifc4x1, ifc4x2, ifc4x3yesThat release’s bundled table and accessor (ifc2x3(), …)
artifactvia any releaseThe compiled-artifact decoder
expressnoSchema::from_express through openbim-step
generationnoThe artifact generator binary

A default build bundles every release. A build that turns defaults off and names one release still recognises every SchemaVersion, and for_version refuses the others with NotBundled – a typed error, never a panic, and distinct from an unknown header token.

§Owned declaration types

EntityDef, Attribute, TypeDef, TypeKind and WhereRule belong to this crate and are #[non_exhaustive]. The bundled tables decode straight into them without any parser crate; the openbim-step EXPRESS extractor is linked only by the opt-in express feature (for Schema::from_express) and by generation.

let schema = ifc_schema::ifc4();
assert!(schema.is_a("IFCWALL", "IfcRoot"));
assert_eq!(
    &schema.attribute_names("IfcWall")[..2],
    ["GlobalId", "OwnerHistory"]
);

Re-exports§

pub use attribute::AggregateKind;
pub use attribute::Aggregation;
pub use attribute::Attribute;
pub use attribute::Bound;
pub use entity::EntityDef;
pub use entity::InverseAttribute;
pub use entity::UniqueRule;
pub use entity::WhereRule;
pub use export::write_direct_structural_catalog;
pub use export::write_structural_catalog;
pub use export::StructuralCatalogSummary;
pub use registry::Schema;
pub use types::TypeDef;
pub use types::TypeKind;
pub use version::SchemaVersion;

Modules§

attribute
One positional attribute slot on an IFC entity, and aggregate shapes.
completeness
Prove a hand-written entity inventory is complete against the normative EXPRESS schema.
entity
Entity descriptors used by the IFC schema registry.
export
Deterministic, schema-derived structural catalog export.
registry
The assembled, queryable IFC schema.
types
Defined types, enumerations, and selects used by IFC schemas.
version
Which IFC schema version a file declares.

Structs§

NotBundled
A recognised IFC release whose table is not compiled into this build.

Enums§

BundledSchemaError
Failure decoding a compiled schema artifact.

Functions§

artifact_decode_schema
Decodes a compiled schema artifact produced by encode_schema (the generation feature).
for_version
The bundled schema for version.
ifc4
The bundled IFC4 ADD2 TC1 schema (776 entities, 397 types).
ifc2x3
The bundled IFC2x3 TC1 schema (653 entities, 327 types).
ifc4x1
The bundled IFC4X1 FINAL schema (801 entities, 400 types).
ifc4x2
The bundled IFC4X2 FINAL schema (816 entities, 407 types).
ifc4x3
The bundled IFC4X3 ADD2 schema (876 entities, 436 types).