mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
util.classification small optimization
This commit is contained in:
@@ -23,10 +23,10 @@ from typing import Optional
|
|||||||
def get_references(element: ifcopenshell.entity_instance, should_inherit=True) -> set[ifcopenshell.entity_instance]:
|
def get_references(element: ifcopenshell.entity_instance, should_inherit=True) -> set[ifcopenshell.entity_instance]:
|
||||||
results = set()
|
results = set()
|
||||||
if not element.is_a("IfcRoot"):
|
if not element.is_a("IfcRoot"):
|
||||||
if hasattr(element, "HasExternalReferences"):
|
if (references := getattr(element, "HasExternalReferences", None)) is not None or (
|
||||||
return {r.RelatingReference for r in element.HasExternalReferences or []}
|
references := getattr(element, "HasExternalReference", None)
|
||||||
elif hasattr(element, "HasExternalReference"): # Seriously, IFC?
|
) is not None:
|
||||||
return {r.RelatingReference for r in element.HasExternalReference or []}
|
return {r.RelatingReference for r in references}
|
||||||
if should_inherit:
|
if should_inherit:
|
||||||
element_type = ifcopenshell.util.element.get_type(element)
|
element_type = ifcopenshell.util.element.get_type(element)
|
||||||
if element_type and element_type != element:
|
if element_type and element_type != element:
|
||||||
|
|||||||
Reference in New Issue
Block a user