ifcopenshell.util.type¶
Module Contents¶
- class ifcopenshell.util.type.ApplicableOccurrence¶
Bases:
NamedTuple
- ifcopenshell.util.type.get_applicable_entities(ifc_type_class: str | ifcopenshell.entity_instance, schema: ifcopenshell.util.schema.IFC_SCHEMA = 'IFC4') list[ApplicableOccurrence]¶
Get the occurrence classes that the type class may type.
E.g. “IfcWindowType” -> [ApplicableOccurrence(“IfcWindow”, None)]. The first class is the primary pairing.
A type instance may be passed instead of a class name, in which case its file’s schema is used and its ApplicableOccurrence attribute narrows the result to the classes it names, carrying their predefined types. The attribute can never widen the schema’s answer: classes the schema does not allow are dropped, and if nothing it names is allowed it is ignored.
- ifcopenshell.util.type.get_applicable_schema_types(schema: ifcopenshell.ifcopenshell_wrapper.schema_definition, declaration: ifcopenshell.ifcopenshell_wrapper.entity) list[str]¶
The type classes the schema lets type the occurrence class, most specific first.
- ifcopenshell.util.type.get_applicable_types(ifc_class: str | ifcopenshell.entity_instance, schema: ifcopenshell.util.schema.IFC_SCHEMA = 'IFC4') list[str]¶
Get the type classes that may type the occurrence class.
E.g. “IfcWindow” -> [“IfcWindowType”]. The first class is the primary pairing. An occurrence instance may be passed instead of a class name, in which case its file’s schema is used.
- ifcopenshell.util.type.get_correct_type_assigned_rules(schema_name: str) dict[str, str]¶
Map each occurrence class with a CorrectTypeAssigned rule to the type class it names.
The rules are read from their transpiled form in ifcopenshell.express.rules, where the type class survives as a lowercased literal such as ‘ifc4.ifcwalltype’ in typeof(…).
- ifcopenshell.util.type.get_same_named_types(schema: ifcopenshell.ifcopenshell_wrapper.schema_definition, name: str) list[ifcopenshell.ifcopenshell_wrapper.entity]¶
The type class declarations named after the occurrence class, abstract or not.
- ifcopenshell.util.type.get_type_maps(schema_name: str) tuple[dict[str, list[str]], dict[str, list[str]]]¶
The occurrence to type map and its inverse for a schema, derived once and cached.
- ifcopenshell.util.type.is_applicable(relating_type: ifcopenshell.entity_instance, occurrence: ifcopenshell.entity_instance) bool¶
Whether the type may type the occurrence, see
get_applicable_entities().
- ifcopenshell.util.type.parse_applicable_occurrence(applicable_occurrence: str) list[ApplicableOccurrence]¶
Parse an IfcTypeObject.ApplicableOccurrence string.
The spec’s convention is a comma separated list of occurrence classes, each optionally followed by “/” and a predefined type, e.g. “IfcWall/STANDARD, IfcWallStandardCase”.