Fix bug where copying a type also copied its type relations which is invalid.

This commit is contained in:
Dion Moult
2021-10-26 20:51:27 +11:00
parent ee308d294f
commit 3406c23f98
8 changed files with 66 additions and 30 deletions
+14 -1
View File
@@ -44,7 +44,7 @@ Scenario: Assign a type class to a cube
Then the object "IfcWallType/Cube" is an "IfcWallType"
And the object "IfcWallType/Cube" is in the collection "Types"
And the object "IfcWallType/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
Scenario: Assign a spatial class to a cube
Given an empty IFC project
And I add a cube
@@ -56,6 +56,19 @@ Scenario: Assign a spatial class to a cube
And the object "IfcBuilding/Cube" is in the collection "IfcBuilding/Cube"
And the object "IfcBuilding/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
Scenario: Assign a spatial class to a cube already in a collection
Given an empty IFC project
And I add a cube
And the object "Cube" is placed in the collection "IfcBuildingStorey/My Storey"
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcSpatialElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcSpace"
And I press "bim.assign_class"
Then the object "IfcSpace/Cube" is an "IfcSpace"
And the object "IfcSpace/Cube" is in the collection "IfcSpace/Cube"
And the collection "IfcSpace/Cube" is in the collection "IfcBuildingStorey/My Storey"
And the object "IfcSpace/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
Scenario: Assign an opening class to a cube
Given an empty IFC project
And I add a cube
+1
View File
@@ -133,6 +133,7 @@ def the_object_name_is_selected(name):
additionally_the_object_name_is_selected(name)
@given(parsers.parse('the object "{name}" is placed in the collection "{collection}"'))
@when(parsers.parse('the object "{name}" is placed in the collection "{collection}"'))
def the_object_name_is_placed_in_the_collection_collection(name, collection):
obj = the_object_name_exists(name)
@@ -158,3 +158,23 @@ class TestAssign(NewFile):
)
subject.assign(subelement_obj)
assert subelement_obj.users_collection[0].name == "IfcSite/My Site"
def test_in_decomposition_mode_types_are_placed_in_the_types_collection(self):
bpy.ops.bim.create_project()
element_obj = bpy.data.objects.new("IfcWallType/Name", None)
element = tool.Ifc.get().createIfcWallType()
tool.Ifc.link(element, element_obj)
bpy.context.scene.collection.objects.link(element_obj)
subject.assign(element_obj)
assert element_obj.users_collection[0].name == "Types"
assert bpy.data.collections.get("IfcProject/My Project").children.get("Types")
def test_in_decomposition_mode_openings_are_placed_in_the_openings_collection(self):
bpy.ops.bim.create_project()
element_obj = bpy.data.objects.new("IfcOpeningElement/Name", None)
element = tool.Ifc.get().createIfcOpeningElement()
tool.Ifc.link(element, element_obj)
bpy.context.scene.collection.objects.link(element_obj)
subject.assign(element_obj)
assert element_obj.users_collection[0].name == "IfcOpeningElements"
assert bpy.data.collections.get("IfcProject/My Project").children.get("IfcOpeningElements")