diff --git a/src/blenderbim/blenderbim/bim/module/sequence/operator.py b/src/blenderbim/blenderbim/bim/module/sequence/operator.py index 60c4dd2e1d..a591f47b77 100644 --- a/src/blenderbim/blenderbim/bim/module/sequence/operator.py +++ b/src/blenderbim/blenderbim/bim/module/sequence/operator.py @@ -575,7 +575,7 @@ class AssignPredecessor(bpy.types.Operator): "sequence.edit_sequence", self.file, rel_sequence=rel, attributes={"SequenceType": "FINISH_START"} ) Data.load(self.file) - bpy.ops.bim.load_task_properties(task=self.task) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -597,7 +597,7 @@ class AssignSuccessor(bpy.types.Operator): "sequence.edit_sequence", self.file, rel_sequence=rel, attributes={"SequenceType": "FINISH_START"} ) Data.load(self.file) - bpy.ops.bim.load_task_properties(task=self.task) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -616,7 +616,7 @@ class UnassignPredecessor(bpy.types.Operator): related_process=IfcStore.get_file().by_id(props.active_task_id), ) Data.load(self.file) - bpy.ops.bim.load_task_properties(task=self.task) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -635,7 +635,7 @@ class UnassignSuccessor(bpy.types.Operator): related_process=self.file.by_id(self.task), ) Data.load(self.file) - bpy.ops.bim.load_task_properties(task=self.task) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -1166,19 +1166,18 @@ class EditTaskCalendar(bpy.types.Operator): def execute(self, context): self.file = IfcStore.get_file() + task = self.file.by_id(self.task) ifcopenshell.api.run( "control.assign_control", self.file, **{ "relating_control": self.file.by_id(self.work_calendar), - "related_object": self.file.by_id(self.task), + "related_object": task, }, ) + ifcopenshell.api.run("sequence.cascade_schedule", self.file, task=task) Data.load(IfcStore.get_file()) - if Data.tasks[self.task]["RelatedObjects"]: - bpy.ops.bim.load_task_properties() - else: - bpy.ops.bim.load_task_properties(task=self.task) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -1190,19 +1189,18 @@ class RemoveTaskCalendar(bpy.types.Operator): def execute(self, context): self.file = IfcStore.get_file() + task = self.file.by_id(self.task) ifcopenshell.api.run( "control.unassign_control", self.file, **{ "relating_control": self.file.by_id(self.work_calendar), - "related_object": self.file.by_id(self.task), + "related_object": task, }, ) + ifcopenshell.api.run("sequence.cascade_schedule", self.file, task=task) Data.load(IfcStore.get_file()) - if Data.tasks[self.task]["RelatedObjects"]: - bpy.ops.bim.load_task_properties() - else: - bpy.ops.bim.load_task_properties(task=self.task) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -1294,6 +1292,7 @@ class UnassignLagTime(bpy.types.Operator): "sequence.unassign_lag_time", self.file, **{"rel_sequence": self.file.by_id(self.sequence)} ) Data.load(IfcStore.get_file()) + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -1328,6 +1327,7 @@ class EditSequenceAttributes(bpy.types.Operator): ) Data.load(self.file) bpy.ops.bim.disable_editing_sequence() + bpy.ops.bim.load_task_properties() return {"FINISHED"} @@ -1347,6 +1347,7 @@ class EditSequenceTimeLag(bpy.types.Operator): ) Data.load(self.file) bpy.ops.bim.disable_editing_sequence() + bpy.ops.bim.load_task_properties() return {"FINISHED"} diff --git a/src/blenderbim/blenderbim/bim/module/sequence/prop.py b/src/blenderbim/blenderbim/bim/module/sequence/prop.py index 0363bf7c0b..9c75f55d24 100644 --- a/src/blenderbim/blenderbim/bim/module/sequence/prop.py +++ b/src/blenderbim/blenderbim/bim/module/sequence/prop.py @@ -104,7 +104,7 @@ def updateTaskTimeDateTime(self, context, startfinish): **{"task_time": task_time, "attributes": {startfinish_key: startfinish_datetime}}, ) Data.load(IfcStore.get_file()) - bpy.ops.bim.load_task_properties(task=props.active_task_id) + bpy.ops.bim.load_task_properties() setattr(self, startfinish, canonicalise_time(startfinish_datetime)) @@ -129,7 +129,7 @@ def updateTaskduration(self, context): attribute = props.task_time_attributes.get("Duration") if attribute: attribute.string_value = self.duration - bpy.ops.bim.load_task_properties(task=props.active_task_id) + bpy.ops.bim.load_task_properties() def updateVisualisationStart(self, context): diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py index 9e0d598dbd..46c13f924e 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py @@ -73,8 +73,6 @@ class Usecase: finishes.append(self.offset_date(start, days, duration_type, self.get_calendar(predecessor))) else: finishes.append(start) - else: - return if starts and finishes: start = max(starts) @@ -135,8 +133,6 @@ class Usecase: ), "IfcDateTime", ) - else: - return for rel in task.IsPredecessorTo: self.cascade_task(rel.RelatedProcess) diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py index e415b93be7..9089ab6bc1 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py @@ -1,3 +1,4 @@ +import ifcopenshell.api import ifcopenshell.util.date @@ -16,3 +17,5 @@ class Usecase: else: value = self.file.createIfcDuration(ifcopenshell.util.date.datetime2ifc(value, "IfcDuration")) setattr(self.settings["lag_time"], name, value) + for rel in [r for r in self.file.get_inverse(self.settings["lag_time"]) if r.is_a("IfcRelSequence")]: + ifcopenshell.api.run("sequence.cascade_schedule", self.file, task=rel.RelatedProcess) diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py index b43c7c84a5..d11febfb00 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py @@ -1,3 +1,7 @@ +import ifcopenshell +import ifcopenshell.api + + class Usecase: def __init__(self, file, **settings): self.file = file @@ -8,3 +12,7 @@ class Usecase: def execute(self): for name, value in self.settings["attributes"].items(): setattr(self.settings["rel_sequence"], name, value) + if "SequenceType" in self.settings["attributes"].keys(): + ifcopenshell.api.run( + "sequence.cascade_schedule", self.file, task=self.settings["rel_sequence"].RelatedProcess + ) diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py index 4654bac061..9cf40abec1 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py @@ -1,3 +1,6 @@ +import ifcopenshell.api + + class Usecase: def __init__(self, file, **settings): self.file = file @@ -9,5 +12,9 @@ class Usecase: def execute(self): if len(self.file.get_inverse(self.settings["rel_sequence"].TimeLag)) == 1: - return self.file.remove(self.settings["rel_sequence"].TimeLag) - self.settings["rel_sequence"].TimeLag = None + self.file.remove(self.settings["rel_sequence"].TimeLag) + else: + self.settings["rel_sequence"].TimeLag = None + ifcopenshell.api.run( + "sequence.cascade_schedule", self.file, task=self.settings["rel_sequence"].RelatedProcess + ) diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py index 496b8bfec2..fb1ffda88b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py @@ -16,3 +16,4 @@ class Usecase: for rel in self.settings["related_process"].IsSuccessorFrom or []: if rel.RelatingProcess == self.settings["relating_process"]: self.file.remove(rel) + ifcopenshell.api.run("sequence.cascade_schedule", self.file, task=self.settings["related_process"])