From fd48196bcbd6a87c4399414fd284b67c657b0587 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 29 Jan 2024 16:46:20 +0500 Subject: [PATCH] test for removing representation items --- src/blenderbim/test/tool/test_geometry.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/blenderbim/test/tool/test_geometry.py b/src/blenderbim/test/tool/test_geometry.py index bb6ae9f2d2..48f443ad19 100644 --- a/src/blenderbim/test/tool/test_geometry.py +++ b/src/blenderbim/test/tool/test_geometry.py @@ -577,6 +577,27 @@ class TestGetIfcRepresentationClass(NewFile): assert subject.get_ifc_representation_class(ifc.createIfcColumn(), ifc.createIfcShapeRepresentation()) is None +class TestRemoveRepresentationItem(NewFile): + def test_run(self): + ifc = ifcopenshell.file() + tool.Ifc.set(ifc) + + context = ifc.createIfcGeometricRepresentationContext() + element = ifc.createIfcWall() + + items = [ifc.createIfcExtrudedAreaSolid(), ifc.createIfcExtrudedAreaSolid()] + representation = ifc.createIfcShapeRepresentation(Items=items, ContextOfItems=context) + tool.Ifc.run("geometry.assign_representation", product=element, representation=representation) + + product_shape = element.Representation + shape_aspect = subject.create_shape_aspect(product_shape, representation, items[:1], None) + shape_aspect_id = shape_aspect.id() + + subject.remove_representation_item(items[0]) + assert tool.Ifc.get_entity_by_id(shape_aspect_id) is None + assert set(representation.Items) == {items[1]} + + class TestCreateShapeAspect(NewFile): def test_run(self): self.create_shape_aspect(use_element_type=False)