]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Stabilize the fix for the issue #19039 Can't select solids to create a compound
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 7 May 2020 07:22:27 +0000 (10:22 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 7 May 2020 07:22:27 +0000 (10:22 +0300)
and the issue #19019 Python dump not loadable

src/Model/Model_AttributeSelection.cpp

index e5a333e35a8e015a29dd69d727e3acefd2dbff83..f3b094d6c3c01aa89990ea0eb203af0d1e278ed4 100644 (file)
@@ -2032,6 +2032,7 @@ ResultPtr Model_AttributeSelection::newestContext(
     if (allRes.empty())
       allRes.push_back(aResult);
 
+    bool aFoundReferernce = false;
     for (std::list<ResultPtr>::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) {
       ResultPtr aResCont = *aSub;
       ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont);
@@ -2065,6 +2066,7 @@ ResultPtr Model_AttributeSelection::newestContext(
         for (; aResIter != aResults.end(); aResIter++) {
           if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
             continue;
+          aFoundReferernce = true;
           GeomShapePtr aShape = (*aResIter)->shape();
           if (aShape.get() && aShape->isSubShape(aSelectedShape, false)) {
             aResult = *aResIter; // found new context (produced from this) with same subshape
@@ -2072,12 +2074,13 @@ ResultPtr Model_AttributeSelection::newestContext(
             break;
           }
         }
-        if (!aFindNewContext && !aResults.empty()) {
-          // #19019 : result is concealed by object that contains no such sub-shape
-          return theCurrent;
-        }
       }
     }
+    if (aFoundReferernce && !aFindNewContext &&
+        aResult->groupName() != ModelAPI_ResultConstruction::group()) {
+      // #19019 : result is concealed by object that contains no such sub-shape
+      return theCurrent;
+    }
   }
   // if compsolid is context, try to take sub-solid as context: like in GUI and scripts
   ResultBodyPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);