root.remove_product fix

This commit is contained in:
Andrej730
2023-07-14 18:19:14 +05:00
parent a5dedbedbb
commit d42aa7d8cb
2 changed files with 49 additions and 12 deletions
@@ -125,10 +125,11 @@ class Usecase:
elif inverse.is_a("IfcRelContainedInSpatialStructure"):
if inverse.RelatingStructure == self.settings["product"] or len(inverse.RelatedElements) == 1:
self.file.remove(inverse)
elif inverse.is_a() in ("IfcRelConnectsElements", "IfcRelConnectsPathElements"):
elif inverse.is_a("IfcRelConnectsElements"):
if inverse.is_a("IfcRelConnectsWithRealizingElements"):
connected_elements = (inverse.RelatingElement, inverse.RelatedElement)
if any(el not in connected_elements for el in inverse.RealizingElements):
if self.settings["product"] not in (inverse.RelatingElement, inverse.RelatedElement) and any(
el for el in inverse.RealizingElements if el != self.settings["product"]
):
continue
self.file.remove(inverse)
elif inverse.is_a("IfcRelAssignsToGroup"):