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
expressParser for the official .exp files
entityEntity descriptors: name, supertype, slots
attributeAttribute descriptors and declared types
typesDefined types, enumerations, selects
registryThe assembled, queryable schema
inheritanceSupertype-chain walking

§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.

use ifc_schema::Schema;

let schema = Schema::from_express(
    "SCHEMA IFC4;\n\
     ENTITY IfcRoot; GlobalId : IfcGloballyUniqueId; END_ENTITY;\n\
     ENTITY IfcWall SUBTYPE OF (IfcRoot); Name : IfcLabel; END_ENTITY;\n\
     END_SCHEMA;",
);

assert!(schema.is_a("IFCWALL", "IfcRoot"));
assert_eq!(schema.attribute_names("IfcWall"), ["GlobalId", "Name"]);

Re-exports§

pub use export::write_direct_structural_catalog;
pub use export::write_structural_catalog;
pub use export::StructuralCatalogSummary;
pub use registry::Schema;
pub use version::SchemaVersion;

Modules§

attribute
One positional attribute slot on an IFC entity.
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.
express
Generic EXPRESS parsing delegated to the canonical STEP workspace.
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§

Attribute
One explicit positional attribute.
EntityDef
One structural entity declaration.
TypeDef
One TYPE declaration.

Enums§

TypeKind
Structural shape of a TYPE declaration.

Functions§

artifact_decode_schema
Decodes a compiled schema artifact produced by encode_schema (the generation feature).
for_version
The bundled schema for version, or None when none is bundled.
ifc4
The bundled IFC4 ADD2 TC1 schema (776 entities, 397 types).
ifc2x3
The bundled IFC2x3 TC1 schema (653 entities, 327 types).
ifc4x3
The bundled IFC4X3 ADD2 schema (876 entities, 436 types).