From 55e4cb688a3421cd7474cec2ed0da69a2e782e1e Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 7 May 2020 10:22:27 +0300 Subject: [PATCH] Stabilize the fix for the issue #19039 Can't select solids to create a compound and the issue #19019 Python dump not loadable --- src/Model/Model_AttributeSelection.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index e5a333e35..f3b094d6c 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -2032,6 +2032,7 @@ ResultPtr Model_AttributeSelection::newestContext( if (allRes.empty()) allRes.push_back(aResult); + bool aFoundReferernce = false; for (std::list::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) { ResultPtr aResCont = *aSub; ResultBodyPtr aResBody = std::dynamic_pointer_cast(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(aResult); -- 2.39.2