From: dbv Date: Mon, 5 Sep 2016 10:09:39 +0000 (+0300) Subject: Fix for selection by name with suffix X-Git-Tag: V_2.5.0~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd8f50ce5c9cf41e43a1f9b7155d12aad1c37494;p=modules%2Fshaper.git Fix for selection by name with suffix --- diff --git a/src/Model/Model_SelectionNaming.cpp b/src/Model/Model_SelectionNaming.cpp index f85886a01..ecf334303 100644 --- a/src/Model/Model_SelectionNaming.cpp +++ b/src/Model/Model_SelectionNaming.cpp @@ -335,15 +335,18 @@ const TopoDS_Shape getShapeFromNS( { TopoDS_Shape aSelection; std::string::size_type n = theSubShapeName.rfind('/'); - if (n == std::string::npos) n = 0; + if (n == std::string::npos) n = -1; std::string aSubString = theSubShapeName.substr(n + 1); n = aSubString.rfind('_'); - int indx; - if (n == std::string::npos) {// for primitives this is a first - indx = 1; - } else { - aSubString = aSubString.substr(n+1); - indx = atoi(aSubString.c_str()); + int indx = 1; + if (n != std::string::npos) {// for primitives this is a first + // if we have here the same name as theSubShapeName, there is no index in compound, it is whole + Handle(TDataStd_Name) aName; + if (!theNS->Label().FindAttribute(TDataStd_Name::GetID(), aName) || + aName->Get() != theSubShapeName.c_str()) { + aSubString = aSubString.substr(n+1); + indx = atoi(aSubString.c_str()); + } } TNaming_Iterator anItL(theNS);