mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
0021952: Add an option to write planar meshes as 3D meshes in MED files
This commit is contained in:
parent
dfe28da84c
commit
4fecefcc2b
@ -16,23 +16,43 @@ idbox = geompy.addToStudy(box, "box")
|
|||||||
|
|
||||||
# create a mesh
|
# create a mesh
|
||||||
tetra = smesh.Mesh(box, "MeshBox")
|
tetra = smesh.Mesh(box, "MeshBox")
|
||||||
|
tetra.Segment().NumberOfSegments(7)
|
||||||
algo1D = tetra.Segment()
|
tetra.Triangle()
|
||||||
algo1D.NumberOfSegments(7)
|
tetra.Tetrahedron()
|
||||||
|
|
||||||
algo2D = tetra.Triangle()
|
|
||||||
algo2D.MaxElementArea(800.)
|
|
||||||
|
|
||||||
algo3D = tetra.Tetrahedron()
|
|
||||||
algo3D.MaxElementVolume(900.)
|
|
||||||
|
|
||||||
# compute the mesh
|
# compute the mesh
|
||||||
tetra.Compute()
|
tetra.Compute()
|
||||||
|
|
||||||
# export the mesh in a MED file
|
# export the mesh in a MED file
|
||||||
tetra.ExportMED("/tmp/meshMED.med", 0)
|
import tempfile
|
||||||
|
medFile = tempfile.NamedTemporaryFile(suffix=".med").name
|
||||||
|
tetra.ExportMED( medFile, 0 )
|
||||||
|
|
||||||
# export a group in a MED file
|
# export a group in a MED file
|
||||||
face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
|
face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
|
||||||
group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
|
group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
|
||||||
tetra.ExportMED("/tmp/groupMED.med", meshPart=group)
|
tetra.ExportMED( medFile, meshPart=group )
|
||||||
|
|
||||||
|
# ========================
|
||||||
|
# autoDimension parameter
|
||||||
|
# ========================
|
||||||
|
|
||||||
|
face = geompy.MakeFaceHW( 10, 10, 1, "rectangle" )
|
||||||
|
mesh2D = smesh.Mesh( face, "mesh2D" )
|
||||||
|
mesh2D.AutomaticHexahedralization(0)
|
||||||
|
|
||||||
|
import MEDLoader, os
|
||||||
|
|
||||||
|
# exported mesh is in 2D space because it is a planar mesh lying
|
||||||
|
# on XOY plane, and autoDimension=True by default
|
||||||
|
mesh2D.ExportMED( medFile )
|
||||||
|
medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0)
|
||||||
|
print "autoDimension==True, exported mesh is in %sD"%medMesh.getSpaceDimension()
|
||||||
|
|
||||||
|
# exported mesh is in 3D space, same as in Mesh module,
|
||||||
|
# thanks to autoDimension=False
|
||||||
|
mesh2D.ExportMED( medFile, autoDimension=False )
|
||||||
|
medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0)
|
||||||
|
print "autoDimension==False, exported mesh is in %sD"%medMesh.getSpaceDimension()
|
||||||
|
|
||||||
|
os.remove( medFile )
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 45 KiB |
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
\page importing_exporting_meshes_page Importing and exporting meshes
|
\page importing_exporting_meshes_page Importing and exporting meshes
|
||||||
|
|
||||||
\n In MESH there is a functionality allowing importation/exportation
|
\n In MESH there is a functionality allowing import/export
|
||||||
of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL,
|
of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL,
|
||||||
\b GMF (internal format of DISTENE products, namely BLSurf, GHS3D and Hexotic algorithms) and \b CGNS format files. You can also export a group as a whole mesh.
|
\b GMF (internal format of DISTENE products, namely BLSurf, GHS3D and
|
||||||
|
Hexotic algorithms) and \b CGNS format files. You can also export a
|
||||||
|
group as a whole mesh.
|
||||||
|
|
||||||
|
|
||||||
<em>To import a mesh:</em>
|
<em>To import a mesh:</em>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>From the \b File menu choose the \b Import item, from its sub-menu
|
<li>From the \b File menu choose the \b Import item, from its sub-menu
|
||||||
select the corresponding format (MED, UNV, STL, GMF and CGNS) of the file containing
|
select the corresponding format (MED, UNV, STL, GMF and CGNS) of the
|
||||||
your mesh.</li>
|
file containing your mesh.</li>
|
||||||
<li>In the standard <b>Search File</b> dialog box find the file for
|
<li>In the standard <b>Search File</b> dialog box find the file for
|
||||||
importation. It is possible to select multiple files to be imported all at once. </li>
|
import. It is possible to select multiple files to be imported all at
|
||||||
|
once. </li>
|
||||||
|
|
||||||
<li>Click the \b OK button.</li>
|
<li>Click the \b OK button.</li>
|
||||||
</ol>
|
</ol>
|
||||||
@ -24,17 +27,35 @@ importation. It is possible to select multiple files to be imported all at once.
|
|||||||
<em>To export a mesh or a group:</em>
|
<em>To export a mesh or a group:</em>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>Select the object you wish to export.</li>
|
<li>Select the object you wish to export.</li>
|
||||||
<li>From the \b File menu choose the \b Export item, from its sub-menu
|
<li>From the \b File menu choose the \b Export item, from its sub-menu
|
||||||
select the format (MED, UNV, DAT, STL, GMF and CGNS) of the file which will
|
select the format (MED, UNV, DAT, STL, GMF and CGNS) of the file which will
|
||||||
contain your exported mesh.</li>
|
contain your exported mesh.</li>
|
||||||
<li>In the standard <b>Search File</b> select a location for the
|
<li>In the standard <b>Search File</b> select a location for the
|
||||||
exported file and enter its name.</li>
|
exported file and enter its name.</li>
|
||||||
<li>Click the \b OK button.</li>
|
<li>Click the \b OK button.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
\image html meshexportmesh.png
|
\image html meshexportmesh.png
|
||||||
|
|
||||||
|
At export to MED and SAUV format files additional parameters are available.
|
||||||
|
<ul>
|
||||||
|
<li><b>Automatically create groups</b> check-box specifies whether to
|
||||||
|
create groups of all mesh entities of available dimensions or
|
||||||
|
not. If checked, the created groups have names like "Group_On_All_Nodes",
|
||||||
|
"Group_On_All_Faces" etc.</li>
|
||||||
|
<li><b>Automatically define space dimension</b> check-box specifies
|
||||||
|
whether to define space dimension for export by mesh configuration
|
||||||
|
or not. Usually the mesh is exported as a mesh in 3D space, just as
|
||||||
|
it is in Mesh module. The mesh can be exported as a mesh in lower
|
||||||
|
dimension in following cases, provided that this check-box is
|
||||||
|
checked.
|
||||||
|
<ul>
|
||||||
|
<li> 1D: if all mesh nodes lie on OX coordinate axis. </li>
|
||||||
|
<li> 2D: if all mesh nodes lie on XOY coordinate plane. </li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<br><b>See Also</b> a sample TUI Script of an \ref tui_export_mesh "Export Mesh" operation.
|
<br><b>See Also</b> a sample TUI Script of an \ref tui_export_mesh "Export Mesh" operation.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
\anchor tui_editing_mesh
|
\anchor tui_editing_mesh
|
||||||
<h2>Editing of a mesh</h2>
|
<h2>Editing a mesh</h2>
|
||||||
\tui_script{creating_meshes_ex04.py}
|
\tui_script{creating_meshes_ex04.py}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
@ -596,7 +596,7 @@ module SMESH
|
|||||||
boolean HasDuplicatedGroupNamesMED();
|
boolean HasDuplicatedGroupNamesMED();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Export Mesh to different MED Formats
|
* Export Mesh to a MED Format file
|
||||||
* @params
|
* @params
|
||||||
* - file : name of the MED file
|
* - file : name of the MED file
|
||||||
* - auto_groups : boolean parameter for creating/not creating
|
* - auto_groups : boolean parameter for creating/not creating
|
||||||
@ -604,11 +604,18 @@ module SMESH
|
|||||||
* the typical use is auto_groups=false.
|
* the typical use is auto_groups=false.
|
||||||
* - version : define the version of format of MED file, that will be created
|
* - version : define the version of format of MED file, that will be created
|
||||||
* - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
|
* - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
|
||||||
|
* - autoDimension: if @c True (default), a space dimension of a MED mesh can be either
|
||||||
|
* - 1D if all mesh nodes lie on OX coordinate axis, or
|
||||||
|
* - 2D if all mesh nodes lie on XOY coordinate plane, or
|
||||||
|
* - 3D in the rest cases.
|
||||||
|
*
|
||||||
|
* If @a autoDimension is @c False, the space dimension is always 3.
|
||||||
*/
|
*/
|
||||||
void ExportToMEDX( in string file,
|
void ExportToMEDX( in string file,
|
||||||
in boolean auto_groups,
|
in boolean auto_groups,
|
||||||
in MED_VERSION version,
|
in MED_VERSION version,
|
||||||
in boolean overwrite ) raises (SALOME::SALOME_Exception);
|
in boolean overwrite,
|
||||||
|
in boolean autoDimension ) raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Export a part of Mesh into a MED file
|
* Export a part of Mesh into a MED file
|
||||||
@ -617,15 +624,20 @@ module SMESH
|
|||||||
* - file : name of the MED file
|
* - file : name of the MED file
|
||||||
* - version : define the version of format of MED file, that will be created
|
* - version : define the version of format of MED file, that will be created
|
||||||
* - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
|
* - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
|
||||||
|
* - autoDimension: if @c True, a space dimension for export is defined by mesh
|
||||||
|
* configuration; for example a planar mesh lying on XOY plane
|
||||||
|
* will be exported as a mesh in 2D space.
|
||||||
|
* If @a autoDimension == @c False, the space dimension is 3.
|
||||||
*/
|
*/
|
||||||
void ExportPartToMED( in SMESH_IDSource meshPart,
|
void ExportPartToMED( in SMESH_IDSource meshPart,
|
||||||
in string file,
|
in string file,
|
||||||
in boolean auto_groups,
|
in boolean auto_groups,
|
||||||
in MED_VERSION version,
|
in MED_VERSION version,
|
||||||
in boolean overwrite ) raises (SALOME::SALOME_Exception);
|
in boolean overwrite,
|
||||||
|
in boolean autoDimension ) raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Export Mesh to different MED Formats
|
* Export Mesh to a MED Format file
|
||||||
* Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
|
* Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
|
||||||
* The method is kept in order to support old functionality
|
* The method is kept in order to support old functionality
|
||||||
*/
|
*/
|
||||||
|
@ -52,7 +52,8 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
|
|||||||
myDoGroupOfFaces (false),
|
myDoGroupOfFaces (false),
|
||||||
myDoGroupOfVolumes (false),
|
myDoGroupOfVolumes (false),
|
||||||
myDoGroupOf0DElems(false),
|
myDoGroupOf0DElems(false),
|
||||||
myDoGroupOfBalls(false)
|
myDoGroupOfBalls(false),
|
||||||
|
myAutoDimension(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,
|
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,
|
||||||
@ -120,7 +121,8 @@ void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes()
|
|||||||
myDoGroupOfVolumes = true;
|
myDoGroupOfVolumes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace{
|
namespace
|
||||||
|
{
|
||||||
typedef double (SMDS_MeshNode::* TGetCoord)() const;
|
typedef double (SMDS_MeshNode::* TGetCoord)() const;
|
||||||
typedef const char* TName;
|
typedef const char* TName;
|
||||||
typedef const char* TUnit;
|
typedef const char* TUnit;
|
||||||
@ -311,12 +313,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mesh dimension definition
|
// Mesh dimension definition
|
||||||
TInt aSpaceDimension;
|
TInt aSpaceDimension = 3;
|
||||||
TCoordHelperPtr aCoordHelperPtr;
|
TCoordHelperPtr aCoordHelperPtr;
|
||||||
{
|
{
|
||||||
bool anIsXDimension = false;
|
bool anIsXDimension = false;
|
||||||
bool anIsYDimension = false;
|
bool anIsYDimension = false;
|
||||||
bool anIsZDimension = false;
|
bool anIsZDimension = false;
|
||||||
|
if ( myAutoDimension )
|
||||||
{
|
{
|
||||||
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
|
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
|
||||||
double aBounds[6];
|
double aBounds[6];
|
||||||
|
@ -48,6 +48,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
|||||||
|
|
||||||
virtual void SetFile(const std::string& theFileName);
|
virtual void SetFile(const std::string& theFileName);
|
||||||
void SetFile(const std::string& theFileName, MED::EVersion theId);
|
void SetFile(const std::string& theFileName, MED::EVersion theId);
|
||||||
|
void SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; }
|
||||||
static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2);
|
static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2);
|
||||||
|
|
||||||
/*! sets file name; only for usage with Add(), not Write()
|
/*! sets file name; only for usage with Add(), not Write()
|
||||||
@ -81,6 +82,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
|||||||
bool myDoGroupOfVolumes;
|
bool myDoGroupOfVolumes;
|
||||||
bool myDoGroupOf0DElems;
|
bool myDoGroupOf0DElems;
|
||||||
bool myDoGroupOfBalls;
|
bool myDoGroupOfBalls;
|
||||||
|
bool myAutoDimension;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1248,7 +1248,8 @@ void SMESH_Mesh::ExportMED(const char * file,
|
|||||||
const char* theMeshName,
|
const char* theMeshName,
|
||||||
bool theAutoGroups,
|
bool theAutoGroups,
|
||||||
int theVersion,
|
int theVersion,
|
||||||
const SMESHDS_Mesh* meshPart)
|
const SMESHDS_Mesh* meshPart,
|
||||||
|
bool theAutoDimension)
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
Unexpect aCatch(SalomeException);
|
||||||
@ -1256,11 +1257,12 @@ void SMESH_Mesh::ExportMED(const char * file,
|
|||||||
DriverMED_W_SMESHDS_Mesh myWriter;
|
DriverMED_W_SMESHDS_Mesh myWriter;
|
||||||
myWriter.SetFile ( file, MED::EVersion(theVersion) );
|
myWriter.SetFile ( file, MED::EVersion(theVersion) );
|
||||||
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||||
|
myWriter.SetAutoDimension( theAutoDimension );
|
||||||
if ( !theMeshName )
|
if ( !theMeshName )
|
||||||
myWriter.SetMeshId ( _id );
|
myWriter.SetMeshId ( _id );
|
||||||
else {
|
else {
|
||||||
myWriter.SetMeshId ( -1 );
|
myWriter.SetMeshId ( -1 );
|
||||||
myWriter.SetMeshName( theMeshName );
|
myWriter.SetMeshName ( theMeshName );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( theAutoGroups ) {
|
if ( theAutoGroups ) {
|
||||||
|
@ -229,11 +229,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool HasDuplicatedGroupNamesMED();
|
bool HasDuplicatedGroupNamesMED();
|
||||||
|
|
||||||
void ExportMED(const char *file,
|
void ExportMED(const char * theFile,
|
||||||
const char* theMeshName = NULL,
|
const char* theMeshName = NULL,
|
||||||
bool theAutoGroups = true,
|
bool theAutoGroups = true,
|
||||||
int theVersion = 0,
|
int theVersion = 0,
|
||||||
const SMESHDS_Mesh* meshPart = 0)
|
const SMESHDS_Mesh* theMeshPart = 0,
|
||||||
|
bool theAutoDimension = false)
|
||||||
throw(SALOME_Exception);
|
throw(SALOME_Exception);
|
||||||
|
|
||||||
void ExportDAT(const char * file,
|
void ExportDAT(const char * file,
|
||||||
|
@ -591,6 +591,7 @@
|
|||||||
if ( resMgr )
|
if ( resMgr )
|
||||||
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
||||||
bool toOverwrite = true;
|
bool toOverwrite = true;
|
||||||
|
bool toFindOutDim = true;
|
||||||
|
|
||||||
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
|
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
|
||||||
QString anInitialPath = "";
|
QString anInitialPath = "";
|
||||||
@ -612,32 +613,6 @@
|
|||||||
anInitialPath + QString("/") + aMeshName,
|
anInitialPath + QString("/") + aMeshName,
|
||||||
aFilter, aTitle, false);
|
aFilter, aTitle, false);
|
||||||
}
|
}
|
||||||
// else if ( isGMF )// Export to GMF
|
|
||||||
// {
|
|
||||||
// SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
|
|
||||||
// ( SMESHGUI::desktop(), false, QObject::tr("SMESH_REQUIRED_GROUPS"), true, true );
|
|
||||||
// QStringList filters;
|
|
||||||
// filters << QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)"
|
|
||||||
// << QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
|
|
||||||
// fd->setWindowTitle( aTitle );
|
|
||||||
// fd->setNameFilters( filters );
|
|
||||||
|
|
||||||
// if ( !aMeshOrGroup->_is_equivalent( aMesh ))
|
|
||||||
// toCreateGroups = false;
|
|
||||||
// else
|
|
||||||
// toCreateGroups = ( aMesh->NbGroups() > 0 );
|
|
||||||
|
|
||||||
// fd->SetChecked( true );
|
|
||||||
// if ( !anInitialPath.isEmpty() )
|
|
||||||
// fd->setDirectory( anInitialPath );
|
|
||||||
// fd->selectFile(aMeshName);
|
|
||||||
|
|
||||||
// if ( fd->exec() )
|
|
||||||
// aFilename = fd->selectedFile();
|
|
||||||
// toCreateGroups = fd->IsChecked();
|
|
||||||
|
|
||||||
// delete fd;
|
|
||||||
// }
|
|
||||||
else if ( isCGNS )// Export to CGNS
|
else if ( isCGNS )// Export to CGNS
|
||||||
{
|
{
|
||||||
SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
|
SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
|
||||||
@ -705,13 +680,16 @@
|
|||||||
if (it.value() == SMESH::MED_V2_2)
|
if (it.value() == SMESH::MED_V2_2)
|
||||||
aDefaultFilter = it.key();
|
aDefaultFilter = it.key();
|
||||||
}
|
}
|
||||||
|
QStringList checkBoxes;
|
||||||
|
checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM");
|
||||||
|
|
||||||
SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
|
SalomeApp_CheckFileDlg* fd =
|
||||||
( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
|
new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
|
||||||
fd->setWindowTitle( aTitle );
|
fd->setWindowTitle( aTitle );
|
||||||
fd->setNameFilters( filters );
|
fd->setNameFilters( filters );
|
||||||
fd->selectNameFilter(aDefaultFilter);
|
fd->selectNameFilter(aDefaultFilter);
|
||||||
fd->SetChecked(toCreateGroups);
|
fd->SetChecked(0,toCreateGroups);
|
||||||
|
fd->SetChecked(1,toFindOutDim);
|
||||||
if ( !anInitialPath.isEmpty() )
|
if ( !anInitialPath.isEmpty() )
|
||||||
fd->setDirectory( anInitialPath );
|
fd->setDirectory( anInitialPath );
|
||||||
fd->selectFile(aMeshName);
|
fd->selectFile(aMeshName);
|
||||||
@ -794,7 +772,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toCreateGroups = fd->IsChecked();
|
toCreateGroups = fd->IsChecked(0);
|
||||||
|
toFindOutDim = fd->IsChecked(1);
|
||||||
delete fd;
|
delete fd;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -833,10 +812,10 @@
|
|||||||
SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
|
SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
|
||||||
if ( aMeshOrGroup->_is_equivalent( aMeshItem ))
|
if ( aMeshOrGroup->_is_equivalent( aMeshItem ))
|
||||||
aMeshItem->ExportToMEDX( aFilename.toLatin1().data(), toCreateGroups,
|
aMeshItem->ExportToMEDX( aFilename.toLatin1().data(), toCreateGroups,
|
||||||
aFormat, toOverwrite && aMeshIndex == 0 );
|
aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
|
||||||
else
|
else
|
||||||
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups,
|
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups,
|
||||||
aFormat, toOverwrite && aMeshIndex == 0 );
|
aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( isSAUV )
|
else if ( isSAUV )
|
||||||
|
@ -1269,6 +1269,10 @@ Please enter correct values and try again</translation>
|
|||||||
<source>SMESH_AUTO_GROUPS</source>
|
<source>SMESH_AUTO_GROUPS</source>
|
||||||
<translation>Automatically create groups</translation>
|
<translation>Automatically create groups</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SMESH_AUTO_DIM</source>
|
||||||
|
<translation>Automatically define space dimension</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_REQUIRED_GROUPS</source>
|
<source>SMESH_REQUIRED_GROUPS</source>
|
||||||
<translation>Create groups of required entities</translation>
|
<translation>Create groups of required entities</translation>
|
||||||
|
@ -2708,7 +2708,8 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file,
|
|||||||
void SMESH_Mesh_i::ExportToMEDX (const char* file,
|
void SMESH_Mesh_i::ExportToMEDX (const char* file,
|
||||||
CORBA::Boolean auto_groups,
|
CORBA::Boolean auto_groups,
|
||||||
SMESH::MED_VERSION theVersion,
|
SMESH::MED_VERSION theVersion,
|
||||||
CORBA::Boolean overwrite)
|
CORBA::Boolean overwrite,
|
||||||
|
CORBA::Boolean autoDimension)
|
||||||
throw(SALOME::SALOME_Exception)
|
throw(SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
@ -2717,9 +2718,11 @@ void SMESH_Mesh_i::ExportToMEDX (const char* file,
|
|||||||
|
|
||||||
string aMeshName = prepareMeshNameAndGroups(file, overwrite);
|
string aMeshName = prepareMeshNameAndGroups(file, overwrite);
|
||||||
TPythonDump() << _this() << ".ExportToMEDX( r'"
|
TPythonDump() << _this() << ".ExportToMEDX( r'"
|
||||||
<< file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << " )";
|
<< file << "', " << auto_groups << ", "
|
||||||
|
<< theVersion << ", " << overwrite << ", "
|
||||||
|
<< autoDimension << " )";
|
||||||
|
|
||||||
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion );
|
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion, 0, autoDimension );
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -2848,10 +2851,19 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart,
|
|||||||
const char* file,
|
const char* file,
|
||||||
CORBA::Boolean auto_groups,
|
CORBA::Boolean auto_groups,
|
||||||
::SMESH::MED_VERSION version,
|
::SMESH::MED_VERSION version,
|
||||||
::CORBA::Boolean overwrite)
|
::CORBA::Boolean overwrite,
|
||||||
|
::CORBA::Boolean autoDimension)
|
||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
TPythonDump pyDump;
|
||||||
|
|
||||||
|
if ( SMESH_Mesh_i * mesh = SMESH::DownCast< SMESH_Mesh_i* >( meshPart ))
|
||||||
|
{
|
||||||
|
mesh->ExportToMEDX( file, auto_groups, version, autoDimension );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ( _preMeshInfo )
|
if ( _preMeshInfo )
|
||||||
_preMeshInfo->FullLoadFromFile();
|
_preMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
@ -2867,10 +2879,11 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SMESH_MeshPartDS partDS( meshPart );
|
SMESH_MeshPartDS partDS( meshPart );
|
||||||
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS );
|
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS, autoDimension );
|
||||||
|
}
|
||||||
TPythonDump() << _this() << ".ExportPartToMED( " << meshPart << ", r'" << file << "', "
|
pyDump << _this() << ".ExportPartToMED( " << meshPart << ", r'" << file << "', "
|
||||||
<< auto_groups << ", " << version << ", " << overwrite << " )";
|
<< auto_groups << ", " << version << ", " << overwrite << ", "
|
||||||
|
<< autoDimension << " )";
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -231,7 +231,8 @@ public:
|
|||||||
void ExportToMEDX( const char* file,
|
void ExportToMEDX( const char* file,
|
||||||
CORBA::Boolean auto_groups,
|
CORBA::Boolean auto_groups,
|
||||||
SMESH::MED_VERSION version,
|
SMESH::MED_VERSION version,
|
||||||
CORBA::Boolean overwrite ) throw (SALOME::SALOME_Exception);
|
CORBA::Boolean overwrite,
|
||||||
|
CORBA::Boolean autoDimension=true) throw (SALOME::SALOME_Exception);
|
||||||
void ExportToMED ( const char* file,
|
void ExportToMED ( const char* file,
|
||||||
CORBA::Boolean auto_groups,
|
CORBA::Boolean auto_groups,
|
||||||
SMESH::MED_VERSION version ) throw (SALOME::SALOME_Exception);
|
SMESH::MED_VERSION version ) throw (SALOME::SALOME_Exception);
|
||||||
@ -254,7 +255,8 @@ public:
|
|||||||
const char* file,
|
const char* file,
|
||||||
CORBA::Boolean auto_groups,
|
CORBA::Boolean auto_groups,
|
||||||
SMESH::MED_VERSION version,
|
SMESH::MED_VERSION version,
|
||||||
CORBA::Boolean overwrite) throw (SALOME::SALOME_Exception);
|
CORBA::Boolean overwrite,
|
||||||
|
CORBA::Boolean autoDim=true) throw (SALOME::SALOME_Exception);
|
||||||
void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
|
void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
|
||||||
const char* file) throw (SALOME::SALOME_Exception);
|
const char* file) throw (SALOME::SALOME_Exception);
|
||||||
void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
|
void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
|
||||||
|
@ -1567,14 +1567,21 @@ class Mesh:
|
|||||||
# @param version MED format version(MED_V2_1 or MED_V2_2)
|
# @param version MED format version(MED_V2_1 or MED_V2_2)
|
||||||
# @param overwrite boolean parameter for overwriting/not overwriting the file
|
# @param overwrite boolean parameter for overwriting/not overwriting the file
|
||||||
# @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
|
||||||
|
# @param autoDimension: if @c True (default), a space dimension of a MED mesh can be either
|
||||||
|
# - 1D if all mesh nodes lie on OX coordinate axis, or
|
||||||
|
# - 2D if all mesh nodes lie on XOY coordinate plane, or
|
||||||
|
# - 3D in the rest cases.
|
||||||
|
#
|
||||||
|
# If @a autoDimension is @c False, the space dimension is always 3.
|
||||||
# @ingroup l2_impexp
|
# @ingroup l2_impexp
|
||||||
def ExportMED(self, f, auto_groups=0, version=MED_V2_2, overwrite=1, meshPart=None):
|
def ExportMED(self, f, auto_groups=0, version=MED_V2_2,
|
||||||
|
overwrite=1, meshPart=None, autoDimension=True):
|
||||||
if meshPart:
|
if meshPart:
|
||||||
if isinstance( meshPart, list ):
|
if isinstance( meshPart, list ):
|
||||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||||
self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite )
|
self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension)
|
||||||
else:
|
else:
|
||||||
self.mesh.ExportToMEDX(f, auto_groups, version, overwrite)
|
self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension)
|
||||||
|
|
||||||
## Exports the mesh in a file in SAUV format
|
## Exports the mesh in a file in SAUV format
|
||||||
# @param f is the file name
|
# @param f is the file name
|
||||||
|
Loading…
Reference in New Issue
Block a user