From 5d0c04a0770be81fc8efe2f39cda440d0550284d Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 21 Feb 2018 14:54:38 +0100 Subject: [PATCH] Fix geometry reuse in case of IfcTypeProducts with maps --- src/ifcgeom/IfcGeomIterator.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index 66c2a43af7..28650cbe12 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -407,12 +407,20 @@ namespace IfcGeom { geometry_reuse_ok_for_current_representation_ = reuse_ok_(unfiltered_products); - if (!geometry_reuse_ok_for_current_representation_ && representation->RepresentationMap()->size() == 1) { + IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap(); + + if (!geometry_reuse_ok_for_current_representation_ && maps->size() == 1) { // unfiltered_products contains products represented by this representation by means of mapped items. // For example because of openings applied to products, reuse might not be acceptable and then the // products will be processed by means of their immediate representation and not the mapped representation. - _nextShape(); - continue; + + // IfcRepresentationMaps are also used for IfcTypeProducts, so an additional check is performed whether the map + // is indeed used by IfcMappedItems. + IfcSchema::IfcRepresentationMap* map = *maps->begin(); + if (map->MapUsage()->size() > 0) { + _nextShape(); + continue; + } } bool representation_processed_as_mapped_item = false;