From b5133c6874d2259925c62d4f90b8204026f6e3d6 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 27 Feb 2022 12:56:16 +0100 Subject: [PATCH] Add caching option in iterate() helper --- src/ifcopenshell-python/ifcopenshell/geom/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index 5fd344e571..8cde9af253 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -222,8 +222,11 @@ def consume_iterator(it, with_progress=False): break -def iterate(settings, file_or_filename, num_threads=1, include=None, exclude=None, with_progress=False): +def iterate(settings, file_or_filename, num_threads=1, include=None, exclude=None, with_progress=False, cache=None): it = iterator(settings, file_or_filename, num_threads, include, exclude) + if cache: + hdf5_cache = serializers.hdf5(cache, settings) + it.set_cache(hdf5_cache) yield from consume_iterator(it, with_progress=with_progress)