Reload from file

Small refactoring
This commit is contained in:
asozinov 2024-06-26 14:17:19 +01:00
parent 0f7ae1cbd7
commit ee0bee16d1
6 changed files with 20 additions and 63 deletions

View File

@ -258,8 +258,7 @@ module SMESH
SMESH_Mesh CreateEmptyMesh()
raises ( SALOME::SALOME_Exception );
SMESH_Mesh ReloadMeshFromFile( in string theFileName,
in SMESH_Mesh sourceMesh)
SMESH_Mesh ReloadMeshFromFile(in SMESH_Mesh sourceMesh)
raises(SALOME::SALOME_Exception);
/*!
@ -269,14 +268,6 @@ module SMESH
SMESH_Mesh CreateMeshesFromUNV( in string theFileName )
raises ( SALOME::SALOME_Exception );
/*!
* Reload Mesh object importing data from given UNV file
* (UNV supported version is I-DEAS 10)
*
SMESH_Mesh ReloadMeshesFromUNV( in string theFileName,
in SMESH_Mesh sourceMesh )
raises(SALOME::SALOME_Exception);*/
/*!
* Create Mesh object(s) importing data from given MED file
*/
@ -284,27 +275,12 @@ module SMESH
out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception );
/*!
* Reload Mesh object(s) importing data from given MED file
*
mesh_array ReloadMeshesFromMED( in string theFileName,
in SMESH_Mesh sourceMesh,
out SMESH::DriverMED_ReadStatus theStatus )
raises(SALOME::SALOME_Exception);*/
/*!
* Create Mesh object importing data from given STL file
*/
SMESH_Mesh CreateMeshesFromSTL( in string theFileName )
raises ( SALOME::SALOME_Exception );
/*!
* Reload Mesh object importing data from given STL file
*
SMESH_Mesh ReloadMeshesFromSTL( in string theFileName,
in SMESH_Mesh sourceMesh )
raises(SALOME::SALOME_Exception);*/
/*!
* Create Mesh object(s) importing data from given CGNS file
*/
@ -312,14 +288,6 @@ module SMESH
out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception );
/*!
* Reload Mesh object(s) importing data from given CGNS file
*
mesh_array ReloadMeshesFromCGNS( in string theFileName,
in SMESH_Mesh sourceMesh,
out SMESH::DriverMED_ReadStatus theStatus )
raises(SALOME::SALOME_Exception);*/
/*!
* Create Mesh object importing data from given GMF file
* \param theFileName - a name of file to import
@ -330,17 +298,6 @@ module SMESH
out SMESH::ComputeError theError)
raises ( SALOME::SALOME_Exception );
/*!
* Reload Mesh object importing data from given GMF file
* \param theFileName - a name of file to import
* \param theMakeRequiredGroups - if true, groups of required entities will be created
*
SMESH_Mesh ReloadMeshesFromGMF( in string theFileName,
in SMESH_Mesh sourceMesh,
in boolean theMakeRequiredGroups,
out SMESH::ComputeError theError )
raises(SALOME::SALOME_Exception);*/
/*!
* Create a mesh and import data from any file supported by meshio library
*/
@ -348,13 +305,6 @@ module SMESH
out SMESH::DriverMED_ReadStatus theStatus)
raises (SALOME::SALOME_Exception);
/*!
* Reload a mesh and import data from any file supported by meshio library
*
mesh_array ReloadMeshesFromMESHIO( in string theFileName,
in SMESH_Mesh sourceMesh,
out SMESH::DriverMED_ReadStatus theStatus )
raises(SALOME::SALOME_Exception);*/
/*!
* Create a dual mesh of a Tetrahedron mesh

View File

@ -1123,9 +1123,8 @@ namespace
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
{
// Get file path and re-import mesh
QString aPath = anInfo.fileName();
SMESH::SMESH_Mesh_var aReloadedMesh = SMESHGUI::GetSMESHGen()->ReloadMeshFromFile(aPath.toUtf8().constData(), aMeshByIO);
// re-import mesh
SMESH::SMESH_Mesh_var aReloadedMesh = SMESHGUI::GetSMESHGen()->ReloadMeshFromFile(aMeshByIO);
QStringList anEntryList;

View File

@ -1013,6 +1013,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
{
// there are methods to convert:
// CreateMesh( shape )
// ReloadMesh( shape )
// Concatenate( [mesh1, ...], ... )
// CreateHypothesis( theHypType, theLibName )
// Compute( mesh, geom )
@ -1067,6 +1068,13 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
Handle(_pyMesh) mesh = new _pyMesh( theCommand, entries.front() );
AddObject( mesh );
}
if (method == "ReloadMeshFromFile")
{
std::cout << "WhatIS" << std::endl;
Handle(_pyMesh) mesh = new _pyMesh(theCommand, theCommand->GetResultValue());
AddObject(mesh);
return;
}
// CreateHypothesis()
if ( method == "CreateHypothesis" )

View File

@ -1331,16 +1331,17 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateEmptyMesh()
return mesh._retn();
}
SMESH::SMESH_Mesh_ptr SMESH_Gen_i::ReloadMeshFromFile(const char* theFileName,
SMESH::SMESH_Mesh_ptr theMesh)
SMESH::SMESH_Mesh_ptr SMESH_Gen_i::ReloadMeshFromFile(SMESH::SMESH_Mesh_ptr theMesh)
{
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
SMESH::MedFileInfo* aMedInfo = theMesh->GetMEDFileInfo();
// Get file path and re-import mesh
QString aPath = QString(theFileName);
QString aPath = QString(aMedInfo->fileName);
QStringList aSplit = aPath.split('.');
QStringList anEntryList;
auto aStudy = getStudyServant();
SMESH::SMESH_Mesh_ptr aNewMesh;

View File

@ -237,8 +237,7 @@ public:
// Create empty mesh
SMESH::SMESH_Mesh_ptr CreateEmptyMesh();
SMESH::SMESH_Mesh_ptr ReloadMeshFromFile( const char* theFileName,
SMESH::SMESH_Mesh_ptr theMesh);
SMESH::SMESH_Mesh_ptr ReloadMeshFromFile(SMESH::SMESH_Mesh_ptr theMesh);
// Create a mesh and import data from an UNV file
SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName );

View File

@ -675,13 +675,13 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
global notebook
notebook = salome_notebook.NoteBook( theIsEnablePublish )
def ReloadMeshFromFile(self, theFileName, theMesh):
def ReloadMeshFromFile(self, theMesh):
"""
Desc for method,
"""
aSmeshMesh = SMESH._objref_SMESH_Gen.ReloadMeshFromFile(self,theFileName)
aMesh = Mesh(self, self.geompyD, theFileName, aSmeshMesh)
aSmeshMesh = SMESH._objref_SMESH_Gen.ReloadMeshFromFile(self, theMesh)
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
return aMesh
def CreateMeshesFromUNV( self,theFileName ):