From 6b33b23a297d332b04c1af7eb4244679747fb225 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 30 Aug 2021 18:59:50 +1000 Subject: [PATCH] Fix bug when copying objects, don't copy their decomposition to prevent invalid IFCs. --- src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py b/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py index 74a7084168..11aa9e161d 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py +++ b/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py @@ -24,6 +24,8 @@ class Usecase: inverse.RelatedObjects = [to_element] pset = ifcopenshell.util.element.copy_deep(self.file, inverse.RelatingPropertyDefinition) inverse.RelatingPropertyDefinition = pset + if inverse.is_a("IfcRelAggregates") and inverse.RelatingObject == from_element: + continue else: # TODO: Consider whether this general approach is good or not. Maybe it isn't. for i, value in enumerate(inverse):