mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 07:42:41 +00:00
New save and save as buttons in project panel with last saved date.
This commit is contained in:
@@ -89,5 +89,7 @@ class DrawingsData:
|
|||||||
def location_hint(cls):
|
def location_hint(cls):
|
||||||
if bpy.context.scene.DocProperties.target_view == "PLAN_VIEW":
|
if bpy.context.scene.DocProperties.target_view == "PLAN_VIEW":
|
||||||
results = [("0", "Origin", "")]
|
results = [("0", "Origin", "")]
|
||||||
results.extend([(str(s.id()), s.Name or "Unnamed", "") for s in tool.Ifc.get().by_type("IfcBuildingStorey")])
|
results.extend(
|
||||||
|
[(str(s.id()), s.Name or "Unnamed", "") for s in tool.Ifc.get().by_type("IfcBuildingStorey")]
|
||||||
|
)
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ class ProjectData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {"export_schema": cls.get_export_schema(), "template_file": cls.template_file()}
|
cls.data = {
|
||||||
|
"export_schema": cls.get_export_schema(),
|
||||||
|
"template_file": cls.template_file(),
|
||||||
|
"last_saved": cls.last_saved(),
|
||||||
|
}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -45,3 +49,15 @@ class ProjectData:
|
|||||||
results = [("0", "Blank Project", "")]
|
results = [("0", "Blank Project", "")]
|
||||||
results.extend([(f, f.replace(".ifc", ""), "") for f in files if ".ifc" in f])
|
results.extend([(f, f.replace(".ifc", ""), "") for f in files if ".ifc" in f])
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def last_saved(cls):
|
||||||
|
ifc = tool.Ifc.get()
|
||||||
|
if not ifc:
|
||||||
|
return ""
|
||||||
|
try:
|
||||||
|
save_datetime = ifc.wrapped_data.header.file_name.time_stamp
|
||||||
|
save_date, save_time = save_datetime.split("T")
|
||||||
|
return f"{save_date} {':'.join(save_time.split(':')[0:2])}"
|
||||||
|
except:
|
||||||
|
return ""
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ class BIM_PT_project(Panel):
|
|||||||
props = context.scene.BIMProperties
|
props = context.scene.BIMProperties
|
||||||
pprops = context.scene.BIMProjectProperties
|
pprops = context.scene.BIMProjectProperties
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="IFC Filename", icon="FILE")
|
row.label(text=os.path.basename(props.ifc_file) or "No File Found", icon="FILE")
|
||||||
row.label(text=os.path.basename(props.ifc_file) or "No File Found")
|
|
||||||
|
|
||||||
if IfcStore.get_file():
|
if IfcStore.get_file():
|
||||||
row.prop(pprops, "is_authoring", icon="MODIFIER", text="")
|
row.prop(pprops, "is_authoring", icon="MODIFIER", text="")
|
||||||
@@ -136,12 +135,21 @@ class BIM_PT_project(Panel):
|
|||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="File Not Loaded", icon="ERROR")
|
row.label(text="File Not Loaded", icon="ERROR")
|
||||||
|
|
||||||
|
if props.ifc_file:
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.label(text="Saved", icon="EXPORT")
|
||||||
|
row.label(text=ProjectData.data["last_saved"])
|
||||||
|
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.prop(props, "ifc_file", text="")
|
||||||
|
row.operator("bim.reload_ifc_file", icon="FILE_REFRESH", text="")
|
||||||
|
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.prop(props, "ifc_file", text="")
|
op = row.operator("export_ifc.bim", icon="EXPORT", text="Save Project")
|
||||||
row.operator("bim.reload_ifc_file", icon="FILE_REFRESH", text="")
|
op.should_save_as = False
|
||||||
op = row.operator("export_ifc.bim", icon="FILE_TICK", text="")
|
op = row.operator("export_ifc.bim", icon="FILE_TICK", text="Save As")
|
||||||
op.should_save_as = True
|
op.should_save_as = True
|
||||||
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
|
|
||||||
|
|
||||||
def draw_create_project_ui(self, context):
|
def draw_create_project_ui(self, context):
|
||||||
props = context.scene.BIMProperties
|
props = context.scene.BIMProperties
|
||||||
|
|||||||
Reference in New Issue
Block a user