diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index f0855cffdf..cd25bef0f0 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -210,8 +210,7 @@ def create_shape(settings, inst, repr=None): ) -def iterate(settings, file_or_filename, num_threads=1, include=None, exclude=None): - it = iterator(settings, file_or_filename, num_threads, include, exclude) +def consume_iterator(it): if it.initialize(): while True: yield it.get() @@ -219,6 +218,11 @@ def iterate(settings, file_or_filename, num_threads=1, include=None, exclude=Non break +def iterate(settings, file_or_filename, num_threads=1, include=None, exclude=None): + it = iterator(settings, file_or_filename, num_threads, include, exclude) + yield from consume_iterator(it) + + def make_shape_function(fn): def entity_instance_or_none(e): return None if e is None else entity_instance(e)