Implement support of importing calendars from P6

This commit is contained in:
Dion Moult
2021-04-30 14:53:40 +10:00
parent 2f53e43b90
commit 79dcf809ed
5 changed files with 240 additions and 43 deletions
@@ -4,7 +4,7 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {"name": "Unnamed", "predefined_type": "NOTDEFINED", "working_times": [], "exception_times": []}
self.settings = {"name": "Unnamed", "predefined_type": "NOTDEFINED"}
for key, value in settings.items():
self.settings[key] = value
@@ -19,3 +19,4 @@ class Usecase:
if len(self.file.get_inverse(self.settings["parent"].Recurrence)) == 1:
self.file.remove(self.settings["parent"].Recurrence)
self.settings["parent"].Recurrence = recurrence
return recurrence
@@ -1,6 +1,3 @@
import ifcopenshell.util.date
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -10,17 +7,4 @@ class Usecase:
def execute(self):
for name, value in self.settings["attributes"].items():
if name == "TimePeriods" and value:
periods = []
for period in value:
periods.append(
self.file.create_entity(
"IfcTimePeriod",
**{
"StartTime": ifcopenshell.util.date.datetime2ifc(period[0]),
"EndTime": ifcopenshell.util.date.datetime2ifc(period[1]),
},
)
)
value = periods
setattr(self.settings["recurrence_pattern"], name, value)