New feature to select the container of an object

This commit is contained in:
Dion Moult
2021-11-07 15:32:33 +11:00
parent de561b78e0
commit 05068754b9
10 changed files with 58 additions and 9 deletions
@@ -40,3 +40,16 @@ Scenario: Copy to container
When I set "scene.BIMSpatialProperties.containers[0].is_selected" to "True"
And I press "bim.copy_to_container"
Then the object "IfcWall/Cube.001" is in the collection "IfcSite/My Site"
Scenario: Select container
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I press "bim.enable_editing_container"
And the variable "site" is "tool.Ifc.get().by_type('IfcSite')[0].id()"
And I press "bim.assign_container(structure={site})"
When I press "bim.select_container"
Then nothing happens
+9
View File
@@ -94,3 +94,12 @@ class TestCopyToContainer:
spatial.disable_editing("obj").should_be_called()
subject.copy_to_container(ifc, spatial, obj="obj", containers=["to_container"])
class TestSelectContainer:
def test_run(self, ifc, spatial):
ifc.get_entity("obj").should_be_called().will_return("element")
spatial.get_container("element").should_be_called().will_return("container")
ifc.get_object("container").should_be_called().will_return("container_obj")
spatial.set_active_object("container_obj").should_be_called()
subject.select_container(ifc, spatial, obj="obj")
+9
View File
@@ -192,6 +192,15 @@ class TestRunSpatialAssignContainer(NewFile):
pass
class TestSetActiveObject(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
bpy.context.scene.collection.objects.link(obj)
subject.set_active_object(obj)
assert bpy.context.view_layer.objects.active == obj
assert obj in bpy.context.selected_objects
class TestSetRelativeObjectMatrix(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)