root.remove_product to remove IfcRelConnectsPorts too

previously if you deleted some flow segment that was connected to another the connection would stay resulting in invalid ifc and other bugs
This commit is contained in:
Andrej730
2023-08-01 17:14:53 +05:00
parent 72c2ef1dd1
commit 25ec0ee36c
2 changed files with 29 additions and 0 deletions
@@ -132,6 +132,12 @@ class Usecase:
):
continue
self.file.remove(inverse)
elif inverse.is_a("IfcRelConnectsPorts"):
if self.settings["product"] not in (inverse.RelatingPort, inverse.RelatedPort):
# if it's not RelatingPort/RelatedPort then it's optional RealizingElement
# so we keep the relationship
continue
self.file.remove(inverse)
elif inverse.is_a("IfcRelAssignsToGroup"):
if len(inverse.RelatedObjects) == 1:
self.file.remove(inverse)