From 3004d5424c7ffbb4a19d8d3a449f1d6b245677c3 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 9 Sep 2021 12:51:54 +1000 Subject: [PATCH] Assigning an opening now ensures it displays as a wire --- .../bim/module/bimtester/operator.py | 4 ---- .../bim/module/geometry/operator.py | 1 - .../blenderbim/bim/module/root/operator.py | 3 +-- src/blenderbim/test/bim/bootstrap.py | 5 +++++ .../test/bim/module/root/test_operator.py | 19 +++++++------------ 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/bimtester/operator.py b/src/blenderbim/blenderbim/bim/module/bimtester/operator.py index d7c229f13d..0f3541e6de 100644 --- a/src/blenderbim/blenderbim/bim/module/bimtester/operator.py +++ b/src/blenderbim/blenderbim/bim/module/bimtester/operator.py @@ -73,10 +73,6 @@ class BIMTesterPurge(bpy.types.Operator): bl_label = "Purge Tests" def execute(self, context): - filename = os.path.join( - context.scene.BimTesterProperties.features_dir, - context.scene.BimTesterProperties.features_file + ".feature", - ) cwd = os.getcwd() os.chdir(context.scene.BimTesterProperties.features_dir) bimtester.clean.TestPurger().purge() diff --git a/src/blenderbim/blenderbim/bim/module/geometry/operator.py b/src/blenderbim/blenderbim/bim/module/geometry/operator.py index a3e5ae03e2..c6fe918272 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/operator.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/operator.py @@ -154,7 +154,6 @@ class AddRepresentation(bpy.types.Operator): "geometry.assign_representation", self.file, **{"product": product, "representation": result} ) - existing_mesh = obj.data mesh = obj.data.copy() mesh.name = "{}/{}".format(context_id, result.id()) mesh.BIMMeshProperties.ifc_definition_id = int(result.id()) diff --git a/src/blenderbim/blenderbim/bim/module/root/operator.py b/src/blenderbim/blenderbim/bim/module/root/operator.py index d230398dfa..2abd1a011b 100644 --- a/src/blenderbim/blenderbim/bim/module/root/operator.py +++ b/src/blenderbim/blenderbim/bim/module/root/operator.py @@ -18,12 +18,10 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import numpy as np import ifcopenshell import ifcopenshell.api import ifcopenshell.util.schema import ifcopenshell.util.element -from ifcopenshell.api.geometry.data import Data as GeometryData from ifcopenshell.api.void.data import Data as VoidData from blenderbim.bim.ifc import IfcStore @@ -149,6 +147,7 @@ class AssignClass(bpy.types.Operator): if product.is_a("IfcElementType"): self.place_in_types_collection(obj, context) elif product.is_a("IfcOpeningElement"): + obj.display_type = "WIRE" self.place_in_openings_collection(obj, context) elif ( product.is_a("IfcSpatialElement") diff --git a/src/blenderbim/test/bim/bootstrap.py b/src/blenderbim/test/bim/bootstrap.py index f4230acde2..bbc97191ad 100644 --- a/src/blenderbim/test/bim/bootstrap.py +++ b/src/blenderbim/test/bim/bootstrap.py @@ -153,6 +153,10 @@ def the_file_name_should_contain_value(name, value): assert value in f.read() + +def the_object_name_should_display_as_mode(name, mode): + assert the_object_name_exists(name).display_type == mode + definitions = { "an empty IFC project": an_empty_ifc_project, "I add a cube": i_add_a_cube, @@ -170,6 +174,7 @@ definitions = { "I duplicate the selected objects": i_duplicate_the_selected_objects, 'the object "(.*)" and "(.*)" are different elements': the_object_name1_and_name2_are_different_elements, 'the file "(.*)" should contain "(.*)"': the_file_name_should_contain_value, + 'the object "(.*)" should display as "(.*)"': the_object_name_should_display_as_mode, } diff --git a/src/blenderbim/test/bim/module/root/test_operator.py b/src/blenderbim/test/bim/module/root/test_operator.py index e49310d3e2..d7183b551e 100644 --- a/src/blenderbim/test/bim/module/root/test_operator.py +++ b/src/blenderbim/test/bim/module/root/test_operator.py @@ -24,8 +24,7 @@ class TestAssignClass(test.bim.bootstrap.NewFile): def test_assigning_a_class_to_a_cube(self): return """ Given an empty IFC project - When I add a cube - And the object "Cube" is selected + When the object "Cube" is selected And I set "scene.BIMRootProperties.ifc_class" to "IfcWall" And I press "bim.assign_class" Then the object "IfcWall/Cube" is an "IfcWall" @@ -37,8 +36,7 @@ class TestAssignClass(test.bim.bootstrap.NewFile): def test_assigning_a_type_class_to_a_cube(self): return """ Given an empty IFC project - When I add a cube - And the object "Cube" is selected + When the object "Cube" is selected And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType" And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType" And I press "bim.assign_class" @@ -51,8 +49,7 @@ class TestAssignClass(test.bim.bootstrap.NewFile): def test_assigning_a_spatial_class_to_a_cube(self): return """ Given an empty IFC project - When I add a cube - And the object "Cube" is selected + When the object "Cube" is selected And I set "scene.BIMRootProperties.ifc_product" to "IfcSpatialElement" And I set "scene.BIMRootProperties.ifc_class" to "IfcBuilding" And I press "bim.assign_class" @@ -65,12 +62,12 @@ class TestAssignClass(test.bim.bootstrap.NewFile): def test_assigning_an_opening_class_to_a_cube(self): return """ Given an empty IFC project - When I add a cube - And the object "Cube" is selected + When the object "Cube" is selected And I set "scene.BIMRootProperties.ifc_product" to "IfcElement" And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement" And I press "bim.assign_class" Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement" + And the object "IfcOpeningElement/Cube" should display as "WIRE" And the object "IfcOpeningElement/Cube" is in the collection "IfcOpeningElements" And the object "IfcOpeningElement/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW" """ @@ -79,8 +76,7 @@ class TestAssignClass(test.bim.bootstrap.NewFile): def test_assigning_a_class_to_a_cube_in_a_collection(self): return """ Given an empty IFC project - When I add a cube - And the object "Cube" is selected + When the object "Cube" is selected And the object "Cube" is placed in the collection "IfcBuildingStorey/My Storey" And I set "scene.BIMRootProperties.ifc_class" to "IfcWall" And I press "bim.assign_class" @@ -93,8 +89,7 @@ class TestCopyClass(test.bim.bootstrap.NewFile): def test_copying_a_wall(self): return """ Given an empty IFC project - When I add a cube - And the object "Cube" is selected + When the object "Cube" is selected And I set "scene.BIMRootProperties.ifc_class" to "IfcWall" And I press "bim.assign_class" And I duplicate the selected objects