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

Method summarise_shapes

src/ifcdiff/ifcdiff.py:201–229  ·  view source on GitHub ↗
(
        self, ifc: ifcopenshell.file, elements: list[ifcopenshell.entity_instance]
    )

Source from the content-addressed store, hash-verified

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()

Callers 1

diffMethod · 0.95

Calls 6

get_settingsMethod · 0.95
iteratorMethod · 0.45
initializeMethod · 0.45
getMethod · 0.45
by_idMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected