(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance)
| 575 | |
| 576 | |
| 577 | def get_component_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]: |
| 578 | space = ifcopenshell.util.element.get_container(element) |
| 579 | space_name = space.Name if space.is_a("IfcSpace") else None |
| 580 | |
| 581 | type_name = None |
| 582 | relating_type = ifcopenshell.util.element.get_type(element) |
| 583 | if relating_type and val(relating_type.Name): |
| 584 | type_name = relating_type.Name |
| 585 | else: |
| 586 | material = ifcopenshell.util.element.get_material(element, should_skip_usage=True) |
| 587 | type_name = getattr(material, "Name", None) or getattr(material, "LayerSetName", None) |
| 588 | |
| 589 | serial_number = None |
| 590 | installation_date = None |
| 591 | warranty_start_date = None |
| 592 | tag_number = None |
| 593 | bar_code = None |
| 594 | asset_identifier = None |
| 595 | |
| 596 | for _, props in ifcopenshell.util.element.get_psets(element).items(): |
| 597 | for name, value in props.items(): |
| 598 | if not serial_number and name == "SerialNumber" and val(value): |
| 599 | serial_number = str(value) |
| 600 | if not installation_date and name == "InstallationDate" and val(value): |
| 601 | installation_date = str(value) |
| 602 | if not warranty_start_date and name == "WarrantyStartDate" and val(value): |
| 603 | warranty_start_date = str(value) |
| 604 | if not tag_number and name == "TagNumber" and val(value): |
| 605 | tag_number = str(value) |
| 606 | if not bar_code and name == "BarCode" and val(value): |
| 607 | bar_code = str(value) |
| 608 | if not asset_identifier and name == "AssetIdentifier" and val(value): |
| 609 | asset_identifier = str(value) |
| 610 | |
| 611 | return { |
| 612 | "Name": element.Name, |
| 613 | "CreatedBy": get_created_by(element), |
| 614 | "CreatedOn": get_created_on(element), |
| 615 | "TypeName": type_name, |
| 616 | "Space": space_name, |
| 617 | "Description": val(element.Description) or val(element.Name), |
| 618 | "ExternalSystem": get_external_system(element), |
| 619 | "ExternalObject": element.is_a(), |
| 620 | "ExternalIdentifier": element.GlobalId, |
| 621 | "SerialNumber": serial_number, |
| 622 | "InstallationDate": installation_date, |
| 623 | "WarrantyStartDate": warranty_start_date, |
| 624 | "TagNumber": tag_number, |
| 625 | "BarCode": bar_code, |
| 626 | "AssetIdentifier": asset_identifier, |
| 627 | } |
| 628 | |
| 629 | |
| 630 | def get_system_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]: |
nothing calls this directly
no test coverage detected