fix bim geometry tests after fccf56d

This commit is contained in:
Andrej730
2024-07-31 13:17:36 +05:00
parent a24bb069aa
commit 3d86e5fff3
3 changed files with 18 additions and 8 deletions
+5 -2
View File
@@ -169,8 +169,11 @@ def get_representation_ifc_parameters(
def remove_representation(
ifc: tool.Ifc, geometry: tool.Geometry, obj: bpy.types.Object, representation: ifcopenshell.entity_instance
) -> None:
"""Consider changing obj representation before using the function,
otherwise it will replace object with empty."""
"""Remove IFC representation from an object.
If removed representation is active will automatically change it to some other one.
If it is the object's only representation, object will be recreated as an empty.
"""
element = ifc.get_entity(obj)
assert element
@@ -927,6 +927,7 @@ class Geometry(blenderbim.core.tool.Geometry):
new_representation = None
for r in cls.get_representations_iter(element):
r = tool.Geometry.resolve_mapped_representation(r)
if r != representation:
new_representation = r
break
@@ -131,8 +131,10 @@ Scenario: Remove representation - remove an active representation
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
When the variable "representation" is "{ifc}.by_type('IfcShapeRepresentation')[0].id()"
And I press "bim.remove_representation(representation_id={representation})"
When the variable "representation_body" is "{ifc}.by_type('IfcShapeRepresentation')[0].id()"
And the variable "representation_bbox" is "{ifc}.by_type('IfcShapeRepresentation')[1].id()"
And I press "bim.remove_representation(representation_id={representation_body})"
And I press "bim.remove_representation(representation_id={representation_bbox})"
Then the object "IfcWall/Cube" has no data
Scenario: Remove representation - remove an unloaded representation
@@ -160,8 +162,10 @@ Scenario: Remove representation - remove an instanced representation from an act
And I press "bim.add_constr_type_instance"
And I press "bim.add_constr_type_instance"
And the object "IfcWallType/Cube" is selected
When the variable "representation" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[1].MappedRepresentation.id()"
And I press "bim.remove_representation(representation_id={representation})"
When the variable "representation_body" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[1].MappedRepresentation.id()"
And the variable "representation_bbox" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[0].MappedRepresentation.id()"
And I press "bim.remove_representation(representation_id={representation_body})"
And I press "bim.remove_representation(representation_id={representation_bbox})"
Then the object "IfcWallType/Cube" has no data
Then the object "IfcWall/Wall" has no data
Then the object "IfcWall/Wall.001" has no data
@@ -179,8 +183,10 @@ Scenario: Remove representation - remove an instanced representation from an act
And I press "bim.add_constr_type_instance"
And I press "bim.add_constr_type_instance"
And the object "IfcWall/Wall" is selected
When the variable "representation" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[1].id()"
And I press "bim.remove_representation(representation_id={representation})"
When the variable "representation_body" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[1].id()"
And the variable "representation_bbox" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[0].id()"
And I press "bim.remove_representation(representation_id={representation_body})"
And I press "bim.remove_representation(representation_id={representation_bbox})"
Then the object "IfcWallType/Cube" has no data
Then the object "IfcWall/Wall" has no data
Then the object "IfcWall/Wall.001" has no data