- else if ( mode == SMESH::BND_1DFROM2D && mySrcMesh->NbFaces() == 0 ) {
- msg = tr( "SMESH_ERR_NO_2D_ELEMENTS" );
- return false;
+ }
+ // check if the selected objects contains elements of required type
+ bool hasFaces = false, hasVolumes = false;
+ SMESH::Bnd_Dimension mode = myDlg->mode();
+ for ( int i = 0; i < entries.count(); ++i )
+ {
+ SMESH::SMESH_IDSource_var idSource;
+ if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
+ idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
+ if ( !idSource->_is_nil() ) {
+ SMESH::array_of_ElementType_var types = idSource->GetTypes();
+ for ( int j = 0; j < types->length(); ++j )
+ if ( types[j] == SMESH::VOLUME )
+ hasVolumes = true;
+ else if ( types[j] == SMESH::FACE )
+ hasFaces = true;