Removing or changing spatial containers now supports updating more types of collection organisations

This commit is contained in:
Dion Moult
2021-10-05 14:52:41 +11:00
parent f5913baaca
commit 7c94d4275a
26 changed files with 582 additions and 193 deletions
@@ -0,0 +1,30 @@
@spatial
Feature: Spatial
Covers spatial containment management.
Scenario: Enable editing container
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
When I press "bim.enable_editing_container"
Then nothing happens
Scenario: Disable editing container
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I press "bim.enable_editing_container"
When I press "bim.disable_editing_container"
Then nothing happens
Scenario: Assign 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()"
When I press "bim.assign_container(structure={site})"
Then the object "IfcWall/Cube" is in the collection "IfcSite/My Site"
+9 -2
View File
@@ -18,6 +18,7 @@
import os
import bpy
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from pytest_bdd import scenarios, given, when, then, parsers
@@ -103,8 +104,9 @@ def i_delete_the_selected_objects():
bpy.ops.object.delete()
@then(parsers.parse('the variable "{key}" is "{value}"'))
@given(parsers.parse('the variable "{key}" is "{value}"'))
@when(parsers.parse('the variable "{key}" is "{value}"'))
@then(parsers.parse('the variable "{key}" is "{value}"'))
def the_variable_key_is_value(key, value):
variables[key] = eval(replace_variables(value))
@@ -122,7 +124,7 @@ def the_object_name_exists(name) -> bpy.types.Object:
return obj
@then('an IFC file exists')
@then("an IFC file exists")
def an_ifc_file_exists():
ifc = IfcStore.get_file()
if not ifc:
@@ -255,3 +257,8 @@ def prop_is_value(prop, value):
if not is_value:
actual_value = eval(f"bpy.context.{prop}")
assert False, f"Value is {actual_value}"
@then(parsers.parse('the object "{name}" is in the collection "{collection}"'))
def the_object_name_is_in_the_collection_collection(name, collection):
assert collection in [c.name for c in the_object_name_exists(name).users_collection]