From 28043a8e5d28e7ffe2f423bd12cc28796d0efed9 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 3 Jul 2025 18:10:43 +0500 Subject: [PATCH] ifc2sql - skip creating geometry if iterator failed to initialize --- src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py index ba949ff686..4d71dbd96d 100644 --- a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py +++ b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py @@ -274,6 +274,11 @@ class Patcher(ifcpatch.BasePatcher): products = self.elements iterator = ifcopenshell.geom.iterator(self.settings, self.file, multiprocessing.cpu_count(), include=products) valid_file = iterator.initialize() + if not valid_file: + # If there were no elements, iterator will also fail and it's okay not to report it. + if products: + print("WARNING. Geometry iterator failed to initialize.") + return checkpoint = time.time() progress = 0 total = len(products)