{
theMess = "";
- //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
- //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-
QStringList aList;
myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
if ( aList.isEmpty() )
}
return true;
}
+ QString namePrefix;
+ if ( aList.count() > 1 )
+ {
+ namePrefix = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
+ int i = namePrefix.length() - 1;
+ while ( i > 0 && namePrefix[i].isDigit() )
+ --i;
+ if ( i < namePrefix.length() - 1 )
+ namePrefix.chop( namePrefix.length() - 1 - i );
+ else
+ namePrefix += "_";
+ }
QStringList::Iterator it = aList.begin();
- for ( ; it!=aList.end(); it++)
+ for ( int i = 0; it!=aList.end(); it++, ++i )
{
QString aGeomEntry = *it;
_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
return false;
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() );
if ( aMeshSO ) {
- SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
theEntryList.append( aMeshSO->GetID().c_str() );
+ if ( i > 0 ) setDefaultName( namePrefix );
+ SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
}
for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) {
* Generates and sets default mesh/submesh name(Mesh_1, Mesh_2, etc.)
*/
//================================================================================
-void SMESHGUI_MeshOp::setDefaultName() const
+void SMESHGUI_MeshOp::setDefaultName( const QString& thePrefix ) const
{
QString aResName;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
int i = 1;
- QString aPrefix = tr( myIsMesh ? "SMESH_OBJECT_MESH" : "SMESH_SUBMESH" ) + "_";
+
+ QString aPrefix = thePrefix;
+ if ( aPrefix.isEmpty() )
+ aPrefix = tr( myIsMesh ? "SMESH_OBJECT_MESH" : "SMESH_SUBMESH" ) + "_";
+
_PTR(SObject) anObj;
do
{
int currentHyp( const int, const int ) const;
bool isAccessibleDim( const int ) const;
void setCurrentHyp( const int, const int, const int );
- void setDefaultName() const;
+ void setDefaultName( const QString& prefix="" ) const;
SMESH::SMESH_Hypothesis_var getAlgo( const int );
void readMesh();
QString name( _PTR(SObject) ) const;