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);
+ }
}
}
}