mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Resource Features :
- Adding/removing and edit productivity data is now easier (+ cleaner UI) - Pressing calculate schedule work on a parent resource will default to calculating its nested resources schedule work. - Show derived Schedule Work for a parent resource - Improve apperance of Resource Tree Structure
This commit is contained in:
@@ -60,14 +60,7 @@ class Usecase:
|
||||
self.settings = {"resource": resource}
|
||||
|
||||
def execute(self):
|
||||
metrics = ifcopenshell.util.constraint.has_metric_constraints(
|
||||
self.settings["resource"], "Usage.ScheduleWork"
|
||||
)
|
||||
if (
|
||||
metrics
|
||||
and metrics[0].ConstraintGrade == "HARD"
|
||||
and metrics[0].Benchmark == "EQUALTO"
|
||||
):
|
||||
if self.has_hard_constraint():
|
||||
return
|
||||
amount_worked = ifcopenshell.util.resource.get_resource_required_work(
|
||||
self.settings["resource"]
|
||||
@@ -81,3 +74,15 @@ class Usecase:
|
||||
resource=self.settings["resource"],
|
||||
)
|
||||
self.settings["resource"].Usage.ScheduleWork = amount_worked
|
||||
|
||||
def has_hard_constraint(self):
|
||||
metrics = ifcopenshell.util.constraint.has_metric_constraints(
|
||||
self.settings["resource"], "Usage.ScheduleWork"
|
||||
)
|
||||
if (
|
||||
metrics
|
||||
and metrics[0].ConstraintGrade == "HARD"
|
||||
and metrics[0].Benchmark == "EQUALTO"
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -98,7 +98,7 @@ def readable_ifc_duration(string):
|
||||
final_string += f"{months} m " if months else ""
|
||||
final_string += f"{weeks} w " if weeks else ""
|
||||
final_string += f"{days} d " if days else ""
|
||||
final_string += f"{hours} h " if hours else ""
|
||||
final_string += f"{round(float(hours),2)} h " if hours else ""
|
||||
final_string += f"{minutes} m " if minutes else ""
|
||||
final_string += f"{seconds} s " if seconds else ""
|
||||
|
||||
|
||||
@@ -112,3 +112,6 @@ def get_resource_required_work(resource):
|
||||
required_work = total_quantity_to_produce * productivity_ratio
|
||||
iso_string = f"P{required_work}D"
|
||||
return iso_string
|
||||
|
||||
def get_nested_resources(resource):
|
||||
return [object for rel in resource.IsNestedBy or [] for object in rel.RelatedObjects]
|
||||
@@ -248,7 +248,7 @@ def get_task_work_schedule(task):
|
||||
|
||||
|
||||
def get_nested_tasks(task):
|
||||
return [object for rel in task.IsNestedBy for object in rel.RelatedObjects]
|
||||
return [object for rel in task.IsNestedBy or [] for object in rel.RelatedObjects]
|
||||
|
||||
|
||||
def get_parent_task(task):
|
||||
|
||||
Reference in New Issue
Block a user