From: Jérôme Date: Wed, 16 Dec 2020 10:00:42 +0000 (+0100) Subject: #20517 : Change type of group for compound or compsolid X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a524620a331c6bc1ffbf71c55ba1bf720f7689a2;p=modules%2Fshaper.git #20517 : Change type of group for compound or compsolid --- diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index d4bb5d218..cf0226329 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -282,8 +283,16 @@ void ExchangePlugin_ImportFeature::setColorGroup( if (!aColor.empty() ){ if (aRes->get() && aColor == theColor ) { - aSelectionList->setSelectionType(aShape->shapeTypeStr()); - aSelectionList->append(theResultBody,aShape); + if (aShape->isCompound() || aShape->isCompSolid()) { + GeomAPI_ShapeIterator anIt(aShape); + for (; anIt.more(); anIt.next()) { + aSelectionList->setSelectionType(anIt.current()->shapeTypeStr()); + aSelectionList->append(theResultBody,anIt.current()); + } + } else { + aSelectionList->setSelectionType(aShape->shapeTypeStr()); + aSelectionList->append(theResultBody,aShape); + } } } } @@ -322,8 +331,16 @@ void ExchangePlugin_ImportFeature::setMaterielGroup( aResMat != anIt->second.end(); ++aResMat) { if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) { - aSelectionList->append(theResultBody,aShape); - aSelectionList->setSelectionType(aShape->shapeTypeStr()); + if (aShape->isCompound() || aShape->isCompSolid()) { + GeomAPI_ShapeIterator anIt(aShape); + for (; anIt.more(); anIt.next()) { + aSelectionList->setSelectionType(anIt.current()->shapeTypeStr()); + aSelectionList->append(theResultBody,anIt.current()); + } + } else { + aSelectionList->setSelectionType(aShape->shapeTypeStr()); + aSelectionList->append(theResultBody,aShape); + } break; } }