(self, **kwargs)
| 438 | @utils.trace |
| 439 | # @profile |
| 440 | def extract_geometry(self, **kwargs): |
| 441 | # not only align facets part of the (potentially concave) input polyhedron, but also align facets resulting from the convex decomposition |
| 442 | ALIGN_INNER = True |
| 443 | |
| 444 | s = ifcopenshell.geom.settings( |
| 445 | USE_WORLD_COORDS=False, |
| 446 | # ITERATOR_OUTPUT=ifcopenshell.ifcopenshell_wrapper.NATIVE, |
| 447 | ITERATOR_OUTPUT=ifcopenshell.ifcopenshell_wrapper.TRIANGULATED, |
| 448 | DISABLE_OPENING_SUBTRACTIONS=True, |
| 449 | ) |
| 450 | |
| 451 | |
| 452 | its = [] |
| 453 | fffs = [] |
| 454 | |
| 455 | data = model_geometry() |
| 456 | |
| 457 | |
| 458 | for f in self.fs: |
| 459 | if kwargs.keys() == {'include'}: |
| 460 | kwargs2 = {'include': [e for e in kwargs['include'] if e.wrapped_data.file == f]} |
| 461 | else: |
| 462 | kwargs2 = kwargs |
| 463 | it = ifcopenshell.geom.iterator(s, f, geometry_library="cgal", **kwargs2) |
| 464 | |
| 465 | if not it.initialize(): |
| 466 | # print(ifcopenshell.get_log()) |
| 467 | # exit(1) |
| 468 | continue |
| 469 | |
| 470 | # convex decomposition is expensive, geometries can be shared, apply product-level transformations after CD and cache results pre-transform |
| 471 | cd_cache = {} |
| 472 | |
| 473 | while True: |
| 474 | elem = it.get() |
| 475 | elem_g_id = elem.geometry.id |
| 476 | |
| 477 | |
| 478 | if f[int(elem_g_id.split("-")[0])].RepresentationIdentifier != "Box": |
| 479 | print(f"[{utils.get_mem()} MB]", "reading", f[elem.id]) |
| 480 | |
| 481 | elem = it.get_native() |
| 482 | elem2 = None |
| 483 | for i in range(elem.geometry.size()): |
| 484 | elem_i = elem.geometry.item(i) |
| 485 | repitem = f[elem.geometry.item_id(i)] |
| 486 | |
| 487 | if elem_i.num_vertices() < 6: |
| 488 | # try and detect single faces used sometime for glass panes which can't |
| 489 | # be represented as halfspace intersection and need to be 'solidified' |
| 490 | fs = elem_i.facets() |
| 491 | axes_ = [f.axis() for f in fs] |
| 492 | axes = list(map(utils.to_tuple, axes_)) |
| 493 | if all(ax == axes[0] for ax in axes): |
| 494 | ff = ifcopenshell.file(schema=f.schema) |
| 495 | ff.add(*f.by_type("IfcProject")) |
| 496 | nelem = ff.add(f[elem.id]) |
| 497 | body = [rep for rep in nelem.Representation.Representations if rep.RepresentationIdentifier == "Body"][0] |
no test coverage detected