BIM: BIM_ProjectManager: add missing self.project check

This commit is contained in:
Roy-043
2025-10-23 10:24:43 +02:00
committed by Chris Hennes
parent 8fe33581e6
commit ee512ebc00

View File

@@ -130,13 +130,18 @@ class BIM_ProjectManager:
if not buildings: if not buildings:
buildings = [o for o in doc.Objects if getattr(o, "IfcType", "") == "Building"] buildings = [o for o in doc.Objects if getattr(o, "IfcType", "") == "Building"]
if buildings: if buildings:
from nativeifc import ifc_tools
self.building = buildings[0] self.building = buildings[0]
self.form.buildingName.setText(self.building.Label) self.form.buildingName.setText(self.building.Label)
levels = []
if self.building and self.project:
from nativeifc import ifc_tools
levels = ifc_tools.get_children(self.building, ifctype="IfcBuildingStorey") levels = ifc_tools.get_children(self.building, ifctype="IfcBuildingStorey")
if levels: levels = list(filter(None, [ifc_tools.get_object(l) for l in levels]))
self.form.countLevels.setValue(len(levels)) if not levels:
levels = [o for o in doc.Objects if getattr(o, "IfcType", "") == "Building Storey"]
if levels:
self.form.countLevels.setValue(len(levels))
# show dialog # show dialog
self.form.show() self.form.show()