From d63be20c8bef22239342b70bb47e7cbbf44b73a5 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 14 Jan 2022 18:55:44 +1100 Subject: [PATCH] Fix #1989. Fix bug where you couldn't export to IfcJSON, since it couldn't be imported again. --- .../blenderbim/bim/module/project/operator.py | 2 +- src/blenderbim/test/bim/feature/project.feature | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/project/operator.py b/src/blenderbim/blenderbim/bim/module/project/operator.py index 973b0d140d..2276c57ef8 100644 --- a/src/blenderbim/blenderbim/bim/module/project/operator.py +++ b/src/blenderbim/blenderbim/bim/module/project/operator.py @@ -802,7 +802,7 @@ class ExportIFC(bpy.types.Operator): new.name = output_file if self.use_relative_path and bpy.data.is_saved: output_file = os.path.relpath(output_file, bpy.path.abspath("//")) - if scene.BIMProperties.ifc_file != output_file: + if scene.BIMProperties.ifc_file != output_file and extension not in ["ifczip", "ifcjson"]: scene.BIMProperties.ifc_file = output_file if bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath: bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath) diff --git a/src/blenderbim/test/bim/feature/project.feature b/src/blenderbim/test/bim/feature/project.feature index 02d09a56c1..4cbefdb77d 100644 --- a/src/blenderbim/test/bim/feature/project.feature +++ b/src/blenderbim/test/bim/feature/project.feature @@ -332,6 +332,18 @@ Scenario: Export IFC - with basic contents and saving as another file When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc', should_save_as=True)" Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/export.ifc" +Scenario: Export IFC - with basic contents and saving as IfcJSON where import is not supported + Given an empty Blender session + And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')" + When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifcjson', should_save_as=True)" + Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/basic.ifc" + +Scenario: Export IFC - with basic contents and saving as IfcZip where import is not supported + Given an empty Blender session + And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')" + When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifczip', should_save_as=True)" + Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/basic.ifc" + Scenario: Export IFC - with basic contents and saving as a relative path Given an empty Blender session And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"