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

Function get_job_data

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

Source from the content-addressed store, hash-verified

756
757
758def get_job_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]:
759 type_names = []
760 resource_names = []
761 for rel in element.OperatesOn or []:
762 for related_object in rel.RelatedObjects or []:
763 if not val(related_object.Name):
764 continue
765 if related_object.is_a("IfcTypeObject"):
766 type_names.append(related_object.Name)
767 elif related_object.is_a("IfcConstructionEquipmentResource"):
768 resource_names.append(related_object.Name)
769 type_name = ",".join(type_names) if type_names else None
770 resource_names = ",".join(resource_names) if resource_names else None
771
772 duration = None
773 duration_unit = None
774 start = None
775 task_start_unit = None
776 frequency = None
777 frequency_unit = None
778
779 for _, props in ifcopenshell.util.element.get_psets(element).items():
780 pset = ifc_file.by_id(props["id"])
781 for name, value in props.items():
782 if not duration and name == "TaskDuration" and val(value):
783 duration = str(value)
784 if not duration_unit:
785 duration_unit = get_property_unit(pset, name)
786 if not start and name == "TaskStartDate" and val(value):
787 start = str(value)
788 if not task_start_unit:
789 task_start_unit = get_property_unit(pset, name)
790 if not frequency and name == "TaskInterval" and val(value):
791 frequency = str(value)
792 if not frequency_unit:
793 frequency_unit = get_property_unit(pset, name)
794
795 task_number = val(getattr(element, "Id", None)) or val(getattr(element, "Identification", None))
796
797 priors = []
798 for rel in element.IsSuccessorFrom or []:
799 if rel.RelatedProcess.is_a("IfcTask"):
800 prior_task = rel.RelatedProcess
801 prior_id = val(getattr(prior_task, "Id", None)) or val(getattr(prior_task, "Identification", None))
802 if prior_id:
803 priors.append(prior_id)
804 priors = ",".join(priors) if priors else task_number
805
806 return {
807 "Name": val(element.Name),
808 "CreatedBy": get_created_by(element),
809 "CreatedOn": get_created_on(element),
810 "Category": val(element.ObjectType),
811 "Status": val(element.Status),
812 "TypeName": type_name,
813 "Description": val(element.Description) or val(element.Name),
814 "Duration": duration,
815 "DurationUnit": duration_unit,

Callers

nothing calls this directly

Calls 10

valFunction · 0.70
get_property_unitFunction · 0.70
get_created_byFunction · 0.70
get_created_onFunction · 0.70
get_external_systemFunction · 0.70
is_aMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
itemsMethod · 0.45
by_idMethod · 0.45

Tested by

no test coverage detected