fixed issue adding bend between segments located at the same point

also added some tests
This commit is contained in:
Andrej730
2023-11-14 17:18:57 +05:00
parent e8aa8c44e5
commit c6454803ee
4 changed files with 106 additions and 31 deletions
+14 -3
View File
@@ -28,6 +28,7 @@ from blenderbim.tool.brick import BrickStore
from blenderbim.bim.module.model.data import AuthoringData
from pytest_bdd import scenarios, given, when, then, parsers
from mathutils import Vector
from math import radians
scenarios("feature")
@@ -241,13 +242,23 @@ def then_the_object_name_is_selected(name):
assert obj in bpy.context.selected_objects
@given(parsers.parse('the object "{name}" is rotated by "{rotation_deg}" deg'))
@when(parsers.parse('the object "{name}" is rotated by "{rotation_deg}" deg'))
def the_object_name_is_rotated_by(name, rotation_deg):
rotation_deg = [radians(float(rot)) for rot in rotation_deg.split(",")]
obj = the_object_name_exists(name)
obj.rotation_euler[0] += rotation_deg[0]
obj.rotation_euler[1] += rotation_deg[1]
obj.rotation_euler[2] += rotation_deg[2]
bpy.context.view_layer.update() # make sure matrix is updated
@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_moved_to_location(name, location):
location = [float(co) for co in location.split(",")]
the_object_name_exists(name).matrix_world[0][3] = location[0]
the_object_name_exists(name).matrix_world[1][3] = location[1]
the_object_name_exists(name).matrix_world[2][3] = location[2]
obj = the_object_name_exists(name)
obj.matrix_world.translation = location
@given(parsers.parse('the object "{name}" is scaled to "{scale}"'))