mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Fix errors if no ifc file
This commit is contained in:
@@ -110,6 +110,8 @@ class BIM_PT_material_attributes(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if not IfcStore.get_file():
|
||||
return False
|
||||
try:
|
||||
return bool(context.active_object.active_material.BIMObjectProperties.ifc_definition_id)
|
||||
except:
|
||||
|
||||
@@ -207,7 +207,8 @@ class BIM_PT_material_psets(Panel):
|
||||
props = context.active_object.active_material.BIMObjectProperties
|
||||
if not props.ifc_definition_id:
|
||||
return False
|
||||
if IfcStore.get_file().schema == "IFC2X3":
|
||||
file = IfcStore.get_file()
|
||||
if not file or file.schema == "IFC2X3":
|
||||
return False # We don't support material psets in IFC2X3 because they suck
|
||||
if props.ifc_definition_id not in Data.products:
|
||||
Data.load(IfcStore.get_file(), props.ifc_definition_id)
|
||||
|
||||
@@ -59,6 +59,8 @@ class BIM_PT_style_attributes(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if not IfcStore.get_file():
|
||||
return False
|
||||
try:
|
||||
return bool(context.active_object.active_material.BIMMaterialProperties.ifc_style_id)
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user