From bab70288491449c7a97ae1b5548fb05c9b232267 Mon Sep 17 00:00:00 2001 From: szy Date: Thu, 29 Jan 2015 18:34:54 +0300 Subject: [PATCH] Additional fix for the issue #383. --- src/Model/Model_AttributeSelection.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 -- 2.39.2