From 2c49b3bde835b2159d80ee11a0b85605664e8830 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 22 Jun 2021 13:22:48 +1000 Subject: [PATCH] MSProject XML to IFC conversion now supports blank IFCs or non-existent work plans --- src/ifcp6/ifcp6/msp2ifc.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ifcp6/ifcp6/msp2ifc.py b/src/ifcp6/ifcp6/msp2ifc.py index 1f8d86e2e6..29cc744d8a 100644 --- a/src/ifcp6/ifcp6/msp2ifc.py +++ b/src/ifcp6/ifcp6/msp2ifc.py @@ -116,11 +116,19 @@ class MSP2Ifc: } def create_ifc(self): + if not self.file: + self.file = self.create_boilerplate_ifc() + if not self.work_plan: + self.work_plan = ifcopenshell.api.run("sequence.add_work_plan", self.file) work_schedule = self.create_work_schedule() self.create_tasks(work_schedule) self.create_calendars() self.create_rel_sequences() + def create_boilerplate_ifc(self): + self.file = ifcopenshell.file(schema="IFC4") + self.work_plan = self.file.create_entity("IfcWorkPlan") + def create_tasks(self, work_schedule): for task_id in self.tasks: task = self.tasks[task_id]