From d72659ced7d4046a5142b897f8f5c3652d61dbb9 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 14 Sep 2023 13:34:12 +0100 Subject: [PATCH] Fix incorrect shape dump. Shape explorer returns the main shape in case if there are no more sub-shapes. --- src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index 97523e429..3804f7087 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -411,9 +411,12 @@ std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr& GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::COMPOUND; for (; aType <= GeomAPI_Shape::VERTEX; aType = GeomAPI_Shape::ShapeType((int)aType + 1)) { GeomAPI_ShapeExplorer anExp(theShape, aType); - int aCount = 0; - for (; anExp.more(); anExp.next()) aCount++; - aResult << anExp.current()->shapeTypeStr().c_str() << ": " << aCount << std::endl; + if (anExp.more()) { + std::string aTypeStr = anExp.current()->shapeTypeStr(); + int aCount = 0; + for (; anExp.more(); anExp.next()) aCount++; + aResult << aTypeStr.c_str() << ": " << aCount << std::endl; + } } // output the main characteristics double aVolume = GeomAlgoAPI_ShapeTools::volume(theShape); -- 2.39.2