ifc-constraint
Bounded IFC4 metric, objective, and constraint relationships.
| Status | Implemented |
| Latest release | 0.3.0 (2026-09-29) |
| Registries | crates.io ifc-constraint |
| Via the facade | openbim-ifc feature constraint |
| API documentation | rustdoc · docs.rs |
| Source | crates/ifc-constraint/ |
Overview
Bounded metric, objective, and constraint-relationship semantics, read and written by attribute name in the model's declared release (IFC2X3, IFC4 or IFC4X3).
Values are projected and preserved; this crate does not evaluate compliance, formulas, references, tables, or time series.
Depends on
Changes
Latest release, 0.3.0 (2026-09-29):
Added
DateTimeInput: a creation time as IFC4/IFC4X3IfcDateTimetext or an IFC2X3IfcDateTimeSelectrecord (From<&str>,From<EntityId>).ConstraintError::NotInSchema,StructuredValue,EntityNotInSchema,AuthoringNotInSchemaandAuthoringValueType, and projections'release().SchemaVersionis re-exported.
Changed (breaking)
The constraint views read every attribute by name in the model's declared release (#212). They read IFC4 positions, types and SELECTs from every file.
ConstraintViewbinds the header (IFC2X3, IFC4 or IFC4X3; none reads as IFC4) and a lookup refuses IFC4X1, IFC4X2, unknown and multiple schemas. An attribute the release does not declare isNotInSchema: IFC2X3IfcMetric.ReferencePath, and IFC2X3IfcObjective.LogicalAggregator, whose slot holdsResultValues, anIfcMetric, which was reported as a malformed operator. An IFC2X3CreationTimerecord isStructuredValuewith the record id instead ofInvalidValue; IFC2X3's singleBenchmarkValuesmetric is a one-element list;DataValueis checked against the release's ownIfcMetricValueSelectand is required in IFC2X3. IFC4 and IFC4X3 answers are unchanged.create_metric,create_objective,relate_resource_constraintandcreate_referencebind the declared release and lay their records out by name (#212). In IFC2X3 a metric has ten attributes and requiresDataValue,ReferencePathisAuthoringNotInSchema, an objective takes exactly oneIfcMetricbenchmark and no logical aggregator, textCreationTimeisAuthoringValueType, andIfcResourceConstraintRelationshipandIfcReferenceareEntityNotInSchema. Enumeration tokens are checked against the release's enumeration (IFC2X3 lacks, for example,INCLUDESandMODELVIEW). IFC4 and IFC4X3 records are unchanged.ConstraintBaseDraft::creation_timeisOption<DateTimeInput>; the setter takesimpl Into<DateTimeInput>, so.creation_time("…")still compiles.Metric::try_new,Objective::try_new,ResourceConstraintRelationship::try_newandConstraintAssignment::try_newtake theSchemaVersionto read against, refusing IFC4X1, IFC4X2 and an entity the release does not declare.ConstraintView::newis no longerconst. A value for an attribute the release does not declare, whichassociate_constraintcould not hit, isAuthoringNotInSchemarather thanAuthoringInvalid.Every public draft is
#[non_exhaustive], so struct literals no longer compile outside the crate. Each gains a constructor taking its required fields and one builder setter per other field, named after the field and taking the unwrapped value (.description("…")setsSome):ConstraintBaseDraft::new(name, grade)MetricDraft::new(base, benchmark)ObjectiveDraft::new(base, qualifier)ResourceConstraintDraft::new(relating_constraint, related_resources)ConstraintAssociationDraft::new(global_id, related_objects, relating_constraint)ReferenceDraft::new(), which now also derivesDefault
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). - 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-constraint/CHANGELOG.md