From e73ff252bbef6b010ae8bde70ac426e849541506 Mon Sep 17 00:00:00 2001 From: Vukas Pajic Date: Thu, 11 Apr 2024 11:35:34 +0200 Subject: [PATCH] fix: cascade_schedule correctly handles timelag with IfcRatioMeasure --- .../ifcopenshell/api/sequence/cascade_schedule.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py index b541a81670..5285cf201e 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py @@ -153,7 +153,8 @@ class Usecase: days = 0 if predecessor_duration.days == 0 else 1 duration_type = "WORKTIME" if rel.TimeLag: - days += self.get_lag_time_days(rel.TimeLag) + # updated to handle IfcRatioMeasure as a TimeLag value + days += self.get_lag_time_days(rel.TimeLag) if rel.TimeLag.is_a("IfcDuration") else predecessor_duration.days * rel.TimeLag.LagValue.wrappedValue duration_type = rel.TimeLag.DurationType if days: starts.append( @@ -182,7 +183,7 @@ class Usecase: if not start: continue if rel.TimeLag: - days = self.get_lag_time_days(rel.TimeLag) + days = self.get_lag_time_days(rel.TimeLag) if rel.TimeLag.is_a("IfcDuration") else predecessor_duration.days * rel.TimeLag.LagValue.wrappedValue duration_type = rel.TimeLag.DurationType starts.append( self.offset_date( @@ -201,7 +202,7 @@ class Usecase: if not finish: continue if rel.TimeLag: - days = self.get_lag_time_days(rel.TimeLag) + days = self.get_lag_time_days(rel.TimeLag) if rel.TimeLag.is_a("IfcDuration") else predecessor_duration.days * rel.TimeLag.LagValue.wrappedValue duration_type = rel.TimeLag.DurationType finishes.append( self.offset_date( @@ -222,7 +223,7 @@ class Usecase: days = -1 duration_type = "WORKTIME" if rel.TimeLag: - days += self.get_lag_time_days(rel.TimeLag) + days += self.get_lag_time_days(rel.TimeLag) if rel.TimeLag.is_a("IfcDuration") else predecessor_duration.days * rel.TimeLag.LagValue.wrappedValue duration_type = rel.TimeLag.DurationType if days or rel.TimeLag: finishes.append(