(
self, ifc: ifcopenshell.file, elements: list[ifcopenshell.entity_instance]
)
| 199 | logging.disable(logging.NOTSET) |
| 200 | |
| 201 | def summarise_shapes( |
| 202 | self, ifc: ifcopenshell.file, elements: list[ifcopenshell.entity_instance] |
| 203 | ) -> dict[str, dict[str, Any]]: |
| 204 | shapes = {} |
| 205 | iterator = ifcopenshell.geom.iterator( |
| 206 | self.get_settings(ifc), ifc, multiprocessing.cpu_count(), include=elements |
| 207 | ) |
| 208 | valid_file = iterator.initialize() |
| 209 | while True: |
| 210 | shape = iterator.get() |
| 211 | element = ifc.by_id(shape.id) |
| 212 | geometry = shape.geometry |
| 213 | if geometry.verts: |
| 214 | shapes[element.GlobalId] = { |
| 215 | "total_verts": len(geometry.verts), |
| 216 | "sum_verts": sum(geometry.verts), |
| 217 | "min_vert": min(geometry.verts), |
| 218 | "max_vert": max(geometry.verts), |
| 219 | "matrix": tuple(shape.transformation.matrix), |
| 220 | "openings": sorted( |
| 221 | [o.RelatedOpeningElement.GlobalId for o in getattr(element, "HasOpenings", []) or []] |
| 222 | ), |
| 223 | "projections": sorted( |
| 224 | [o.RelatedFeatureElement.GlobalId for o in getattr(element, "HasProjections", []) or []] |
| 225 | ), |
| 226 | } |
| 227 | if not iterator.next(): |
| 228 | break |
| 229 | return shapes |
| 230 | |
| 231 | def get_settings(self, ifc: ifcopenshell.file) -> ifcopenshell.geom.settings: |
| 232 | settings = ifcopenshell.geom.settings() |
no test coverage detected