From: mpv Date: Fri, 15 Dec 2017 10:35:43 +0000 (+0300) Subject: Fix the naming problems for the sub-solids sub elements selection X-Git-Tag: V_2.10.0RC~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b06e6d2c58e13330fcfc3363bc4c4c957ec0a663;p=modules%2Fshaper.git Fix the naming problems for the sub-solids sub elements selection --- diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 3f4ee57be..64516d223 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -869,7 +869,7 @@ void Model_AttributeSelection::selectSubShape( if (aCont.get() && aShapeToBeSelected.get()) { ResultCompSolidPtr aComp = std::dynamic_pointer_cast(aCont); if (aComp && aComp->numberOfSubs()) { - for(int aSubNum = aComp->numberOfSubs() - 1; aSubNum >= 0; aSubNum--) { + for(int aSubNum = 0; aSubNum < aComp->numberOfSubs(); aSubNum++) { ResultPtr aSub = aComp->subResult(aSubNum); if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aShapeToBeSelected)) { aCont = aSub; @@ -895,10 +895,24 @@ void Model_AttributeSelection::selectSubShape( continue; // search the feature result that contains sub-shape selected std::list > aResults; - ModelAPI_Tools::allResults(aRefFeat, aResults); - std::list >::reverse_iterator aResIter = - aResults.rbegin(); // iterate from the end to find the sub-solid first than compsolid - for(; aResIter != aResults.rend(); aResIter++) { + + // take all sub-results or one result + const std::list >& aFResults = aRefFeat->results(); + std::list >::const_iterator aRIter = aFResults.begin(); + for (; aRIter != aFResults.cend(); aRIter++) { + // iterate sub-bodies of compsolid + ResultCompSolidPtr aComp = std::dynamic_pointer_cast(*aRIter); + if (aComp.get() && aComp->numberOfSubs() > 0) { + int aNumSub = aComp->numberOfSubs(); + for(int a = 0; a < aNumSub; a++) { + aResults.push_back(aComp->subResult(a)); + } + } else { + aResults.push_back(*aRIter); + } + } + std::list >::iterator aResIter = aResults.begin(); + for(; aResIter != aResults.end(); aResIter++) { if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled()) continue; GeomShapePtr aShape = (*aResIter)->shape();