From 22b7027746b1694acaa8d551281728c925272356 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 7 Jul 2024 15:52:56 +1000 Subject: [PATCH] Fix bug where automatic false origin detection didn't do anything if linking from an empty Blender session --- .../blenderbim/bim/module/project/operator.py | 1 + .../test/bim/feature/project.feature | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/blenderbim/blenderbim/bim/module/project/operator.py b/src/blenderbim/blenderbim/bim/module/project/operator.py index e52886ddd7..b7b2cd944b 100644 --- a/src/blenderbim/blenderbim/bim/module/project/operator.py +++ b/src/blenderbim/blenderbim/bim/module/project/operator.py @@ -1382,6 +1382,7 @@ class LoadLinkedProject(bpy.types.Operator): tool.Loader.set_settings(import_ifc.IfcImportSettings.factory(context, IfcStore.path, logger)) tool.Loader.settings.contexts = ifcopenshell.util.representation.get_prioritised_contexts(self.file) tool.Loader.settings.context_settings = tool.Loader.create_settings() + tool.Loader.settings.gross_context_settings = tool.Loader.create_settings(is_gross=True) self.elements = set(self.file.by_type("IfcElement")) if self.file.schema in ("IFC2X3", "IFC4"): diff --git a/src/blenderbim/test/bim/feature/project.feature b/src/blenderbim/test/bim/feature/project.feature index 9a9b5deb11..0fd1458f80 100644 --- a/src/blenderbim/test/bim/feature/project.feature +++ b/src/blenderbim/test/bim/feature/project.feature @@ -673,6 +673,51 @@ Scenario: Link IFC And the object "Chunk" exists And the object "Chunk" is placed in the collection "IfcProject/basic.ifc" +Scenario: Link IFC - disabled false origin mode + Given an empty IFC project + # Not currently possible via UI + And I set "scene.BIMProjectProperties.distance_limit" to "5" + And I set "scene.BIMProjectProperties.false_origin_mode" to "DISABLED" + When I press "bim.link_ifc(filepath='{cwd}/test/files/geolocation.ifc', use_cache=False)" + Then the object "Chunk" exists + And the object "Chunk" has a vertex at "2,2,-1" + And the object "Chunk" has a vertex at "9,-1,-1" + And the object "Chunk" has a vertex at "17,4,-1" + +Scenario: Link IFC - from an empty IFC project - automatic false origin mode (0,0,0 will be the false origin) + Given an empty IFC project + # Not currently possible via UI + And I set "scene.BIMProjectProperties.distance_limit" to "5" + And I set "scene.BIMProjectProperties.false_origin_mode" to "AUTOMATIC" + When I press "bim.link_ifc(filepath='{cwd}/test/files/geolocation.ifc', use_cache=False)" + Then the object "Chunk" exists + And the object "Chunk" has a vertex at "2,2,-1" + And the object "Chunk" has a vertex at "9,-1,-1" + And the object "Chunk" has a vertex at "17,4,-1" + +Scenario: Link IFC - from an empty Blender session - automatic false origin mode (a new false origin will be detected) + Given an empty Blender session + # Not currently possible via UI + And I set "scene.BIMProjectProperties.distance_limit" to "5" + And I set "scene.BIMProjectProperties.false_origin_mode" to "AUTOMATIC" + When I press "bim.link_ifc(filepath='{cwd}/test/files/geolocation.ifc', use_cache=False)" + Then the object "Chunk" exists + And the object "Chunk" has a vertex at "-11,-2,0" + And the object "Chunk" has a vertex at "-4,-5,0" + And the object "Chunk" has a vertex at "4,0,0" + +Scenario: Link IFC - manual false origin mode + Given an empty Blender session + # Not currently possible via UI + And I set "scene.BIMProjectProperties.distance_limit" to "5" + And I set "scene.BIMProjectProperties.false_origin_mode" to "MANUAL" + And I set "scene.BIMProjectProperties.false_origin" to "10000,0,0" + When I press "bim.link_ifc(filepath='{cwd}/test/files/geolocation.ifc', use_cache=False)" + Then the object "Chunk" exists + And the object "Chunk" has a vertex at "-8,2,-1" + And the object "Chunk" has a vertex at "-1,-1,-1" + And the object "Chunk" has a vertex at "7,4,-1" + Scenario: Toggle link visibility - wireframe mode Given an empty IFC project And I press "bim.link_ifc(filepath='{cwd}/test/files/basic.ifc')"