Skip to content

Commit

Permalink
root.remove_product to consider IfcRelConnectsPortToElement
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej730 committed May 10, 2024
1 parent d2a708f commit 371e11d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ def element_exists(element_id):
file.remove(inverse)
if history:
ifcopenshell.util.element.remove_deep2(file, history)
elif inverse.is_a("IfcRelConnectsPortToElement"):
if inverse.RelatedElement == settings["product"]:
ifcopenshell.api.run("root.remove_product", file, product=inverse.RelatingPort)
elif inverse.RelatingPort == settings["product"]:
history = inverse.OwnerHistory
file.remove(inverse)
if history:
ifcopenshell.util.element.remove_deep2(file, history)
elif inverse.is_a("IfcRelConnectsPorts"):
if settings["product"] not in (inverse.RelatingPort, inverse.RelatedPort):
# if it's not RelatingPort/RelatedPort then it's optional RealizingElement
Expand Down

0 comments on commit 371e11d

Please sign in to comment.