Skip to main content

Module inverse

Module inverse 

Source
Expand description

INVERSE attributes by name and the entities referencing one (#462).

IfcModel::attribute_by_name resolves an INVERSE name (IsDefinedBy) through the facade’s reverse index, with the FOR clause of the release the header declares: IFC2X3’s IsDefinedBy holds type and property relationships, IFC4’s only property ones beside a separate IsTypedBy. The value has the declared shape:

  • a SET or BAG inverse, SET [0:1] included (ContainedInStructure, Decomposes), is a list of refs in ascending id order, empty when nothing references the entity: an optional single inverse is a list of zero or one, never unwrapped;
  • a non-aggregate inverse (VoidsElements, IFC2X3’s IfcGroup.IsGroupedBy) is one ref, or null when nothing references the entity; two or more are refused with invalid-model.

IfcModel::inverse_attribute_names lists the declarations, IfcModel::inverse_references every entity referencing one with the attribute index it references through (IfcOpenShell’s get_inverse with indices), and IfcModel::total_inverses counts the distinct referrers (get_total_inverses).

The index is built on the first such read and again only after the model changes, so a host reading many inverses pays one pass. An INVERSE name holds no slot: a write to one is refused with inverse-attribute.

Structs§

InverseAttributeInfo
One INVERSE attribute of an entity, as its declared release defines it.
InverseReference
One reference to an entity: who holds it and in which attribute.