Merge from V6_3_BR branch (Windows porting) 27/10/2011

This commit is contained in:
vsr 2011-10-27 15:33:35 +00:00
parent 1d2d4e6bdc
commit b6174726d9
12 changed files with 228 additions and 27 deletions

View File

@ -215,6 +215,13 @@ module SMESH
out SMESH::DriverMED_ReadStatus theStatus ) out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*!
* Create Mesh object(s) importing data from given MED file
*/
mesh_array CreateMeshesFromSAUV( in string theFileName,
out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception );
/*! /*!
* Create Mesh object importing data from given STL file * Create Mesh object importing data from given STL file
*/ */

View File

@ -610,6 +610,13 @@ module SMESH
void ExportMED( in string file, in boolean auto_groups ) void ExportMED( in string file, in boolean auto_groups )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Export Mesh to SAUV formatted file
* Write a temporary med file and use med2sauv
*/
void ExportSAUV( in string file, in boolean auto_groups )
raises (SALOME::SALOME_Exception);
/*! /*!
* Return string representation of a MED file version comprising nbDigits * Return string representation of a MED file version comprising nbDigits
*/ */

View File

@ -1186,6 +1186,44 @@ void SMESH_Mesh::ExportMED(const char * file,
myWriter.Perform(); myWriter.Perform();
} }
void SMESH_Mesh::ExportSAUV(const char *file,
const char* theMeshName,
bool theAutoGroups)
throw(SALOME_Exception)
{
std::string medfilename(file);
medfilename += ".med";
std::string cmd;
#ifdef WNT
cmd = "%PYTHONBIN% ";
#else
cmd = "python ";
#endif
cmd += "-c \"";
cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
cmd += "\"";
system(cmd.c_str());
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, 1);
#ifdef WNT
cmd = "%PYTHONBIN% ";
#else
cmd = "python ";
#endif
cmd += "-c \"";
cmd += "from medutilities import convert ; convert(r'" + medfilename + "', 'MED', 'GIBI', 1, r'" + file + "')";
cmd += "\"";
system(cmd.c_str());
#ifdef WNT
cmd = "%PYTHONBIN% ";
#else
cmd = "python ";
#endif
cmd += "-c \"";
cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
cmd += "\"";
system(cmd.c_str());
}
//================================================================================ //================================================================================
/*! /*!
* \brief Export the mesh to a DAT file * \brief Export the mesh to a DAT file

View File

@ -236,6 +236,9 @@ public:
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception); const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
void ExportCGNS(const char * file, void ExportCGNS(const char * file,
const SMESHDS_Mesh* mesh); const SMESHDS_Mesh* mesh);
void ExportSAUV(const char *file,
const char* theMeshName = NULL,
bool theAutoGroups = true) throw(SALOME_Exception);
int NbNodes() const throw(SALOME_Exception); int NbNodes() const throw(SALOME_Exception);

View File

@ -205,6 +205,10 @@
else if ( theCommandID == 116 ) { else if ( theCommandID == 116 ) {
filter.append( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" ); filter.append( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" );
} }
else if ( theCommandID == 117 ) {
filter.append( QObject::tr( "SAUV files (*.sauv*)" ) );
filter.append( QObject::tr( "All files (*)" ) );
}
QString anInitialPath = ""; QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
@ -276,6 +280,17 @@
} }
break; break;
} }
case 117:
{
// SAUV format
SMESH::DriverMED_ReadStatus res;
aMeshes = theComponentMesh->CreateMeshesFromSAUV( filename.toLatin1().constData(), res );
if ( res != SMESH::DRS_OK ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
}
break;
}
} }
} }
catch ( const SALOME::SALOME_Exception& S_ex ) { catch ( const SALOME::SALOME_Exception& S_ex ) {
@ -349,6 +364,7 @@
const bool isUNV = ( theCommandID == 123 || theCommandID == 126 ); const bool isUNV = ( theCommandID == 123 || theCommandID == 126 );
const bool isSTL = ( theCommandID == 140 || theCommandID == 141 ); const bool isSTL = ( theCommandID == 140 || theCommandID == 141 );
const bool isCGNS= ( theCommandID == 142 || theCommandID == 143 ); const bool isCGNS= ( theCommandID == 142 || theCommandID == 143 );
const bool isSAUV= ( theCommandID == 144 || theCommandID == 145 );
// actually, the following condition can't be met (added for insurance) // actually, the following condition can't be met (added for insurance)
if( selected.Extent() == 0 || if( selected.Extent() == 0 ||
@ -400,7 +416,7 @@
SMESH::SMESH_Mesh_var aMesh = aMeshOrGroup->GetMesh(); SMESH::SMESH_Mesh_var aMesh = aMeshOrGroup->GetMesh();
QString aMeshName = (*aMeshIter).second; QString aMeshName = (*aMeshIter).second;
if ( isMED || isCGNS ) if ( isMED || isCGNS || isSAUV )
{ {
// check for equal group names within each mesh // check for equal group names within each mesh
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) { for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
@ -506,13 +522,20 @@
} }
delete fd; delete fd;
} }
else if ( isMED ) // Export to MED else if ( isMED || isSAUV ) // Export to MED or SAUV
{ {
QMap<QString, SMESH::MED_VERSION> aFilterMap; QMap<QString, SMESH::MED_VERSION> aFilterMap;
//QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2)); //QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
if ( isMED ) {
QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2)); QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
//aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v21 ) + " (*.med)", SMESH::MED_V2_1 ); //aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v21 ) + " (*.med)", SMESH::MED_V2_1 );
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v22 ) + " (*.med)", SMESH::MED_V2_2 ); aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v22 ) + " (*.med)", SMESH::MED_V2_2 );
}
else { // isSAUV
aFilterMap.insert("All files (*)", SMESH::MED_V2_1 );
aFilterMap.insert("SAUV files (*.sauv)", SMESH::MED_V2_2 );
aFilterMap.insert("SAUV files (*.sauve)", SMESH::MED_V2_1 );
}
QStringList filters; QStringList filters;
QString aDefaultFilter; QString aDefaultFilter;
@ -656,6 +679,15 @@
aFormat, toOverwrite && aMeshIndex == 0 ); aFormat, toOverwrite && aMeshIndex == 0 );
} }
} }
else if ( isSAUV )
{
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ )
{
SMESH::SMESH_Mesh_var aMeshItem = SMESH::SMESH_Mesh::_narrow( (*aMeshIter).first );
if( !aMeshItem->_is_nil() )
aMeshItem->ExportSAUV( aFilename.toLatin1().data(), toCreateGroups );
}
}
else if ( isDAT ) else if ( isDAT )
{ {
if ( aMeshOrGroup->_is_equivalent( aMesh )) if ( aMeshOrGroup->_is_equivalent( aMesh ))
@ -1975,6 +2007,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 116: case 116:
case 115: case 115:
case 117:
case 113: case 113:
case 112: case 112:
case 111: // IMPORT case 111: // IMPORT
@ -2013,6 +2046,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 141: case 141:
case 142: case 142:
case 143: case 143:
case 144:
case 145:
{ {
::ExportMeshToFile(theCommandID); ::ExportMeshToFile(theCommandID);
break; break;
@ -3371,16 +3406,19 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 114, "NUM" ); createSMESHAction( 114, "NUM" );
createSMESHAction( 115, "STL" ); createSMESHAction( 115, "STL" );
createSMESHAction( 116, "CGNS" ); createSMESHAction( 116, "CGNS" );
createSMESHAction( 117, "SAUV" );
createSMESHAction( 121, "DAT" ); createSMESHAction( 121, "DAT" );
createSMESHAction( 122, "MED" ); createSMESHAction( 122, "MED" );
createSMESHAction( 123, "UNV" ); createSMESHAction( 123, "UNV" );
createSMESHAction( 140, "STL" ); createSMESHAction( 140, "STL" );
createSMESHAction( 142, "CGNS" ); createSMESHAction( 142, "CGNS" );
createSMESHAction( 144, "SAUV" );
createSMESHAction( 124, "EXPORT_DAT" ); createSMESHAction( 124, "EXPORT_DAT" );
createSMESHAction( 125, "EXPORT_MED" ); createSMESHAction( 125, "EXPORT_MED" );
createSMESHAction( 126, "EXPORT_UNV" ); createSMESHAction( 126, "EXPORT_UNV" );
createSMESHAction( 141, "EXPORT_STL" ); createSMESHAction( 141, "EXPORT_STL" );
createSMESHAction( 143, "EXPORT_CGNS" ); createSMESHAction( 143, "EXPORT_CGNS" );
createSMESHAction( 145, "EXPORT_SAUV" );
createSMESHAction( 150, "FILE_INFO" ); createSMESHAction( 150, "FILE_INFO" );
createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete ); createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete );
createSMESHAction( 5105, "SEL_FILTER_LIB" ); createSMESHAction( 5105, "SEL_FILTER_LIB" );
@ -3547,6 +3585,7 @@ void SMESHGUI::initialize( CAM_Application* app )
#ifdef WITH_CGNS #ifdef WITH_CGNS
createMenu( 116, importId, -1 ); createMenu( 116, importId, -1 );
#endif #endif
createMenu( 117, importId, -1 );
createMenu( 121, exportId, -1 ); createMenu( 121, exportId, -1 );
createMenu( 122, exportId, -1 ); createMenu( 122, exportId, -1 );
createMenu( 123, exportId, -1 ); createMenu( 123, exportId, -1 );
@ -3554,6 +3593,7 @@ void SMESHGUI::initialize( CAM_Application* app )
#ifdef WITH_CGNS #ifdef WITH_CGNS
createMenu( 142, exportId, -1 ); // export to CGNS createMenu( 142, exportId, -1 ); // export to CGNS
#endif #endif
createMenu( 144, exportId, -1 ); // export to SAUV
createMenu( separator(), fileId, 10 ); createMenu( separator(), fileId, 10 );
createMenu( 33, editId, -1 ); createMenu( 33, editId, -1 );
@ -3857,6 +3897,7 @@ void SMESHGUI::initialize( CAM_Application* app )
#ifdef WITH_CGNS #ifdef WITH_CGNS
createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS
#endif #endif
createPopupItem( 145, OB, mesh_group, multiple_non_empty ); // EXPORT_SAUV
createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE
popupMgr()->insert( separator(), -1, 0 ); popupMgr()->insert( separator(), -1, 0 );

View File

@ -373,7 +373,7 @@
</message> </message>
<message> <message>
<source>MEN_EXPORT_SAUV</source> <source>MEN_EXPORT_SAUV</source>
<translation>Export to SAUV (ASCII) file</translation> <translation>Export to SAUV file</translation>
</message> </message>
<message> <message>
<source>MEN_EXPORT_STL</source> <source>MEN_EXPORT_STL</source>
@ -501,7 +501,7 @@
</message> </message>
<message> <message>
<source>MEN_SAUV</source> <source>MEN_SAUV</source>
<translation>SAUV (ASCII) file</translation> <translation>SAUV file</translation>
</message> </message>
<message> <message>
<source>MEN_MERGE</source> <source>MEN_MERGE</source>
@ -2481,7 +2481,7 @@ Please check preferences of Mesh module.
</message> </message>
<message> <message>
<source>STB_EXPORT_SAUV</source> <source>STB_EXPORT_SAUV</source>
<translation>Export to SAUV (ASCII) file</translation> <translation>Export to SAUV file</translation>
</message> </message>
<message> <message>
<source>STB_EXPORT_STL</source> <source>STB_EXPORT_STL</source>
@ -2581,7 +2581,7 @@ Please check preferences of Mesh module.
</message> </message>
<message> <message>
<source>STB_SAUV</source> <source>STB_SAUV</source>
<translation>Import SAUV (ASCII) file</translation> <translation>Import SAUV file</translation>
</message> </message>
<message> <message>
<source>STB_MERGE</source> <source>STB_MERGE</source>
@ -3037,7 +3037,7 @@ Please check preferences of Mesh module.
</message> </message>
<message> <message>
<source>TOP_EXPORT_SAUV</source> <source>TOP_EXPORT_SAUV</source>
<translation>Export to SAUV (ASCII) file</translation> <translation>Export to SAUV file</translation>
</message> </message>
<message> <message>
<source>TOP_EXPORT_STL</source> <source>TOP_EXPORT_STL</source>
@ -3137,7 +3137,7 @@ Please check preferences of Mesh module.
</message> </message>
<message> <message>
<source>TOP_SAUV</source> <source>TOP_SAUV</source>
<translation>Import SAUV (ASCII) file</translation> <translation>Import SAUV file</translation>
</message> </message>
<message> <message>
<source>TOP_MERGE</source> <source>TOP_MERGE</source>

View File

@ -446,7 +446,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
myMeshes.insert( make_pair( mesh->GetID(), mesh )); myMeshes.insert( make_pair( mesh->GetID(), mesh ));
return; return;
} }
if( method == "CreateMeshesFromMED") if( method == "CreateMeshesFromMED" || method == "CreateMeshesFromSAUV")
{ {
for(int ind = 0;ind<theCommand->GetNbResultValues();ind++) for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
{ {
@ -1104,7 +1104,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand )
static TStringSet sameMethods; static TStringSet sameMethods;
if ( sameMethods.empty() ) { if ( sameMethods.empty() ) {
const char * names[] = const char * names[] =
{ "ExportDAT","ExportUNV","ExportSTL", "RemoveGroup","RemoveGroupWithContents", { "ExportDAT","ExportUNV","ExportSTL","ExportSAUV", "RemoveGroup","RemoveGroupWithContents",
"GetGroups","UnionGroups","IntersectGroups","CutGroups","GetLog","GetId","ClearLog", "GetGroups","UnionGroups","IntersectGroups","CutGroups","GetLog","GetId","ClearLog",
"GetStudyId","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements", "GetStudyId","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements",
"NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles", "NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles",

View File

@ -918,13 +918,11 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName
*/ */
//============================================================================= //=============================================================================
SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName, SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus) SMESH::DriverMED_ReadStatus& theStatus,
throw ( SALOME::SALOME_Exception ) const char* theCommandNameForPython,
const char* theFileNameForPython)
{ {
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshFromMED" );
// Retrieve mesh names from the file // Retrieve mesh names from the file
DriverMED_R_SMESHDS_Mesh myReader; DriverMED_R_SMESHDS_Mesh myReader;
myReader.SetFile( theFileName ); myReader.SetFile( theFileName );
@ -981,7 +979,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
} }
// Update Python script // Update Python script
aPythonDump << "], status) = " << this << ".CreateMeshesFromMED(r'" << theFileName << "')"; aPythonDump << "], status) = " << this << "." << theCommandNameForPython << "(r'" << theFileNameForPython << "')";
} }
// Dump creation of groups // Dump creation of groups
for ( int i = 0; i < aResult->length(); ++i ) for ( int i = 0; i < aResult->length(); ++i )
@ -990,6 +988,56 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
return aResult._retn(); return aResult._retn();
} }
SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus)
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshFromMED" );
SMESH::mesh_array* result = CreateMeshesFromMEDorSAUV(theFileName, theStatus, "CreateMeshesFromMED", theFileName);
return result;
}
//=============================================================================
/*!
* SMESH_Gen_i::CreateMeshFromSAUV
*
* Create mesh and import data from SAUV file
*/
//=============================================================================
SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromSAUV( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus)
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshFromSAUV" );
std::string sauvfilename(theFileName);
std::string medfilename(theFileName);
medfilename += ".med";
std::string cmd;
#ifdef WNT
cmd = "%PYTHONBIN% ";
#else
cmd = "python ";
#endif
cmd += "-c \"";
cmd += "from medutilities import convert ; convert(r'" + sauvfilename + "', 'GIBI', 'MED', 1, r'" + medfilename + "')";
cmd += "\"";
system(cmd.c_str());
SMESH::mesh_array* result = CreateMeshesFromMEDorSAUV(medfilename.c_str(), theStatus, "CreateMeshesFromSAUV", sauvfilename.c_str());
#ifdef WNT
cmd = "%PYTHONBIN% ";
#else
cmd = "python ";
#endif
cmd += "-c \"";
cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
cmd += "\"";
system(cmd.c_str());
return result;
}
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::CreateMeshFromSTL * SMESH_Gen_i::CreateMeshFromSTL

View File

@ -230,6 +230,11 @@ public:
SMESH::DriverMED_ReadStatus& theStatus ) SMESH::DriverMED_ReadStatus& theStatus )
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );
// Create mesh(es) and import data from MED file
SMESH::mesh_array* CreateMeshesFromSAUV( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus )
throw ( SALOME::SALOME_Exception );
// Create mesh(es) and import data from STL file // Create mesh(es) and import data from STL file
SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName ) SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );
@ -550,6 +555,11 @@ private:
static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot ); static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus,
const char* theCommandNameForPython,
const char* theFileNameForPython);
private: private:
static GEOM::GEOM_Gen_var myGeomGen; static GEOM::GEOM_Gen_var myGeomGen;
static CORBA::ORB_var myOrb; // ORB reference static CORBA::ORB_var myOrb; // ORB reference

View File

@ -2548,14 +2548,9 @@ void SMESH_Mesh_i::PrepareForWriting (const char* file, bool overwrite)
} }
} }
void SMESH_Mesh_i::ExportToMEDX (const char* file, string SMESH_Mesh_i::PrepareMeshNameAndGroups(const char* file,
CORBA::Boolean auto_groups,
SMESH::MED_VERSION theVersion,
CORBA::Boolean overwrite) CORBA::Boolean overwrite)
throw(SALOME::SALOME_Exception)
{ {
Unexpect aCatch(SALOME_SalomeException);
// Perform Export // Perform Export
PrepareForWriting(file, overwrite); PrepareForWriting(file, overwrite);
string aMeshName = "Mesh"; string aMeshName = "Mesh";
@ -2590,6 +2585,17 @@ void SMESH_Mesh_i::ExportToMEDX (const char* file,
// check names of groups // check names of groups
checkGroupNames(); checkGroupNames();
return aMeshName;
}
void SMESH_Mesh_i::ExportToMEDX (const char* file,
CORBA::Boolean auto_groups,
SMESH::MED_VERSION theVersion,
CORBA::Boolean overwrite)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
string aMeshName = PrepareMeshNameAndGroups(file, true);
TPythonDump() << _this() << ".ExportToMEDX( r'" TPythonDump() << _this() << ".ExportToMEDX( r'"
<< file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << " )"; << file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << " )";
@ -2623,6 +2629,23 @@ void SMESH_Mesh_i::ExportMED (const char* file,
ExportToMEDX(file,auto_groups,SMESH::MED_V2_2,true); ExportToMEDX(file,auto_groups,SMESH::MED_V2_2,true);
} }
//================================================================================
/*!
* \brief Export a mesh to a SAUV file
*/
//================================================================================
void SMESH_Mesh_i::ExportSAUV (const char* file,
CORBA::Boolean auto_groups)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
string aMeshName = PrepareMeshNameAndGroups(file, true);
TPythonDump() << _this() << ".ExportSAUV( r'" << file << "', " << auto_groups << " )";
_impl->ExportSAUV(file, aMeshName.c_str(), auto_groups);
}
//================================================================================ //================================================================================
/*! /*!
* \brief Export a mesh to a DAT file * \brief Export a mesh to a DAT file

View File

@ -230,6 +230,8 @@ public:
void ExportMED ( const char* file, void ExportMED ( const char* file,
CORBA::Boolean auto_groups ) throw (SALOME::SALOME_Exception); CORBA::Boolean auto_groups ) throw (SALOME::SALOME_Exception);
void ExportSAUV( const char* file, CORBA::Boolean auto_groups ) throw (SALOME::SALOME_Exception);
void ExportDAT( const char* file ) throw (SALOME::SALOME_Exception); void ExportDAT( const char* file ) throw (SALOME::SALOME_Exception);
void ExportUNV( const char* file ) throw (SALOME::SALOME_Exception); void ExportUNV( const char* file ) throw (SALOME::SALOME_Exception);
void ExportSTL( const char* file, bool isascii ) throw (SALOME::SALOME_Exception); void ExportSTL( const char* file, bool isascii ) throw (SALOME::SALOME_Exception);
@ -570,6 +572,8 @@ public:
std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
private: private:
std::string PrepareMeshNameAndGroups( const char* file, CORBA::Boolean overwrite );
/*! /*!
* Check and correct names of mesh groups * Check and correct names of mesh groups
*/ */

View File

@ -697,6 +697,17 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aMeshes.append(aMesh) aMeshes.append(aMesh)
return aMeshes, aStatus return aMeshes, aStatus
## Creates a Mesh object(s) importing data from the given SAUV file
# @return a list of Mesh class instances
# @ingroup l2_impexp
def CreateMeshesFromSAUV( self,theFileName ):
aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromSAUV(self,theFileName)
aMeshes = []
for iMesh in range(len(aSmeshMeshes)) :
aMesh = Mesh(self, self.geompyD, aSmeshMeshes[iMesh])
aMeshes.append(aMesh)
return aMeshes, aStatus
## Creates a Mesh object importing data from the given STL file ## Creates a Mesh object importing data from the given STL file
# @return an instance of Mesh class # @return an instance of Mesh class
# @ingroup l2_impexp # @ingroup l2_impexp
@ -1747,6 +1758,15 @@ class Mesh:
else: else:
self.mesh.ExportToMEDX(f, auto_groups, version, overwrite) self.mesh.ExportToMEDX(f, auto_groups, version, overwrite)
## Exports the mesh in a file in SAUV format
# @param f is the file name
# @param auto_groups boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
# the typical use is auto_groups=false.
# @ingroup l2_impexp
def ExportSAUV(self, f, auto_groups=0):
self.mesh.ExportSAUV(f, auto_groups)
## Exports the mesh in a file in DAT format ## Exports the mesh in a file in DAT format
# @param f the file name # @param f the file name
# @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh # @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh