MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _traverse_up

Function _traverse_up

src/ifcquery/ifcquery/relations.py:45–55  ·  view source on GitHub ↗

Walk the hierarchy from element up to IfcProject.

(element: ifcopenshell.entity_instance)

Source from the content-addressed store, hash-verified

43
44
45def _traverse_up(element: ifcopenshell.entity_instance) -> list[dict[str, Any]]:
46 """Walk the hierarchy from element up to IfcProject."""
47 chain = [_ref(element)]
48 current = element
49 while True:
50 parent = ifcopenshell.util.element.get_parent(current)
51 if parent is None:
52 break
53 chain.append(_ref(parent))
54 current = parent
55 return chain
56
57
58def _all_relations(model: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]:

Callers 1

relationsFunction · 0.85

Calls 3

get_parentMethod · 0.80
_refFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected