]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
only apply color to 3d shapes (solid/shell/face)
authormbs <martin.bernhard@opencascade.com>
Wed, 17 May 2023 13:45:16 +0000 (14:45 +0100)
committermbs <martin.bernhard@opencascade.com>
Wed, 17 May 2023 13:45:16 +0000 (14:45 +0100)
src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp

index e73ccfbe3070d78754b669ca7b8234a6e55029ab..1b7a8f62b0a848f528f04f49184f7aef7a941771 100644 (file)
@@ -243,15 +243,18 @@ void ExchangePlugin_ImportFeature::setColorGroups(
   std::list<ResultPtr> allRes;
   ModelAPI_Tools::allSubs(theResultBody, allRes);
   for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); ++aRes) {
-    ModelAPI_Tools::getColor(*aRes, aColor);
-    if (!aColor.empty() ){
-      auto it = std::find(aColorsRead.begin(), aColorsRead.end(), aColor);
-      if ( it == aColorsRead.end() ){
-        std::wstringstream aColorName;
-        aColorName<<L"Color_"<< anIndice;
-        setColorGroup(theResultBody, aColor, aColorName.str());
-        anIndice++;
-        aColorsRead.push_back(aColor);
+    if ((*aRes)->shape()->isSolid() || (*aRes)->shape()->isShell() || (*aRes)->shape()->isFace()) {
+      // only apply color to 3d objects (no wires, edges, or vertices)
+      ModelAPI_Tools::getColor(*aRes, aColor);
+      if (!aColor.empty() ){
+        auto it = std::find(aColorsRead.begin(), aColorsRead.end(), aColor);
+        if ( it == aColorsRead.end() ){
+          std::wstringstream aColorName;
+          aColorName<<L"Color_"<< anIndice;
+          setColorGroup(theResultBody, aColor, aColorName.str());
+          anIndice++;
+          aColorsRead.push_back(aColor);
+        }
       }
     }
   }