mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 10:57:26 +05:00
Make meshes with different names if several GEOM objects selected
This commit is contained in:
parent
a30b3a5fbf
commit
004510cb7d
@ -1637,9 +1637,6 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
|
|||||||
{
|
{
|
||||||
theMess = "";
|
theMess = "";
|
||||||
|
|
||||||
//QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
|
|
||||||
//QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
|
|
||||||
|
|
||||||
QStringList aList;
|
QStringList aList;
|
||||||
myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
|
myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
|
||||||
if ( aList.isEmpty() )
|
if ( aList.isEmpty() )
|
||||||
@ -1659,8 +1656,20 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
|
|||||||
}
|
}
|
||||||
return true;
|
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();
|
QStringList::Iterator it = aList.begin();
|
||||||
for ( ; it!=aList.end(); it++)
|
for ( int i = 0; it!=aList.end(); it++, ++i )
|
||||||
{
|
{
|
||||||
QString aGeomEntry = *it;
|
QString aGeomEntry = *it;
|
||||||
_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
|
_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
|
||||||
@ -1679,8 +1688,9 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
|
|||||||
return false;
|
return false;
|
||||||
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() );
|
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() );
|
||||||
if ( aMeshSO ) {
|
if ( aMeshSO ) {
|
||||||
SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
|
|
||||||
theEntryList.append( aMeshSO->GetID().c_str() );
|
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++ ) {
|
for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) {
|
||||||
@ -1896,13 +1906,17 @@ void SMESHGUI_MeshOp::setCurrentHyp( const int theDim,
|
|||||||
* Generates and sets default mesh/submesh name(Mesh_1, Mesh_2, etc.)
|
* 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;
|
QString aResName;
|
||||||
|
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
int i = 1;
|
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;
|
_PTR(SObject) anObj;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ private:
|
|||||||
int currentHyp( const int, const int ) const;
|
int currentHyp( const int, const int ) const;
|
||||||
bool isAccessibleDim( const int ) const;
|
bool isAccessibleDim( const int ) const;
|
||||||
void setCurrentHyp( const int, const int, const int );
|
void setCurrentHyp( const int, const int, const int );
|
||||||
void setDefaultName() const;
|
void setDefaultName( const QString& prefix="" ) const;
|
||||||
SMESH::SMESH_Hypothesis_var getAlgo( const int );
|
SMESH::SMESH_Hypothesis_var getAlgo( const int );
|
||||||
void readMesh();
|
void readMesh();
|
||||||
QString name( _PTR(SObject) ) const;
|
QString name( _PTR(SObject) ) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user