Resolve #1836. Scaling in Blender is now auto resolved when representations are updated.

This commit is contained in:
Dion Moult
2021-11-08 20:57:57 +11:00
parent 9076043a5c
commit 7ccb6ee110
4 changed files with 56 additions and 5 deletions
@@ -42,6 +42,27 @@ Scenario: Add representation - add a new representation to a typed instance
Then the object "IfcWall/Instance" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
And the object "IfcWall/Instance.001" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
Scenario: Add representation - add a representation with a scale factor applied
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
When the object "Cube" is scaled to "2"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
Then the object "IfcWall/Cube" has no scale
And the object "IfcWall/Cube" dimensions are "4,4,4"
Scenario: Add representation - add a representation with a scale factor removed due to multiple users
Given an empty IFC project
And I add a cube
And I press "object.duplicate_move_linked"
And the object "Cube" is selected
When the object "Cube" is scaled to "2"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
Then the object "IfcWall/Cube" has no scale
And the object "IfcWall/Cube" dimensions are "2,2,2"
Scenario: Switch representation
Given an empty IFC project
And I add a cube
+24 -2
View File
@@ -86,7 +86,7 @@ def i_add_an_empty():
@given("I add a sun")
@when("I add an sun")
def i_add_an_empty():
def i_add_a_sun():
bpy.ops.object.light_add(type="SUN")
@@ -143,10 +143,16 @@ def the_object_name_is_selected(name):
@given(parsers.parse('the object "{name}" is moved to "{location}"'))
@when(parsers.parse('the object "{name}" is moved to "{location}"'))
def the_object_name_is_selected(name, location):
def the_object_name_is_moved_to_location(name, location):
the_object_name_exists(name).location += Vector([float(co) for co in location.split(",")])
@given(parsers.parse('the object "{name}" is scaled to "{scale}"'))
@when(parsers.parse('the object "{name}" is scaled to "{scale}"'))
def the_object_name_is_scaled_to_scale(name, scale):
the_object_name_exists(name).scale *= float(scale)
@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):
@@ -449,6 +455,22 @@ def the_object_name_is_at_location(name, location):
).length < 0.1, f"Object is at {obj_location}"
@then(parsers.parse('the object "{name}" has no scale'))
def the_object_name_has_no_scale(name):
assert the_object_name_exists(name).scale == Vector(
(
1.0,
1.0,
1.0,
)
)
@then(parsers.parse('the object "{name}" dimensions are "{dimensions}"'))
def the_object_name_dimensions_are_dimensions(name, dimensions):
assert list(the_object_name_exists(name).dimensions) == [float(co) for co in dimensions.split(",")]
@then(parsers.parse('the object "{name}" bottom left corner is at "{location}"'))
def the_object_name_is_at_location(name, location):
obj_corner = Vector(the_object_name_exists(name).bound_box[0])