diff --git a/src/ifcblenderexport/blenderbim/bim/ifc.py b/src/ifcblenderexport/blenderbim/bim/ifc.py index f542bb1531..b5f4712065 100644 --- a/src/ifcblenderexport/blenderbim/bim/ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/ifc.py @@ -16,7 +16,10 @@ class IfcStore: if IfcStore.file is None: IfcStore.path = bpy.context.scene.BIMProperties.ifc_file if IfcStore.path: - IfcStore.file = ifcopenshell.open(IfcStore.path) + try: + IfcStore.file = ifcopenshell.open(IfcStore.path) + except: + IfcStore.file return IfcStore.file @staticmethod diff --git a/src/ifcblenderexport/blenderbim/bim/module/project/ui.py b/src/ifcblenderexport/blenderbim/bim/module/project/ui.py index d1425c8f99..c8f8c5fea8 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/project/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/project/ui.py @@ -13,8 +13,9 @@ class BIM_PT_project(Panel): def draw(self, context): self.layout.use_property_decorate = False self.layout.use_property_split = True + props = context.scene.BIMProperties self.file = IfcStore.get_file() - if self.file: + if self.file or props.ifc_file: self.draw_project_ui(context) else: self.draw_create_project_ui(context) @@ -22,12 +23,16 @@ class BIM_PT_project(Panel): def draw_project_ui(self, context): props = context.scene.BIMProperties row = self.layout.row(align=True) - row.label(text="IFC File", icon="FILE") + row.label(text="IFC Filename", icon="FILE") row.label(text=os.path.basename(props.ifc_file) or "No File Found") - row = self.layout.row(align=True) - row.label(text="IFC Schema", icon="FILE_CACHE") - row.label(text=IfcStore.get_file().schema) + if IfcStore.get_file(): + row = self.layout.row(align=True) + row.label(text="IFC Schema", icon="FILE_CACHE") + row.label(text=IfcStore.get_file().schema) + else: + row = self.layout.row(align=True) + row.label(text="File Not Loaded", icon="ERROR") row = self.layout.row(align=True) row.prop(props, "ifc_file", text="")