mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
provide user feedback in IFC export
This commit is contained in:
@@ -1756,22 +1756,25 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
|
|||||||
bim_props = tool.Blender.get_bim_props()
|
bim_props = tool.Blender.get_bim_props()
|
||||||
if bim_props.ifc_file != output_file and extension not in ("ifczip", "ifcjson"):
|
if bim_props.ifc_file != output_file and extension not in ("ifczip", "ifcjson"):
|
||||||
tool.Ifc.set_path(output_file)
|
tool.Ifc.set_path(output_file)
|
||||||
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
|
|
||||||
if save_blend_file:
|
|
||||||
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
|
||||||
bim_props.is_dirty = False
|
bim_props.is_dirty = False
|
||||||
|
|
||||||
if tool.Blender.get_addon_preferences().user_ui_customization:
|
if tool.Blender.get_addon_preferences().user_ui_customization:
|
||||||
try:
|
try:
|
||||||
bpy.ops.bim.save_blend_metadata_file()
|
bpy.ops.bim.save_blend_metadata_file()
|
||||||
|
blendmetadata_path = output_file + ".metadata.blend"
|
||||||
|
self.report({"INFO"}, f'IFC Project "{os.path.basename(output_file)}" And Metadata File Saved to: {os.path.basename(blendmetadata_path)}')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
settings.logger.warning(f"Failed to save blend metadata file: {e}")
|
self.report({"ERROR"}, f"Failed to save blend metadata file: {e}")
|
||||||
|
else:
|
||||||
|
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
|
||||||
|
if save_blend_file:
|
||||||
|
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
||||||
|
self.report(
|
||||||
|
{"INFO"},
|
||||||
|
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved',
|
||||||
|
)
|
||||||
|
|
||||||
bonsai.bim.handler.refresh_ui_data()
|
bonsai.bim.handler.refresh_ui_data()
|
||||||
self.report(
|
|
||||||
{"INFO"},
|
|
||||||
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved',
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def description(cls, context, properties):
|
def description(cls, context, properties):
|
||||||
|
|||||||
@@ -294,10 +294,6 @@ bpy.ops.wm.save_as_mainfile(filepath=r'{blendmetadata_path}')
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if result.returncode == 0:
|
|
||||||
self.report({"INFO"}, f"Blend metadata file saved to: {blendmetadata_path}")
|
|
||||||
else:
|
|
||||||
self.report({"ERROR"}, f"Failed to save blend metadata file: {result.stderr.decode()}")
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
class LoadBlendMetadataAndIFC(bpy.types.Operator):
|
class LoadBlendMetadataAndIFC(bpy.types.Operator):
|
||||||
|
|||||||
Reference in New Issue
Block a user