Assigning an opening now ensures it displays as a wire

This commit is contained in:
Dion Moult
2021-09-09 12:51:54 +10:00
parent d6aec719e5
commit 3004d5424c
5 changed files with 13 additions and 19 deletions
@@ -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()
@@ -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())
@@ -18,12 +18,10 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
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")
+5
View File
@@ -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,
}
@@ -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