From 1e299a0dddb0aa4e322cfb3d1868a06419935109 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 18 Apr 2021 19:02:39 +1000 Subject: [PATCH] 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! --- src/ifcopenshell-python/ifcopenshell/util/element.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/element.py b/src/ifcopenshell-python/ifcopenshell/util/element.py index 788acf7f34..1c90f3d391 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/element.py +++ b/src/ifcopenshell-python/ifcopenshell/util/element.py @@ -119,17 +119,13 @@ def is_representation_of_context(representation, context, subcontext=None, targe def remove_deep(ifc_file, element): + # @todo maybe some sort of try-finally mechanism. + ifc_file.batch() subgraph = list(ifc_file.traverse(element)) subgraph_set = set(subgraph) for ref in subgraph[::-1]: if ref.id() and len(set(ifc_file.get_inverse(ref)) - subgraph_set) == 0: 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()