Notify user if duration parsing not available in util.date

This commit is contained in:
Dion Moult
2024-05-11 15:14:39 +10:00
parent 8e6c372a4f
commit 6df6553935
3 changed files with 8 additions and 16 deletions
@@ -56,10 +56,6 @@ def add_resource_time(file: ifcopenshell.file, resource: ifcopenshell.entity_ins
ifcopenshell.api.run("resource.edit_resource_time", model,
resource_time=time, attributes={"ScheduleWork": "PT16H"})
"""
settings = {
"resource": resource,
}
resource_time = file.create_entity("IfcResourceTime")
settings["resource"].Usage = resource_time
resource.Usage = resource_time
return resource_time
@@ -56,17 +56,15 @@ def calculate_resource_work(file: ifcopenshell.file, resource: ifcopenshell.enti
:return None:
:rtype: None:
"""
settings = {"resource": resource}
if ifcopenshell.util.constraint.is_attribute_locked(settings["resource"], "Usage.ScheduleWork"):
if ifcopenshell.util.constraint.is_attribute_locked(resource, "Usage.ScheduleWork"):
return
amount_worked = ifcopenshell.util.resource.get_resource_required_work(settings["resource"])
amount_worked = ifcopenshell.util.resource.get_resource_required_work(resource)
if not amount_worked:
return
if not settings["resource"].Usage:
if not resource.Usage:
ifcopenshell.api.run(
"resource.add_resource_time",
file,
resource=settings["resource"],
resource=resource,
)
settings["resource"].Usage.ScheduleWork = amount_worked
resource.Usage.ScheduleWork = amount_worked