Deleting an element now also auto deletes its associated distribution ports

This commit is contained in:
Dion Moult
2022-05-06 10:38:38 +10:00
parent 92432f453d
commit 42edcda8bd
3 changed files with 22 additions and 0 deletions
@@ -57,4 +57,11 @@ class Usecase:
self.file.remove(inverse)
elif inverse.is_a("IfcRelVoidsElement"):
self.file.remove(inverse)
elif inverse.is_a("IfcRelNests"):
if inverse.RelatingObject == self.settings["product"]:
for subelement in inverse.RelatedObjects:
if subelement.is_a("IfcDistributionPort"):
ifcopenshell.api.run("root.remove_product", self.file, product=subelement)
if not inverse.RelatedObjects:
self.file.remove(inverse)
self.file.remove(self.settings["product"])