(
cls,
elements: Iterable[ifcopenshell.entity_instance],
ifc_class: str | None,
relating_type: ifcopenshell.entity_instance | None,
is_untyped: bool,
keyword: str | None,
)
| 465 | |
| 466 | @classmethod |
| 467 | def filter_elements( |
| 468 | cls, |
| 469 | elements: Iterable[ifcopenshell.entity_instance], |
| 470 | ifc_class: str | None, |
| 471 | relating_type: ifcopenshell.entity_instance | None, |
| 472 | is_untyped: bool, |
| 473 | keyword: str | None, |
| 474 | ) -> filter[ifcopenshell.entity_instance]: |
| 475 | keyword = keyword.lower() if keyword else keyword |
| 476 | |
| 477 | def filter_element(element: ifcopenshell.entity_instance) -> bool: |
| 478 | if ifc_class: |
| 479 | if not element.is_a(ifc_class): |
| 480 | return False |
| 481 | element_type = ifcopenshell.util.element.get_type(element) |
| 482 | if relating_type: |
| 483 | if relating_type != element_type: |
| 484 | return False |
| 485 | if is_untyped: |
| 486 | if element_type is not None: |
| 487 | return False |
| 488 | if keyword: |
| 489 | type_name = getattr(element_type, "Name", "") or "" |
| 490 | if keyword not in f"{element.is_a()} {type_name}".lower(): |
| 491 | return False |
| 492 | return True |
| 493 | |
| 494 | return filter(filter_element, elements) |
| 495 | |
| 496 | @classmethod |
| 497 | def import_spatial_decomposition(cls) -> None: |
no test coverage detected