Files
IfcOpenShell/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
751 B
Python
Raw Normal View History

2021-04-20 17:11:06 +10:00
import ifcopenshell.util.date
2021-04-20 05:12:13 +00:00
class Usecase:
def __init__(self, file, **settings):
self.file = file
2021-04-20 17:11:06 +10:00
self.settings = {"task_time": None, "attributes": {}}
2021-04-20 05:12:13 +00:00
for key, value in settings.items():
self.settings[key] = value
def execute(self):
for name, value in self.settings["attributes"].items():
2021-04-20 17:11:06 +10:00
if "Start" in name or "Finish" in name or name == "StatusTime":
if value:
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDateTime")
if name == "ScheduleDuration":
if value:
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDuration")
2021-04-20 17:11:06 +10:00
setattr(self.settings["task_time"], name, value)