diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index 499f042c48..111f5ae84d 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -416,6 +416,18 @@ namespace IfcGeom { if (!ifcproducts) { ifcproducts = IfcSchema::IfcProduct::list::ptr(new IfcSchema::IfcProduct::list); IfcSchema::IfcProduct::list::ptr unfiltered_products = kernel.products_represented_by(representation); + // Filter the products based on the set of entities and/or names being included or excluded for processing. + for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) { + IfcSchema::IfcProduct* prod = *jt; + if (boost::all(filters_, filter_match(prod))) { + ifcproducts->push(prod); + } + } + + if (ifcproducts->size() == 0) { + _nextShape(); + continue; + } geometry_reuse_ok_for_current_representation_ = reuse_ok_(unfiltered_products); @@ -450,14 +462,6 @@ namespace IfcGeom { continue; } - // Filter the products based on the set of entities and/or names being included or excluded for processing. - for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) { - IfcSchema::IfcProduct* prod = *jt; - if (boost::all(filters_, filter_match(prod))) { - ifcproducts->push(prod); - } - } - ifcproduct_iterator = ifcproducts->begin(); }