mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 10:51:13 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user