Moving grid axes are now synchronised automatically

This commit is contained in:
Dion Moult
2021-10-28 19:35:22 +11:00
parent b67d56ada1
commit 72d9bc9256
3 changed files with 42 additions and 0 deletions
@@ -320,3 +320,20 @@ Scenario: Export IFC - with basic contents
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
Then nothing happens
Scenario: Export IFC - with moved object location synchronised
Given an empty IFC project
When the object "IfcBuildingStorey/My Storey" is moved to "0,0,1"
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
And an empty Blender session
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
Then the object "IfcBuildingStorey/My Storey" is at "0,0,1"
Scenario: Export IFC - with moved grid axis location synchronised
Given an empty IFC project
And I press "mesh.add_grid"
When the object "IfcGridAxis/01" is moved to "1,0,0"
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
And an empty Blender session
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
Then the object "IfcGridAxis/01" bottom left corner is at "1,-2,0"
+15
View File
@@ -41,6 +41,7 @@ def replace_variables(value):
@given("an empty Blender session")
@when("an empty Blender session")
def an_empty_ifc_project():
IfcStore.purge()
bpy.ops.wm.read_homefile(app_template="")
@@ -140,6 +141,12 @@ def the_object_name_is_selected(name):
additionally_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):
the_object_name_exists(name).location += Vector([float(co) for co in location.split(",")])
@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):
@@ -428,6 +435,14 @@ def the_object_name_is_at_location(name, location):
).length < 0.1, f"Object is at {obj_location}"
@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])
assert (
obj_corner - Vector([float(co) for co in location.split(",")])
).length < 0.1, f"Object has corner {obj_corner}"
@then(parsers.parse('the object "{name}" is contained in "{container_name}"'))
def the_object_name_is_contained_in_container_name(name, container_name):
ifc = an_ifc_file_exists()