Fix bug where when deleting representations it could sometimes overreach and delete geometric, style, or layer data of other elements. See #1812.

This commit is contained in:
Dion Moult
2021-10-20 14:11:49 +11:00
parent 52062bc7e8
commit 58859ef8c3
3 changed files with 99 additions and 29 deletions
@@ -136,11 +136,12 @@ def remove_deep(ifc_file, element):
ifc_file.unbatch()
def remove_deep2(ifc_file, element):
def remove_deep2(ifc_file, element, extra_subgraph_elements=[]):
# Experimental remove deep proposal. No batch for now until this is more certain. See #1812.
# ifc_file.batch()
to_delete = set()
subgraph = list(ifc_file.traverse(element, breadth_first=True))
subgraph.extend(extra_subgraph_elements)
subgraph_set = set(subgraph)
subelement_queue = ifc_file.traverse(element, max_levels=1)
while subelement_queue: