mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 11:20:21 +00:00
ifc4d: make ScheduleIfcGenerator's boilerplate file actually work
create_boilerplate_ifc sets self.file and self.work_plan and returns nothing, but create_ifc assigned its result back over self.file, so any caller that did not supply a file got None and crashed on the next create_entity. Call it for its side effects, as csv2ifc and csv4d2ifc already do. That alone only moved the failure along: the boilerplate builds a file and a work plan but no IfcProject, and add_work_calendar looks for an IfcContext. Create one, matching csv4d2ifc's copy of the same method, which has both lines. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import ifcopenshell.api.control
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.api.pset
|
||||
import ifcopenshell.api.resource
|
||||
import ifcopenshell.api.root
|
||||
import ifcopenshell.api.sequence
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.date
|
||||
@@ -107,7 +108,7 @@ class ScheduleIfcGenerator:
|
||||
|
||||
def create_ifc(self) -> None:
|
||||
if not self.file:
|
||||
self.file = self.create_boilerplate_ifc()
|
||||
self.create_boilerplate_ifc()
|
||||
if not self.work_plan:
|
||||
self.work_plan = ifcopenshell.api.sequence.add_work_plan(self.file)
|
||||
work_schedule = self.create_work_schedule()
|
||||
@@ -491,4 +492,5 @@ class ScheduleIfcGenerator:
|
||||
|
||||
def create_boilerplate_ifc(self) -> None:
|
||||
self.file = ifcopenshell.file(schema="IFC4")
|
||||
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
|
||||
self.work_plan = self.file.create_entity("IfcWorkPlan")
|
||||
|
||||
Reference in New Issue
Block a user