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

Function get_spare_data

src/ifcfm/ifcfm/cobie24.py:710–742  ·  view source on GitHub ↗
(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance)

Source from the content-addressed store, hash-verified

708
709
710def get_spare_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]:
711 type_name = None
712 for rel in element.ResourceOf or []:
713 for related_object in rel.RelatedObjects or []:
714 if val(related_object.Name):
715 type_name = val(related_object.Name)
716
717 suppliers = None
718 set_number = None
719 part_number = None
720 for _, props in ifcopenshell.util.element.get_psets(element).items():
721 for name, value in props.items():
722 if name == "Suppliers" and val(value):
723 suppliers = str(value)
724 if name == "SetNumber" and val(value):
725 set_number = str(value)
726 if name == "PartNumber" and val(value):
727 part_number = str(value)
728
729 return {
730 "Name": val(element.Name),
731 "CreatedBy": get_created_by(element),
732 "CreatedOn": get_created_on(element),
733 "Category": get_category(element),
734 "TypeName": type_name,
735 "Suppliers": suppliers,
736 "ExternalSystem": get_external_system(element),
737 "ExternalObject": element.is_a(),
738 "ExternalIdentifier": element.GlobalId,
739 "Description": val(element.Description) or val(element.Name),
740 "SetNumber": set_number,
741 "PartNumber": part_number,
742 }
743
744
745def get_resource_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]:

Callers

nothing calls this directly

Calls 7

valFunction · 0.70
get_created_byFunction · 0.70
get_created_onFunction · 0.70
get_categoryFunction · 0.70
get_external_systemFunction · 0.70
itemsMethod · 0.45
is_aMethod · 0.45

Tested by

no test coverage detected