Fix #1289. Users can now reassign the IFC file location if it moves.

This commit is contained in:
Dion Moult
2021-02-03 19:15:25 +11:00
parent 9717d6b1eb
commit 4b9520a1bb
2 changed files with 14 additions and 6 deletions
+4 -1
View File
@@ -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
@@ -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="")