ifc-spatial
IFC spatial containment and objectified relationship traversal: project, site, building, storey, element.
| Status | Implemented |
| Latest release | 0.3.0 (2026-09-29) |
| Registries | crates.io ifc-spatial |
| Via the facade | openbim-ifc feature spatial |
| API documentation | rustdoc · docs.rs |
| Source | crates/ifc-spatial/ |
Overview
ifc-spatial — containment and objectified relationship traversal.
Depends on
Changes
Latest release, 0.3.0 (2026-09-29):
Added
SpatialDraft::interior_or_exterior: the IFC2X3IfcSpace. InteriorOrExteriorSpace(IfcInternalOrExternalEnum), which that release requires, socreate_spatial_element_with_owner_historycan author an IFC2X3 space (#214). IFC4 and IFC4X3 do not declare the attribute: a value there, or on a container other than a space, is refused withAuthoringNotInSchema, a token outside IFC2X3's enumeration withAuthoringValueType, and the plain IFC4/IFC4X3create_spatial_elementrefuses it withAuthoringNotInSchemainstead of dropping it.create_project_with_owner_historytakes the project's representation contexts, so an IFC2X3IfcProject, which requiresRepresentationContexts(andUnitsInContext), can be authored (#214). Each context must resolve in the model or on the transaction (MissingReference), be anIfcRepresentationContext(WrongReferenceType), not be anIfcGeometricRepresentationSubContext(IFC2X3WR32, IFC4 and IFC4X3CorrectContext), and not repeat (Invalid); an empty slice leaves the attribute$, which IFC2X3 refuses withAuthoringRequired.- A constructor and builder setters on every draft:
SpatialDraft::new(),FacilityDraft::new(),ExternalSpatialDraft::new()andProjectLibraryDraft::new()start empty;BoundaryDraft::new(space, element, physical_or_virtual, internal_or_external)takes the four attributes the schema requires. Each optional field has a setter of the same name taking the unwrapped value (SpatialDraft::new().name("L1") .composition("ELEMENT")), followingifc-resource's drafts.
Fixed
- A model whose declared release has no bundled table is refused with
UnsupportedSchemaby the release-bound writers instead of panicking.
Changed (breaking)
assign_to_actor,assign_to_process,connect_with_realizing_elementsandinterfere_elementstake the&Modeland bind its declared release (#213). They wrote records with the wrong number of attributes: seven ofIfcRelAssignsToActor's andIfcRelAssignsToProcess's eight, eight ofIfcRelConnectsWithRealizingElements's nine, and ten forIfcRelInterferesElementswhere IFC4 declares nine. Each record is now laid out by attribute name with the release's own arity (the interference has ten attributes in IFC4X3). IFC4 records gain a trailing$for the first three (ActingRole,QuantityInProcess,ConnectionType) and the IFC4 interference loses its trailing$; IFC4X3 records of the first three gain the same trailing$, and its interference is unchanged. An IFC2X3 model, which requiresOwnerHistory(and declares noIfcRelInterferesElements), and a header binding no single verified release are refused; use the*_with_owner_historyvariants in IFC2X3.SpatialDraft,FacilityDraft,BoundaryDraft,ExternalSpatialDraftandProjectLibraryDraftare#[non_exhaustive]: struct literals and..Default::default()updates no longer compile outside the crate; build them withnewand the setters. Fields stay public for reading and assignment.SpatialDrafthas a new field,interior_or_exterior.create_project_with_owner_history(tx, model, global_id, name, units, representation_contexts, owner_history): the newrepresentation_contexts: &[EntityId]parameter sits beforeowner_history. Pass&[]for the previous IFC4/IFC4X3 record.#[non_exhaustive]on the public read-side and catalogue types a later IFC release could extend:SpaceBoundary,BoundaryPhysicality,BoundaryExposure,Relationship,RelationshipKind,SpatialKind,SpatialNode,BoundaryLevelandFacility. Matches on the enums need a wildcard arm outside the crate, and the structs can no longer be built by literal there.
Changed
- Depends on
ifc-schemawith its default features named explicitly (every bundled release), now that the workspace dependency turns them off for the facade's per-release features (#112). - The spatial classifier binds no release for an
IFC4X1orIFC4X2header (release()isNone) and answers from the verified tables. - A model whose header declares
IFC4X1orIFC4X2is refused with the existing unsupported-schema error.ifc-schemanow bundles both releases, but no layout here is verified against them, so they are never read as IFC4 or IFC4X3.
Full history: crates/ifc-spatial/CHANGELOG.md