mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 15:07:38 +00:00
fix bim geometry tests after fccf56d
This commit is contained in:
@@ -169,8 +169,11 @@ def get_representation_ifc_parameters(
|
|||||||
def remove_representation(
|
def remove_representation(
|
||||||
ifc: tool.Ifc, geometry: tool.Geometry, obj: bpy.types.Object, representation: ifcopenshell.entity_instance
|
ifc: tool.Ifc, geometry: tool.Geometry, obj: bpy.types.Object, representation: ifcopenshell.entity_instance
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Consider changing obj representation before using the function,
|
"""Remove IFC representation from an object.
|
||||||
otherwise it will replace object with empty."""
|
|
||||||
|
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)
|
element = ifc.get_entity(obj)
|
||||||
assert element
|
assert element
|
||||||
|
|||||||
@@ -927,6 +927,7 @@ class Geometry(blenderbim.core.tool.Geometry):
|
|||||||
|
|
||||||
new_representation = None
|
new_representation = None
|
||||||
for r in cls.get_representations_iter(element):
|
for r in cls.get_representations_iter(element):
|
||||||
|
r = tool.Geometry.resolve_mapped_representation(r)
|
||||||
if r != representation:
|
if r != representation:
|
||||||
new_representation = r
|
new_representation = r
|
||||||
break
|
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_product" to "IfcElement"
|
||||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||||
And I press "bim.assign_class"
|
And I press "bim.assign_class"
|
||||||
When the variable "representation" is "{ifc}.by_type('IfcShapeRepresentation')[0].id()"
|
When the variable "representation_body" is "{ifc}.by_type('IfcShapeRepresentation')[0].id()"
|
||||||
And I press "bim.remove_representation(representation_id={representation})"
|
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
|
Then the object "IfcWall/Cube" has no data
|
||||||
|
|
||||||
Scenario: Remove representation - remove an unloaded representation
|
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 I press "bim.add_constr_type_instance"
|
And I press "bim.add_constr_type_instance"
|
||||||
And the object "IfcWallType/Cube" is selected
|
And the object "IfcWallType/Cube" is selected
|
||||||
When the variable "representation" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[1].MappedRepresentation.id()"
|
When the variable "representation_body" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[1].MappedRepresentation.id()"
|
||||||
And I press "bim.remove_representation(representation_id={representation})"
|
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 "IfcWallType/Cube" has no data
|
||||||
Then the object "IfcWall/Wall" has no data
|
Then the object "IfcWall/Wall" has no data
|
||||||
Then the object "IfcWall/Wall.001" 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 I press "bim.add_constr_type_instance"
|
And I press "bim.add_constr_type_instance"
|
||||||
And the object "IfcWall/Wall" is selected
|
And the object "IfcWall/Wall" is selected
|
||||||
When the variable "representation" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[1].id()"
|
When the variable "representation_body" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[1].id()"
|
||||||
And I press "bim.remove_representation(representation_id={representation})"
|
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 "IfcWallType/Cube" has no data
|
||||||
Then the object "IfcWall/Wall" has no data
|
Then the object "IfcWall/Wall" has no data
|
||||||
Then the object "IfcWall/Wall.001" has no data
|
Then the object "IfcWall/Wall.001" has no data
|
||||||
|
|||||||
Reference in New Issue
Block a user