mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-02 21:00:34 +05:00
PAL16617 (Modification/Transformation operations with copy don't create a new mesh)
+ QString UniqueMeshName(const char* theBaseName, const char* thePostfix);
This commit is contained in:
parent
0ebaadef38
commit
92c5811d43
@ -20,6 +20,7 @@
|
||||
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
@ -44,4 +45,27 @@ namespace SMESH
|
||||
return SMESH_Mesh::_nil();
|
||||
}
|
||||
|
||||
QString UniqueMeshName(const char* theBaseName, const char* thePostfix)
|
||||
{
|
||||
QString baseName = theBaseName;
|
||||
if ( thePostfix/* && !name.contains( postfix )*/) { // add postfix
|
||||
baseName += "_";
|
||||
baseName += thePostfix;
|
||||
}
|
||||
if(_PTR(Study) aStudy = GetActiveStudyDocument()) {
|
||||
QString name = baseName;
|
||||
while ( !aStudy->FindObjectByName( name.latin1(), "SMESH" ).empty() ) {
|
||||
int nb = 0;
|
||||
if ( name[ name.length()-1 ].isNumber() ) {
|
||||
int nbBeg = name.findRev("_");
|
||||
nb = name.right( name.length() - nbBeg - 1 ).toInt();
|
||||
name = name.left( nbBeg );
|
||||
}
|
||||
name += QString("_%1").arg( nb+1 );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,12 +27,15 @@
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
|
||||
namespace SMESH{
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
SMESH_Mesh_var GetMeshByIO(const Handle(SALOME_InteractiveObject)& theIO);
|
||||
|
||||
QString UniqueMeshName(const char* theBaseName, const char* thePostfix);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user