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])
| 64 | |
| 65 | |
| 66 | def _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 | |
| 84 | def _format_clash(clash_result, geom_tree: ifcopenshell.geom.tree, model: ifcopenshell.file) -> dict[str, Any]: |
no test coverage detected