From 137e02c0e52c1439c2aa91c1d8485ca567856f7f Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 1 Sep 2016 17:00:21 +0300 Subject: [PATCH] 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. --- src/Model/Model_AttributeSelection.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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); } } -- 2.39.2