mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
23611: EDF 11012 - Force Z coords to 0
This commit is contained in:
parent
13d0dc562d
commit
fc9c05a33c
BIN
doc/salome/gui/SMESH/images/meshexportmesh.png
Executable file → Normal file
BIN
doc/salome/gui/SMESH/images/meshexportmesh.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 41 KiB |
Binary file not shown.
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 92 KiB |
@ -8,11 +8,12 @@ Importing and exporting meshes
|
||||
In MESH there is a functionality allowing import/export of meshes in the following formats:
|
||||
|
||||
* **MED**,
|
||||
* **SAUV** (format of the CASTEM code),
|
||||
* **UNV** (I-DEAS 10),
|
||||
* **DAT** (simple ascii format),
|
||||
* **STL**,
|
||||
* **CGNS**,
|
||||
* **GMF** (internal format of DISTENE products from the MeshGems suite),
|
||||
* **CGNS**.
|
||||
* **DAT** (simple ascii format).
|
||||
|
||||
You can also export a group as a whole mesh.
|
||||
|
||||
@ -42,10 +43,13 @@ If you try to export a group, the warning will be shown:
|
||||
|
||||
* **Don't show this warning anymore** check-box allows to switch off the warning. You can re-activate the warning in :ref:`Preferences <group_export_warning_pref>`.
|
||||
|
||||
Only MED format supports all types of elements that can be created in the module. If you export a mesh or group that includes elements of types that are not supported by chosen format, you will be warned about that.
|
||||
|
||||
There are additional parameters available at export to MED and SAUV format files.
|
||||
|
||||
.. _export_auto_groups:
|
||||
|
||||
* **Z tolerance** field if enabled specifies distance of nodes from the XOY plane below which the nodes snap to this plane. A default value can be set in :ref:`Preferences <medexport_z_tolerance_pref>`.
|
||||
* **Automatically create groups** check-box specifies whether to create groups of all mesh entities of available dimensions or not. The created groups have names like "Group_On_All_Nodes", "Group_On_All_Faces", etc. A default state of this check-box can be set in :ref:`Preferences <export_auto_groups_pref>`.
|
||||
* **Automatically define space dimension** 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 of a lower dimension in the following cases, provided that this check-box is checked:
|
||||
|
||||
|
@ -52,6 +52,10 @@ General Preferences
|
||||
|
||||
* **Show warning when exporting group** - if activated, a warning is displayed when exporting a group.
|
||||
|
||||
.. _medexport_z_tolerance_pref:
|
||||
|
||||
* **Z tolerance for MED export** - defines Z tolerance in :ref:`MED Export <export_auto_groups>` dialog.
|
||||
|
||||
.. _show_comp_result_pref:
|
||||
|
||||
* **Mesh computation**
|
||||
|
@ -665,6 +665,9 @@ module SMESH
|
||||
* - 'e' stands for _edges_ field;
|
||||
* - 'f' stands for _faces_ field;
|
||||
* - 's' stands for _solids_ field.
|
||||
* - ZTolerance : tolerance in Z direction. If Z coordinate of a node is close to zero
|
||||
* within a given tolerance, the coordinate is set to zero.
|
||||
* If @a ZTolerance is negative, the node coordinates are kept as is.
|
||||
*/
|
||||
void ExportPartToMED( in SMESH_IDSource meshPart,
|
||||
in string fileName,
|
||||
@ -673,7 +676,8 @@ module SMESH
|
||||
in boolean overwrite,
|
||||
in boolean autoDimension,
|
||||
in GEOM::ListOfFields fields,
|
||||
in string geomAssocFields ) raises (SALOME::SALOME_Exception);
|
||||
in string geomAssocFields,
|
||||
in double ZTolerance) raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Export Mesh to SAUV formatted file
|
||||
|
@ -62,7 +62,8 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
|
||||
myAutoDimension(false),
|
||||
myAddODOnVertices(false),
|
||||
myDoAllInGroups(false),
|
||||
myVersion(-1)
|
||||
myVersion(-1),
|
||||
myZTolerance(-1.)
|
||||
{}
|
||||
|
||||
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, int theVersion)
|
||||
@ -417,6 +418,8 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
|
||||
anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
|
||||
anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
|
||||
if ( myZTolerance > 0 && anIsZDimension )
|
||||
anIsZDimension = (aBounds[5] > myZTolerance || aBounds[4] < -myZTolerance );
|
||||
aSpaceDimension = Max( aMeshDimension, anIsXDimension + anIsYDimension + anIsZDimension );
|
||||
if ( !aSpaceDimension )
|
||||
aSpaceDimension = 3;
|
||||
@ -550,6 +553,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
for(TInt iCoord = 0; iCoord < aSpaceDimension; iCoord++){
|
||||
aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord);
|
||||
}
|
||||
if ( aSpaceDimension == 3 &&
|
||||
-myZTolerance < aTCoordSlice[2] && aTCoordSlice[2] < myZTolerance )
|
||||
aTCoordSlice[2] = 0.;
|
||||
|
||||
// node number
|
||||
int aNodeID = aCoordHelperPtr->GetID();
|
||||
aNodeInfo->SetElemNum( iNode, aNodeID );
|
||||
|
@ -50,6 +50,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
||||
|
||||
void SetFile(const std::string& theFileName, int theVersion=-1);
|
||||
void SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; }
|
||||
void SetZTolerance(double tol) { myZTolerance = tol; }
|
||||
|
||||
static std::string GetVersionString(int theMinor, int theNbDigits=2);
|
||||
|
||||
@ -89,7 +90,8 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
||||
bool myAutoDimension;
|
||||
bool myAddODOnVertices;
|
||||
bool myDoAllInGroups;
|
||||
int myVersion;
|
||||
int myVersion;
|
||||
double myZTolerance;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1407,25 +1407,29 @@ bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
|
||||
* The major version (x, where version is x.y.z) cannot be changed.
|
||||
* \param [in] meshPart - mesh data to export
|
||||
* \param [in] theAutoDimension - if \c true, 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 theAutoDimension is \c false, the space dimension is always 3.
|
||||
* - 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 theAutoDimension is \c false, the space dimension is always 3.
|
||||
* \param [in] theAddODOnVertices - to create 0D elements on all vertices
|
||||
* \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413)
|
||||
* \param [in] ZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
|
||||
* within a given tolerance, the coordinate is set to zero.
|
||||
* If \a ZTolerance is negative, the node coordinates are kept as is.
|
||||
* \return int - mesh index in the file
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESH_Mesh::ExportMED(const char * file,
|
||||
const char* theMeshName,
|
||||
void SMESH_Mesh::ExportMED(const char * file,
|
||||
const char* theMeshName,
|
||||
bool theAutoGroups,
|
||||
int theVersion,
|
||||
const SMESHDS_Mesh* meshPart,
|
||||
bool theAutoDimension,
|
||||
bool theAddODOnVertices,
|
||||
double theZTolerance,
|
||||
bool theAllElemsToGroup)
|
||||
throw(SALOME_Exception)
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
MESSAGE("MED_VERSION:"<< theVersion);
|
||||
SMESH_TRY;
|
||||
@ -1435,7 +1439,8 @@ void SMESH_Mesh::ExportMED(const char * file,
|
||||
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||
myWriter.SetAutoDimension( theAutoDimension );
|
||||
myWriter.AddODOnVertices ( theAddODOnVertices );
|
||||
if ( !theMeshName )
|
||||
myWriter.SetZTolerance ( theZTolerance );
|
||||
if ( !theMeshName )
|
||||
myWriter.SetMeshId ( _id );
|
||||
else {
|
||||
myWriter.SetMeshId ( -1 );
|
||||
@ -1511,7 +1516,7 @@ void SMESH_Mesh::ExportSAUV(const char *file,
|
||||
system(cmd.c_str());
|
||||
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
|
||||
/*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false,
|
||||
/*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
|
||||
/*zTol=*/-1, /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
|
||||
#ifdef WIN32
|
||||
cmd = "%PYTHONBIN% ";
|
||||
#else
|
||||
|
@ -251,13 +251,14 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
*/
|
||||
bool HasDuplicatedGroupNamesMED();
|
||||
|
||||
void ExportMED(const char * theFile,
|
||||
const char* theMeshName = NULL,
|
||||
bool theAutoGroups = true,
|
||||
void ExportMED(const char * theFile,
|
||||
const char* theMeshName = NULL,
|
||||
bool theAutoGroups = true,
|
||||
int theVersion = -1,
|
||||
const SMESHDS_Mesh* theMeshPart = 0,
|
||||
bool theAutoDimension = false,
|
||||
bool theAddODOnVertices = false,
|
||||
double theZTolerance = -1.,
|
||||
bool theAllElemsToGroup = false)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "SMESHGUI_CopyMeshDlg.h"
|
||||
#include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
|
||||
#include "SMESHGUI_DeleteGroupDlg.h"
|
||||
#include "SMESHGUI_DisplayEntitiesDlg.h"
|
||||
#include "SMESHGUI_Displayer.h"
|
||||
#include "SMESHGUI_DuplicateNodesDlg.h"
|
||||
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
|
||||
@ -49,11 +50,15 @@
|
||||
#include "SMESHGUI_FileValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_FilterLibraryDlg.h"
|
||||
#include "SMESHGUI_FilterUtils.h"
|
||||
#include "SMESHGUI_FindElemByPointDlg.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_GroupDlg.h"
|
||||
#include "SMESHGUI_GroupOnShapeDlg.h"
|
||||
#include "SMESHGUI_GroupOpDlg.h"
|
||||
#include "SMESHGUI_GroupUtils.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_Make2DFrom3DOp.h"
|
||||
#include "SMESHGUI_MakeNodeAtPointDlg.h"
|
||||
#include "SMESHGUI_Measurements.h"
|
||||
@ -62,9 +67,12 @@
|
||||
#include "SMESHGUI_MeshOp.h"
|
||||
#include "SMESHGUI_MeshOrderOp.h"
|
||||
#include "SMESHGUI_MeshPatternDlg.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_MultiEditDlg.h"
|
||||
#include "SMESHGUI_NodesDlg.h"
|
||||
#include "SMESHGUI_OffsetDlg.h"
|
||||
#include "SMESHGUI_Operations.h"
|
||||
#include "SMESHGUI_PatternUtils.h"
|
||||
#include "SMESHGUI_Preferences_ScalarBarDlg.h"
|
||||
#include "SMESHGUI_PropertiesDlg.h"
|
||||
#include "SMESHGUI_RemoveElementsDlg.h"
|
||||
@ -74,23 +82,15 @@
|
||||
#include "SMESHGUI_RevolutionDlg.h"
|
||||
#include "SMESHGUI_RotationDlg.h"
|
||||
#include "SMESHGUI_ScaleDlg.h"
|
||||
#include "SMESHGUI_OffsetDlg.h"
|
||||
#include "SMESHGUI_Selection.h"
|
||||
#include "SMESHGUI_SewingDlg.h"
|
||||
#include "SMESHGUI_SingleEditDlg.h"
|
||||
#include "SMESHGUI_SmoothingDlg.h"
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
#include "SMESHGUI_SplitBiQuad.h"
|
||||
#include "SMESHGUI_SymmetryDlg.h"
|
||||
#include "SMESHGUI_TranslationDlg.h"
|
||||
#include "SMESHGUI_TransparencyDlg.h"
|
||||
#include "SMESHGUI_DisplayEntitiesDlg.h"
|
||||
#include "SMESHGUI_SplitBiQuad.h"
|
||||
|
||||
#include "SMESHGUI_FilterUtils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_GroupUtils.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_PatternUtils.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
|
||||
@ -101,38 +101,33 @@
|
||||
#include "SMESH_ActorUtils.h"
|
||||
#include "SMESH_Client.hxx"
|
||||
#include "SMESH_ScalarBarActor.h"
|
||||
#include <SMESH_Comment.hxx>
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_CheckFileDlg.h>
|
||||
#include <SalomeApp_DataObject.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
#include <SalomeApp_Tools.h>
|
||||
|
||||
#include <LightApp_DataOwner.h>
|
||||
#include <LightApp_NameDlg.h>
|
||||
#include <LightApp_Preferences.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <LightApp_UpdateFlags.h>
|
||||
|
||||
#include <SVTK_ViewManager.h>
|
||||
#include <SVTK_ViewModel.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
|
||||
#include <VTKViewer_Algorithm.h>
|
||||
|
||||
#include <QtxFontEdit.h>
|
||||
#include <QtxPopupMgr.h>
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_FileDlg.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SUIT_OverrideCursor.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
|
||||
#include <QtxPopupMgr.h>
|
||||
#include <QtxFontEdit.h>
|
||||
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <SVTK_ViewManager.h>
|
||||
#include <SVTK_ViewModel.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_CheckFileDlg.h>
|
||||
#include <SalomeApp_DataObject.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
#include <SalomeApp_Tools.h>
|
||||
#include <VTKViewer_Algorithm.h>
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
#include <SPlot2d_ViewModel.h>
|
||||
@ -149,13 +144,13 @@
|
||||
// Qt includes
|
||||
// #define INCLUDE_MENUITEM_DEF // VSR commented ????????
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLayout>
|
||||
#include <QListView>
|
||||
#include <QMenu>
|
||||
#include <QTextStream>
|
||||
#include <QListView>
|
||||
#include <QTreeView>
|
||||
#include <QCheckBox>
|
||||
#include <QLayout>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
// BOOST includes
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@ -491,17 +486,11 @@ namespace
|
||||
QDialogButtonBox* btnbox = msgBox.findChild<QDialogButtonBox*>();
|
||||
lt->addWidget(&dontShowCheckBox, lt->rowCount(), lt->columnCount()-1, lt->rowCount(), lt->columnCount());
|
||||
lt->addWidget(btnbox, lt->rowCount(), 0, lt->rowCount(), lt->columnCount());
|
||||
if(msgBox.exec() == QMessageBox::Ok)
|
||||
{
|
||||
if(dontShowCheckBox.checkState() == Qt::Checked)
|
||||
{
|
||||
if ( resMgr )
|
||||
resMgr->setValue( "SMESH", "show_warning", false);
|
||||
}
|
||||
aCheckWarn = false;
|
||||
}
|
||||
else
|
||||
if ( msgBox.exec() != QMessageBox::Ok )
|
||||
return;
|
||||
|
||||
if ( dontShowCheckBox.checkState() == Qt::Checked && resMgr )
|
||||
resMgr->setValue( "SMESH", "show_warning", false);
|
||||
}
|
||||
|
||||
QString aMeshName = anIObject->getName();
|
||||
@ -665,6 +654,7 @@ namespace
|
||||
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
||||
bool toOverwrite = true;
|
||||
bool toFindOutDim = true;
|
||||
double zTol = resMgr ? resMgr->doubleValue( "SMESH", "med_ztolerance", 0. ) : 0.;
|
||||
|
||||
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
|
||||
QString anInitialPath = "";
|
||||
@ -749,28 +739,21 @@ namespace
|
||||
if ( isMED ) {
|
||||
//filters << QObject::tr( "MED_FILES_FILTER" ) + " (*.med)";
|
||||
//QString vmed (aMesh->GetVersionString(-1, 2));
|
||||
//MESSAGE("MED version: " << vmed.toStdString());
|
||||
SMESH::long_array_var mvok = aMesh->GetMEDVersionsCompatibleForAppend();
|
||||
for ( int i = 0; i < mvok->length(); ++i ) // i=0 must correspond to the current version to set the default filter on it
|
||||
{
|
||||
int versionInt = mvok[i];
|
||||
if (i == 0)
|
||||
defaultVersion = versionInt;
|
||||
std::ostringstream vss;
|
||||
vss << versionInt/10;
|
||||
vss << ".";
|
||||
vss << versionInt%10;
|
||||
QString vs = vss.str().c_str();
|
||||
MESSAGE("MED version: " << vs.toStdString());
|
||||
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)", versionInt);
|
||||
}
|
||||
if ( mvok->length() > 0)
|
||||
defaultVersion = mvok[0]; // the current version to set the default filter on it
|
||||
for ( CORBA::ULong i = 0; i < mvok->length(); ++i )
|
||||
{
|
||||
QString vs = (char*)( SMESH_Comment( mvok[i]/10 ) << "." << mvok[i]%10 );
|
||||
MESSAGE("MED version: " << vs.toStdString());
|
||||
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)", mvok[i]);
|
||||
}
|
||||
}
|
||||
else { // isSAUV
|
||||
aFilterMap.insert("All files (*)", -1 );
|
||||
aFilterMap.insert("SAUV files (*.sauv)", defaultVersion ); // 0 = default filter (defaultVersion)
|
||||
aFilterMap.insert("SAUV files (*.sauve)", -1 );
|
||||
}
|
||||
MESSAGE("default version="<< defaultVersion);
|
||||
QStringList filters;
|
||||
QMap<QString, int>::const_iterator it = aFilterMap.begin();
|
||||
QString aDefaultFilter = it.key();
|
||||
@ -787,6 +770,19 @@ namespace
|
||||
if ( fieldSelWdg->GetAllFields( aMeshList, aFieldList ))
|
||||
wdgList.append( fieldSelWdg );
|
||||
|
||||
QWidget* zTolWdg = new QWidget();
|
||||
QCheckBox* zTolCheck = new QCheckBox( QObject::tr( "SMESH_ZTOLERANCE" ), zTolWdg );
|
||||
SMESHGUI_SpinBox* zTolSpin = new SMESHGUI_SpinBox( zTolWdg );
|
||||
QHBoxLayout* zTolLayout = new QHBoxLayout( zTolWdg );
|
||||
zTolLayout->addWidget( zTolCheck );
|
||||
zTolLayout->addWidget( zTolSpin );
|
||||
zTolLayout->setMargin( 0 );
|
||||
zTolSpin->RangeStepAndValidator( 0, 1e+100, 1., "length_precision" );
|
||||
zTolSpin->setValue( zTol );
|
||||
//QObject::connect( zTolCheck, SIGNAL( stateChanged(int)), zTolSpin, SLOT( setEnabled(bool)));
|
||||
zTolCheck->setChecked( resMgr->booleanValue( "SMESH", "enable_ztolerance", false ));
|
||||
wdgList.append( zTolWdg );
|
||||
|
||||
SalomeApp_CheckFileDlg* fd =
|
||||
new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true, wdgList );
|
||||
fd->setWindowTitle( aTitle );
|
||||
@ -812,8 +808,9 @@ namespace
|
||||
fd->setValidator( fv );
|
||||
|
||||
bool is_ok = false;
|
||||
while (!is_ok) {
|
||||
MESSAGE("******* Loop on file dialog ***********");
|
||||
while (!is_ok)
|
||||
{
|
||||
//MESSAGE("******* Loop on file dialog ***********");
|
||||
isOkToWrite =true;
|
||||
if ( fd->exec() )
|
||||
aFilename = fd->selectedFile();
|
||||
@ -822,9 +819,9 @@ namespace
|
||||
break;
|
||||
}
|
||||
aFormat = aFilterMap[fd->selectedNameFilter()];
|
||||
MESSAGE("selected version: " << aFormat << " file: " << aFilename.toUtf8().constData());
|
||||
//MESSAGE("selected version: " << aFormat << " file: " << aFilename.toUtf8().constData());
|
||||
toOverwrite = fv->isOverwrite(aFilename);
|
||||
MESSAGE("toOverwrite:" << toOverwrite);
|
||||
//MESSAGE("toOverwrite:" << toOverwrite);
|
||||
is_ok = true;
|
||||
if ( !aFilename.isEmpty() ) {
|
||||
if( !toOverwrite ) {
|
||||
@ -838,16 +835,16 @@ namespace
|
||||
QObject::tr("SMESH_BUT_YES"),
|
||||
QObject::tr("SMESH_BUT_NO"), 0, 1);
|
||||
if (aRet == 0)
|
||||
{
|
||||
toOverwrite = true;
|
||||
MESSAGE("incompatible MED file version for add, overwrite accepted");
|
||||
}
|
||||
{
|
||||
toOverwrite = true;
|
||||
//MESSAGE("incompatible MED file version for add, overwrite accepted");
|
||||
}
|
||||
else
|
||||
{
|
||||
isOkToWrite = false;
|
||||
is_ok = false;
|
||||
MESSAGE("incompatible MED file version for add, overwrite refused");
|
||||
}
|
||||
{
|
||||
isOkToWrite = false;
|
||||
is_ok = false;
|
||||
//MESSAGE("incompatible MED file version for add, overwrite refused");
|
||||
}
|
||||
}
|
||||
QStringList aMeshNamesCollisionList;
|
||||
SMESH::string_array_var aMeshNames = SMESHGUI::GetSMESHGen()->GetMeshNames( aFilename.toUtf8().constData() );
|
||||
@ -861,7 +858,7 @@ namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !aMeshNamesCollisionList.isEmpty() ) {
|
||||
if( !aMeshNamesCollisionList.isEmpty() ) {
|
||||
isOkToWrite = false;
|
||||
QString aMeshNamesCollisionString = aMeshNamesCollisionList.join( ", " );
|
||||
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||
@ -870,8 +867,8 @@ namespace
|
||||
QObject::tr("SMESH_BUT_YES"),
|
||||
QObject::tr("SMESH_BUT_NO"),
|
||||
QObject::tr("SMESH_BUT_CANCEL"), 0, 2);
|
||||
MESSAGE("answer collision name " << aRet);
|
||||
if (aRet == 0) {
|
||||
MESSAGE("answer collision name " << aRet);
|
||||
if (aRet == 0) {
|
||||
toOverwrite = true;
|
||||
isOkToWrite = true;
|
||||
}
|
||||
@ -881,12 +878,16 @@ namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
MESSAGE(" ****** end of file dialog loop, toOverwrite:" << toOverwrite << " isOkToWrite:" << isOkToWrite);
|
||||
toCreateGroups = fd->IsChecked(0);
|
||||
toFindOutDim = fd->IsChecked(1);
|
||||
zTol = zTolCheck->isChecked() ? zTolSpin->value() : -1;
|
||||
fieldSelWdg->GetSelectedFields();
|
||||
if ( resMgr ) resMgr->setValue( "SMESH", "enable_ztolerance", zTolCheck->isChecked() );
|
||||
|
||||
if ( !fieldSelWdg->parent() )
|
||||
delete fieldSelWdg;
|
||||
if ( !zTolWdg->parent() )
|
||||
delete zTolWdg;
|
||||
delete fd;
|
||||
}
|
||||
else
|
||||
@ -905,12 +906,12 @@ namespace
|
||||
|
||||
try {
|
||||
// Renumbering is not needed since SMDS redesign in V6.2.0 (Nov 2010)
|
||||
// bool Renumber = false;
|
||||
// // PAL 14172 : Check of we have to renumber or not from the preferences before export
|
||||
// if (resMgr)
|
||||
// Renumber= resMgr->booleanValue("renumbering");
|
||||
// if (Renumber){
|
||||
// SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
|
||||
// bool Renumber = false;
|
||||
// // PAL 14172 : Check of we have to renumber or not from the preferences before export
|
||||
// if (resMgr)
|
||||
// Renumber= resMgr->booleanValue("renumbering");
|
||||
// if (Renumber){
|
||||
// SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
|
||||
// aMeshEditor->RenumberNodes();
|
||||
// aMeshEditor->RenumberElements();
|
||||
// if ( SMESHGUI::automaticUpdate() )
|
||||
@ -927,13 +928,14 @@ namespace
|
||||
const GEOM::ListOfFields& fields = aFieldList[ aMeshIndex ].first.in();
|
||||
const QString& geoAssFields = aFieldList[ aMeshIndex ].second;
|
||||
const bool hasFields = ( fields.length() || !geoAssFields.isEmpty() );
|
||||
if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem ))
|
||||
if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem ) && zTol < 0 )
|
||||
aMeshItem->ExportMED( aFilename.toUtf8().data(), toCreateGroups, aFormat,
|
||||
toOverwrite && aMeshIndex == 0, toFindOutDim );
|
||||
else
|
||||
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(), toCreateGroups, aFormat,
|
||||
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(),
|
||||
toCreateGroups, aFormat,
|
||||
toOverwrite && aMeshIndex == 0, toFindOutDim,
|
||||
fields, geoAssFields.toLatin1().data() );
|
||||
fields, geoAssFields.toLatin1().data(), zTol );
|
||||
}
|
||||
}
|
||||
else if ( isSAUV )
|
||||
@ -5117,6 +5119,11 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( exportgroup, "columns", 2 );
|
||||
addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
|
||||
addPreference( tr( "PREF_SHOW_WARN" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "show_warning" );
|
||||
int zTol = addPreference( tr( "PREF_ZTOLERANCE" ), exportgroup, LightApp_Preferences::DblSpin, "SMESH", "med_ztolerance" );
|
||||
setPreferenceProperty( zTol, "precision", 10 );
|
||||
setPreferenceProperty( zTol, "min", 0.0000000001 );
|
||||
setPreferenceProperty( zTol, "max", 1000000.0 );
|
||||
setPreferenceProperty( zTol, "step", 1. );
|
||||
//addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
|
||||
|
||||
int computeGroup = addPreference( tr( "PREF_GROUP_COMPUTE" ), genTab );
|
||||
|
@ -1466,6 +1466,10 @@ Please enter correct values and try again</translation>
|
||||
<source>SMESH_AUTO_DIM</source>
|
||||
<translation>Automatically define space dimension</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ZTOLERANCE</source>
|
||||
<translation>Z tolerance</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_REQUIRED_GROUPS</source>
|
||||
<translation>Create groups of required entities</translation>
|
||||
@ -4584,6 +4588,10 @@ Please, create VTK viewer and try again</translation>
|
||||
<source>PREF_SHOW_WARN</source>
|
||||
<translation>Show warning when exporting group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_ZTOLERANCE</source>
|
||||
<translation>Z tolerance for MED export</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_GROUP_SEGMENT_LENGTH</source>
|
||||
<translation>Automatic parameters</translation>
|
||||
|
@ -3212,7 +3212,8 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
CORBA::Boolean overwrite,
|
||||
CORBA::Boolean autoDimension,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields)
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance)
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
MESSAGE("MED version: "<< version);
|
||||
@ -3263,7 +3264,8 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
{
|
||||
aMeshName = prepareMeshNameAndGroups(file, overwrite);
|
||||
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version,
|
||||
0, autoDimension, /*addODOnVertices=*/have0dField);
|
||||
0, autoDimension, /*addODOnVertices=*/have0dField,
|
||||
ZTolerance);
|
||||
meshDS = _impl->GetMeshDS();
|
||||
}
|
||||
else
|
||||
@ -3281,7 +3283,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
|
||||
SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart );
|
||||
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version,
|
||||
partDS, autoDimension, /*addODOnVertices=*/have0dField);
|
||||
partDS, autoDimension, /*addODOnVertices=*/have0dField, ZTolerance);
|
||||
meshDS = tmpDSDeleter._obj = partDS;
|
||||
}
|
||||
|
||||
@ -3313,7 +3315,9 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
<< overwrite << ", "
|
||||
<< autoDimension << ", "
|
||||
<< goList << ", '"
|
||||
<< ( geomAssocFields ? geomAssocFields : "" ) << "'" << " )";
|
||||
<< ( geomAssocFields ? geomAssocFields : "" ) << "',"
|
||||
<< ZTolerance
|
||||
<< " )";
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
@ -263,7 +263,8 @@ public:
|
||||
CORBA::Boolean overwrite,
|
||||
CORBA::Boolean autoDim,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields) throw (SALOME::SALOME_Exception);
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance) throw (SALOME::SALOME_Exception);
|
||||
void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file) throw (SALOME::SALOME_Exception);
|
||||
void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
|
@ -2225,12 +2225,17 @@ class Mesh(metaclass = MeshMeta):
|
||||
If *autoDimension* is *False*, the space dimension is always 3.
|
||||
fields: list of GEOM fields defined on the shape to mesh.
|
||||
geomAssocFields: each character of this string means a need to export a
|
||||
corresponding field; correspondence between fields and characters is following:
|
||||
corresponding field; correspondence between fields and characters
|
||||
is following:
|
||||
|
||||
- 'v' stands for "_vertices_" field;
|
||||
- 'e' stands for "_edges_" field;
|
||||
- 'f' stands for "_faces_" field;
|
||||
- 's' stands for "_solids_" field.
|
||||
|
||||
zTolerance (float): tolerance in Z direction. If Z coordinate of a node is
|
||||
close to zero within a given tolerance, the coordinate is set to zero.
|
||||
If *ZTolerance* is negative (default), the node coordinates are kept as is.
|
||||
"""
|
||||
# process positional arguments
|
||||
#args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]] # backward compatibility
|
||||
@ -2242,6 +2247,7 @@ class Mesh(metaclass = MeshMeta):
|
||||
autoDimension = args[5] if len(args) > 5 else True
|
||||
fields = args[6] if len(args) > 6 else []
|
||||
geomAssocFields = args[7] if len(args) > 7 else ''
|
||||
z_tolerance = args[8] if len(args) > 8 else -1.
|
||||
# process keywords arguments
|
||||
auto_groups = kwargs.get("auto_groups", auto_groups)
|
||||
minor = kwargs.get("minor", minor)
|
||||
@ -2250,14 +2256,15 @@ class Mesh(metaclass = MeshMeta):
|
||||
autoDimension = kwargs.get("autoDimension", autoDimension)
|
||||
fields = kwargs.get("fields", fields)
|
||||
geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
|
||||
z_tolerance = kwargs.get("zTolerance", z_tolerance)
|
||||
# invoke engine's function
|
||||
if meshPart or fields or geomAssocFields:
|
||||
if meshPart or fields or geomAssocFields or z_tolerance > 0:
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToMED( meshPart, fileName, auto_groups, minor, overwrite, autoDimension,
|
||||
fields, geomAssocFields)
|
||||
fields, geomAssocFields, z_tolerance)
|
||||
else:
|
||||
self.mesh.ExportMED(fileName, auto_groups, minor, overwrite, autoDimension)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user