+ if(myMesh->_is_nil()) return 1;
+ if(!myActor){
+ myActor = SMESH::FindActorByObject(myMesh);
+ if(!myActor)
+ return 1;
+ }
+
+ aMesh = myActor->GetObject()->GetMesh();
+
+ // checking for nodes
+ if (checkLast && myEditCurrentArgument->text().right(1) != QString(" ") ) return 1;
+ QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text() );
+ for ( int i = 0; i < aListId.count(); i++ ){
+ switch (GetConstructorId()){
+ case 0:{ // nodes
+ const SMDS_MeshNode * aNode = aMesh->FindNode( aListId[ i ].toInt() );
+ if( !aNode ){
+ std::string aWarning;
+ aWarning = "The incorrect indices of nodes!";
+ SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+ QObject::tr("SMESH_POLYEDRE_CREATE_ERROR"),
+ QObject::tr(aWarning.c_str()),
+ QObject::tr("SMESH_BUT_OK"));
+
+ myEditCurrentArgument->clear();
+ myEditCurrentArgument->setText( aString );
+ return -1;
+ }
+
+ break;
+ }
+ case 1:{ // faces
+ bool aElemIsOK = true;
+ const SMDS_MeshElement * aElem = aMesh->FindElement( aListId[ i ].toInt() );
+ if (!aElem)
+ {
+ aElemIsOK = false;
+ }
+ else
+ {
+ SMDSAbs_ElementType aType = aMesh->GetElementType( aElem->GetID(),true );
+ if (aType != SMDSAbs_Face){
+ aElemIsOK = false;
+ }
+ }
+ if (!aElemIsOK){
+ std::string aWarning;
+ aWarning = "The incorrect indices of faces!";
+ SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+ QObject::tr("SMESH_POLYEDRE_CREATE_ERROR"),
+ QObject::tr(aWarning.c_str()),
+ QObject::tr("SMESH_BUT_OK"));
+
+ myEditCurrentArgument->clear();
+ myEditCurrentArgument->setText( aString );
+ return -1;
+ }
+ break;
+ }
+ }
+ aString += aListId[ i ] + " ";
+ }
+
+ return 1;