From: szy Date: Thu, 29 Jan 2015 15:34:54 +0000 (+0300) Subject: Additional fix for the issue #383. X-Git-Tag: V_1.0.0~11^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bab70288491449c7a97ae1b5548fb05c9b232267;p=modules%2Fshaper.git Additional fix for the issue #383. --- diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 324b8bc7d..b6bbd8e15 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -52,7 +52,7 @@ #include #include using namespace std; -#define DEB_NAMING 1 +//#define DEB_NAMING 1 #ifdef DEB_NAMING #include #endif @@ -599,9 +599,17 @@ bool isTrivial (const TopTools_ListOfShape& theAncestors, TopTools_IndexedMapOfS } std::string Model_AttributeSelection::namingName() { + std::string aName(""); + if(!this->isInitialized()) return aName; + Handle(TDataStd_Name) anAtt; + if(selectionLabel().FindAttribute(TDataStd_Name::GetID(), anAtt)) { + aName = TCollection_AsciiString(anAtt->Get()).ToCString(); + return aName; + } + std::shared_ptr aSubSh = value(); ResultPtr aCont = context(); - std::string aName("Undefined name"); + aName = "Undefined name"; if(!aSubSh.get() || aSubSh->isNull() || !aCont.get() || aCont->shape()->isNull()) return aName; TopoDS_Shape aSubShape = aSubSh->impl(); @@ -617,7 +625,6 @@ std::string Model_AttributeSelection::namingName() aName = GetShapeName(aDoc, aSubShape, selectionLabel()); if(aName.empty() ) { // not in the document! TopAbs_ShapeEnum aType = aSubShape.ShapeType(); - aName = "Undefined name"; switch (aType) { case TopAbs_FACE: // the Face should be in DF. If it is not the case, it is an error ==> to be debugged