mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
Fix #1289. Users can now reassign the IFC file location if it moves.
This commit is contained in:
@@ -16,7 +16,10 @@ class IfcStore:
|
|||||||
if IfcStore.file is None:
|
if IfcStore.file is None:
|
||||||
IfcStore.path = bpy.context.scene.BIMProperties.ifc_file
|
IfcStore.path = bpy.context.scene.BIMProperties.ifc_file
|
||||||
if IfcStore.path:
|
if IfcStore.path:
|
||||||
IfcStore.file = ifcopenshell.open(IfcStore.path)
|
try:
|
||||||
|
IfcStore.file = ifcopenshell.open(IfcStore.path)
|
||||||
|
except:
|
||||||
|
IfcStore.file
|
||||||
return IfcStore.file
|
return IfcStore.file
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ class BIM_PT_project(Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
self.layout.use_property_decorate = False
|
self.layout.use_property_decorate = False
|
||||||
self.layout.use_property_split = True
|
self.layout.use_property_split = True
|
||||||
|
props = context.scene.BIMProperties
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
if self.file:
|
if self.file or props.ifc_file:
|
||||||
self.draw_project_ui(context)
|
self.draw_project_ui(context)
|
||||||
else:
|
else:
|
||||||
self.draw_create_project_ui(context)
|
self.draw_create_project_ui(context)
|
||||||
@@ -22,12 +23,16 @@ class BIM_PT_project(Panel):
|
|||||||
def draw_project_ui(self, context):
|
def draw_project_ui(self, context):
|
||||||
props = context.scene.BIMProperties
|
props = context.scene.BIMProperties
|
||||||
row = self.layout.row(align=True)
|
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.label(text=os.path.basename(props.ifc_file) or "No File Found")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
if IfcStore.get_file():
|
||||||
row.label(text="IFC Schema", icon="FILE_CACHE")
|
row = self.layout.row(align=True)
|
||||||
row.label(text=IfcStore.get_file().schema)
|
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 = self.layout.row(align=True)
|
||||||
row.prop(props, "ifc_file", text="")
|
row.prop(props, "ifc_file", text="")
|
||||||
|
|||||||
Reference in New Issue
Block a user