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

Function _build_tree

src/ifcquery/ifcquery/clash.py:66–81  ·  view source on GitHub ↗

Build geometry tree for given elements using iterator. Returns None if iterator fails to initialize (no geometry available).

(model: ifcopenshell.file, elements: set[ifcopenshell.entity_instance])

Source from the content-addressed store, hash-verified

64
65
66def _build_tree(model: ifcopenshell.file, elements: set[ifcopenshell.entity_instance]) -> ifcopenshell.geom.tree | None:
67 """Build geometry tree for given elements using iterator.
68
69 Returns None if iterator fails to initialize (no geometry available).
70 """
71 geom_settings = ifcopenshell.geom.settings()
72 geom_settings.set("use-world-coords", True)
73 geom_tree = ifcopenshell.geom.tree()
74 iterator = ifcopenshell.geom.iterator(geom_settings, model, multiprocessing.cpu_count(), include=list(elements))
75 if not iterator.initialize():
76 return None
77 while True:
78 geom_tree.add_element(iterator.get())
79 if not iterator.next():
80 break
81 return geom_tree
82
83
84def _format_clash(clash_result, geom_tree: ifcopenshell.geom.tree, model: ifcopenshell.file) -> dict[str, Any]:

Callers 1

clashFunction · 0.85

Calls 7

setMethod · 0.45
treeMethod · 0.45
iteratorMethod · 0.45
initializeMethod · 0.45
add_elementMethod · 0.45
getMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected