From: mpv Date: Thu, 1 Sep 2016 14:00:21 +0000 (+0300) Subject: Fix for the dump/restore of DOME scenario. Naming selection context must be the final... X-Git-Tag: V_2.5.0~84 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=137e02c0e52c1439c2aa91c1d8485ca567856f7f;p=modules%2Fshaper.git Fix for the dump/restore of DOME scenario. Naming selection context must be the final shape, not the shape that originally had the selected face. --- diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 2e2de8e87..7f8710c9e 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -10,6 +10,7 @@ #include "Model_Data.h" #include "Model_Document.h" #include "Model_SelectionNaming.h" +#include #include #include #include @@ -911,6 +912,28 @@ void Model_AttributeSelection::selectSubShape( std::shared_ptr aShapeToBeSelected; ResultPtr aCont; if (aSelNaming.selectSubShape(theType, theSubShapeName, aDoc, aShapeToBeSelected, aCont)) { + // try to find the last context to find the up to dat shape + if (aCont->shape().get() && !aCont->shape()->isNull() && + aCont->groupName() == ModelAPI_ResultBody::group() && aDoc == owner()->document()) { + const TopoDS_Shape aConShape = aCont->shape()->impl(); + if (!aConShape.IsNull()) { + Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel()); + if (!aNS.IsNull()) { + aNS = TNaming_Tool::CurrentNamedShape(aNS); + if (!aNS.IsNull()) { + TDF_Label aLab = aNS->Label(); + while(aLab.Depth() != 7 && aLab.Depth() > 5) + aLab = aLab.Father(); + ObjectPtr anObj = aDoc->objects()->object(aLab); + if (anObj.get()) { + ResultPtr aRes = std::dynamic_pointer_cast(anObj); + if (aRes) + aCont = aRes; + } + } + } + } + } setValue(aCont, aShapeToBeSelected); } }