mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix error if no ifc file set (#1620)
* Fix error trying to access unset ifc file * Return prematurely from operator if no file is set * Revert "Return prematurely from operator if no file is set" This reverts commitf876cfbcef. * Revert "Fix error trying to access unset ifc file" This reverts commit6782c47d86. * Prevent error message if ifc_types enum is empty * Hide panel if no ifc file to avoid error
This commit is contained in:
@@ -9,6 +9,10 @@ class BIM_PT_authoring(Panel):
|
||||
bl_region_type = "UI"
|
||||
bl_category = "BlenderBIM"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return IfcStore.get_file()
|
||||
|
||||
def draw(self, context):
|
||||
tprops = context.scene.BIMTypeProperties
|
||||
col = self.layout.column(align=True)
|
||||
|
||||
@@ -42,7 +42,7 @@ def getIfcTypes(self, context):
|
||||
|
||||
def getAvailableTypes(self, context):
|
||||
global available_types_enum
|
||||
if len(available_types_enum) < 1:
|
||||
if len(available_types_enum) < 1 and getIfcTypes(self, context):
|
||||
elements = IfcStore.get_file().by_type(self.ifc_class)
|
||||
available_types_enum.extend((str(e.id()), e.Name, "") for e in elements)
|
||||
return available_types_enum
|
||||
|
||||
Reference in New Issue
Block a user