Fix bug where assigning a type did not use existing representation data in the scene if the context had changed

This commit is contained in:
Dion Moult
2021-11-06 20:56:53 +11:00
parent 4149292a13
commit 8e215382f7
9 changed files with 99 additions and 66 deletions
+14
View File
@@ -228,6 +228,7 @@ def the_object_name_has_a_body_of_value(name, value):
assert the_object_name_exists(name).data.body == value
@given(parsers.parse('the object "{name}" has a "{type}" representation of "{context}"'))
@then(parsers.parse('the object "{name}" has a "{type}" representation of "{context}"'))
def the_object_name_has_a_representation_type_of_context(name, type, context):
ifc = an_ifc_file_exists()
@@ -238,6 +239,19 @@ def the_object_name_has_a_representation_type_of_context(name, type, context):
assert rep.RepresentationType == type
@given(parsers.parse('the object "{name}" data is a "{type}" representation of "{context}"'))
@then(parsers.parse('the object "{name}" data is a "{type}" representation of "{context}"'))
def the_object_name_has_a_representation_type_of_context(name, type, context):
ifc = an_ifc_file_exists()
context, subcontext, target_view = context.split("/")
rep = ifc.by_id(the_object_name_exists(name).data.BIMMeshProperties.ifc_definition_id)
assert rep
assert rep.RepresentationType == type
assert rep.ContextOfItems.ContextType == context
assert rep.ContextOfItems.ContextIdentifier == subcontext
assert rep.ContextOfItems.TargetView == target_view
@then(parsers.parse('the material "{name}" exists'))
def the_material_name_exists(name) -> bpy.types.Material:
obj = bpy.data.materials.get(name)