]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#20517 : change type of group for compound or compsolid
authorcg246364 <clarisse.genrault@cea.fr>
Fri, 18 Dec 2020 15:24:35 +0000 (16:24 +0100)
committercg246364 <clarisse.genrault@cea.fr>
Wed, 20 Jan 2021 14:22:42 +0000 (15:22 +0100)
src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp

index 24c821f1c35398964afeb3bc70baaa958fb4eb87..c5d5953faa0986b6a369095e2ab2b26028bcad37 100644 (file)
@@ -34,6 +34,7 @@
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <Locale_Convert.h>
 
@@ -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;
         }
       }