Fix regressions after making aggregate based on selected objects.

This commit is contained in:
Dion Moult
2023-06-01 16:59:45 +10:00
parent 586707dd28
commit 7cd7ad1281
4 changed files with 22 additions and 23 deletions
@@ -18,10 +18,10 @@ Scenario: Disable editing aggregate
Scenario: Assign object
Given an empty IFC project
And the object "IfcSite/My Site" is selected
And the object "IfcBuildingStorey/My Storey" is selected
And I press "bim.enable_editing_aggregate"
And the variable "relating_object" is "tool.Ifc.get().by_type('IfcSite')[0].id()"
And the variable "related_object" is "tool.Ifc.get().by_type('IfcBuildingStorey')[0].id()"
When I press "bim.assign_object(relating_object={relating_object}, related_object={related_object})"
When I press "bim.assign_object(relating_object={relating_object})"
Then the object "IfcSite/My Site" is in the collection "IfcSite/My Site"
And the object "IfcBuildingStorey/My Storey" is in the collection "IfcBuildingStorey/My Storey"
And the collection "IfcBuildingStorey/My Storey" is in the collection "IfcSite/My Site"
@@ -31,8 +31,7 @@ Scenario: Unassign object
And the object "IfcBuildingStorey/My Storey" is selected
And I press "bim.enable_editing_aggregate"
And the variable "relating_object" is "tool.Ifc.get().by_type('IfcSite')[0].id()"
And the variable "related_object" is "tool.Ifc.get().by_type('IfcBuildingStorey')[0].id()"
And I press "bim.assign_object(relating_object={relating_object}, related_object={related_object})"
And I press "bim.assign_object(relating_object={relating_object})"
And the object "IfcBuildingStorey/My Storey" is selected
When I press "bim.unassign_object"
Then the object "IfcSite/My Site" is in the collection "IfcSite/My Site"
+9 -4
View File
@@ -18,6 +18,7 @@
import os
import bpy
import traceback
import webbrowser
import ifcopenshell
import blenderbim.tool as tool
@@ -167,10 +168,14 @@ def i_add_a_plane_of_size_size_at_location(size, location):
@when(parsers.parse('I press "{operator}"'))
def i_press_operator(operator):
operator = replace_variables(operator)
if "(" in operator:
exec(f"bpy.ops.{operator}")
else:
exec(f"bpy.ops.{operator}()")
try:
if "(" in operator:
exec(f"bpy.ops.{operator}")
else:
exec(f"bpy.ops.{operator}()")
except:
traceback.print_exc()
assert False, f"Failed to run operator bpy.ops.{operator}"
@given(parsers.parse('I evaluate expression "{expression}"'))