mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Make remove_deep_batched the default since I'm the only guy using it so far and I'm feeling lucky! Let's battle test it!
This commit is contained in:
@@ -119,17 +119,13 @@ def is_representation_of_context(representation, context, subcontext=None, targe
|
|||||||
|
|
||||||
|
|
||||||
def remove_deep(ifc_file, element):
|
def remove_deep(ifc_file, element):
|
||||||
|
# @todo maybe some sort of try-finally mechanism.
|
||||||
|
ifc_file.batch()
|
||||||
subgraph = list(ifc_file.traverse(element))
|
subgraph = list(ifc_file.traverse(element))
|
||||||
subgraph_set = set(subgraph)
|
subgraph_set = set(subgraph)
|
||||||
for ref in subgraph[::-1]:
|
for ref in subgraph[::-1]:
|
||||||
if ref.id() and len(set(ifc_file.get_inverse(ref)) - subgraph_set) == 0:
|
if ref.id() and len(set(ifc_file.get_inverse(ref)) - subgraph_set) == 0:
|
||||||
ifc_file.remove(ref)
|
ifc_file.remove(ref)
|
||||||
|
|
||||||
|
|
||||||
def remove_deep_batched(ifc_file, element):
|
|
||||||
# @todo maybe some sort of try-finally mechanism.
|
|
||||||
ifc_file.batch()
|
|
||||||
remove_deep(ifc_file, element)
|
|
||||||
ifc_file.unbatch()
|
ifc_file.unbatch()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user