Salome HOME
0021952: Add an option to write planar meshes as 3D meshes in MED files
authoreap <eap@opencascade.com>
Wed, 5 Jun 2013 15:13:53 +0000 (15:13 +0000)
committereap <eap@opencascade.com>
Wed, 5 Jun 2013 15:13:53 +0000 (15:13 +0000)
14 files changed:
doc/salome/examples/creating_meshes_ex05.py
doc/salome/gui/SMESH/images/meshexportmesh.png
doc/salome/gui/SMESH/input/importing_exporting_meshes.doc
doc/salome/gui/SMESH/input/tui_creating_meshes.doc
idl/SMESH_Mesh.idl
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESH_msg_en.ts
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_SWIG/smeshBuilder.py

index 98e921a06981585e1f09d607d61bea3e9dc4a586..ae1d073b4260139f5deb0c7502f018dae48cbbcd 100644 (file)
@@ -16,23 +16,43 @@ idbox = geompy.addToStudy(box, "box")
 
 # create a mesh
 tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments(7)
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea(800.)
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume(900.)
+tetra.Segment().NumberOfSegments(7)
+tetra.Triangle()
+tetra.Tetrahedron()
 
 # compute the mesh
 tetra.Compute()
 
 # 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
 face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
 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 )
index 57d0a802125ac7ef8cdbcdf3b3d538fc0d635a4b..d2997a47d377640e5ce81f10400db3dfc845987c 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/meshexportmesh.png and b/doc/salome/gui/SMESH/images/meshexportmesh.png differ
index 9b0d032faea32b686e6a7a982d3258bd8232bcc2..6519aa16dc42b4cdb74a8b33b419fde1ee1d8981 100644 (file)
@@ -2,19 +2,22 @@
 
 \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,
-\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>
 
 <ol>
 <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
-your mesh.</li>
+  select the corresponding format (MED, UNV, STL, GMF and CGNS) of the
+  file containing your mesh.</li>
 <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>
 </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>
 
 <ol>
-<li>Select the object you wish to export.</li>
-<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
-contain your exported mesh.</li>
-<li>In the standard <b>Search File</b> select a location for the
-exported file and enter its name.</li>
-<li>Click the \b OK button.</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
+    select the format (MED, UNV, DAT, STL, GMF and CGNS) of the file which will
+    contain your exported mesh.</li>
+  <li>In the standard <b>Search File</b> select a location for the
+    exported file and enter its name.</li>
+  <li>Click the \b OK button.</li>
 </ol>
 
 \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.
 
 */
index d7edad332fa10bff4daf53b00e1def2feb45e140..f1b12e4c41882ede90fe4b6e91c70341ba05fd58 100644 (file)
@@ -20,7 +20,7 @@
 
 <br>
 \anchor tui_editing_mesh
-<h2>Editing of a mesh</h2>
+<h2>Editing a mesh</h2>
 \tui_script{creating_meshes_ex04.py}
 
 <br>
index 96e9269902e34cdc119b476a859359aed20e5109..e7fad87161de477dcce2890136d8475f27dc3464 100644 (file)
@@ -596,19 +596,26 @@ module SMESH
     boolean HasDuplicatedGroupNamesMED();
 
     /*!
-     * Export Mesh to different MED Formats
+     * Export Mesh to a MED Format file
      * @params
      * - file : name of the MED file
      * - 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.
+     *                 the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
+     *                 the typical use is auto_groups=false.
      * - 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
+     * - 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, 
                        in boolean     auto_groups, 
                        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
@@ -617,15 +624,20 @@ module SMESH
      * - file : name of the MED file
      * - 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
+     * - 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, 
                           in string         file, 
                           in boolean        auto_groups,
                           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.
      * The method is kept in order to support old functionality
      */
index a3d934c84077d39a47f4f6518876123e22bdd9ab..9289fb2364a8262a68f12f69973e455ee1974a9c 100644 (file)
@@ -52,7 +52,8 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
   myDoGroupOfFaces (false),
   myDoGroupOfVolumes (false),
   myDoGroupOf0DElems(false),
-  myDoGroupOfBalls(false)
+  myDoGroupOfBalls(false),
+  myAutoDimension(true)
 {}
 
 void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, 
@@ -120,7 +121,8 @@ void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes()
   myDoGroupOfVolumes = true;
 }
 
-namespace{
+namespace
+{
   typedef double (SMDS_MeshNode::* TGetCoord)() const;
   typedef const char* TName;
   typedef const char* TUnit;
@@ -311,12 +313,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     }
 
     // Mesh dimension definition
-    TInt aSpaceDimension;
+    TInt aSpaceDimension = 3;
     TCoordHelperPtr aCoordHelperPtr;
     {
       bool anIsXDimension = false;
       bool anIsYDimension = false;
       bool anIsZDimension = false;
+      if ( myAutoDimension )
       {
         SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
         double aBounds[6];
index 7c02b40f02da34f38c9d55cc9f7ddc9e2401aae1..95daf9fa6827aff7042fd515d3a23007a6a7a672 100644 (file)
@@ -48,6 +48,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
 
   virtual void SetFile(const std::string& theFileName);
   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);
 
   /*! 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 myDoGroupOf0DElems;
   bool myDoGroupOfBalls;
+  bool myAutoDimension;
 };
 
 
index c83737cf79daf4e3f32f9de78fbf5b89eaafce32..8ca54a4092537a0468d89ce16e356aca8bfbf7fb 100644 (file)
@@ -1248,19 +1248,21 @@ void SMESH_Mesh::ExportMED(const char *        file,
                            const char*         theMeshName, 
                            bool                theAutoGroups,
                            int                 theVersion,
-                           const SMESHDS_Mesh* meshPart) 
+                           const SMESHDS_Mesh* meshPart,
+                           bool                theAutoDimension)
   throw(SALOME_Exception)
 {
   Unexpect aCatch(SalomeException);
 
   DriverMED_W_SMESHDS_Mesh myWriter;
-  myWriter.SetFile    ( file, MED::EVersion(theVersion) );
-  myWriter.SetMesh    ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
+  myWriter.SetFile         ( file, MED::EVersion(theVersion) );
+  myWriter.SetMesh         ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
+  myWriter.SetAutoDimension( theAutoDimension );
   if ( !theMeshName ) 
-    myWriter.SetMeshId  ( _id         );
+    myWriter.SetMeshId     ( _id         );
   else {
-    myWriter.SetMeshId  ( -1          );
-    myWriter.SetMeshName( theMeshName );
+    myWriter.SetMeshId     ( -1          );
+    myWriter.SetMeshName   ( theMeshName );
   }
 
   if ( theAutoGroups ) {
index e329e031336add63684b14a373634b4e1dea226b..5dc907eae75084c8ebf3f28af5f169081ff9fc02 100644 (file)
@@ -229,11 +229,12 @@ public:
    */
   bool HasDuplicatedGroupNamesMED();
 
-  void ExportMED(const char *file, 
-                 const char* theMeshName = NULL, 
-                 bool theAutoGroups = true, 
-                 int theVersion = 0,
-                 const SMESHDS_Mesh* meshPart = 0) 
+  void ExportMED(const char *        theFile, 
+                 const char*         theMeshName = NULL, 
+                 bool                theAutoGroups = true, 
+                 int                 theVersion = 0,
+                 const SMESHDS_Mesh* theMeshPart = 0,
+                 bool                theAutoDimension = false)
     throw(SALOME_Exception);
 
   void ExportDAT(const char *        file,
index 0bbbf9bdad90aee8ea7667cc3344fb25f745b7df..414094665dfa83211ef346660e9f0ade9cc6a113 100644 (file)
     if ( resMgr )
       toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
     bool toOverwrite = true;
+    bool toFindOutDim = true;
 
     QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
     QString anInitialPath = "";
                                             anInitialPath + QString("/") + aMeshName,
                                             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
     {
       SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
         if (it.value() == SMESH::MED_V2_2)
           aDefaultFilter = it.key();
       }
+      QStringList checkBoxes;
+      checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM");
 
-      SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
-        ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
+      SalomeApp_CheckFileDlg* fd =
+        new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
       fd->setWindowTitle( aTitle );
       fd->setNameFilters( filters );
       fd->selectNameFilter(aDefaultFilter);
-      fd->SetChecked(toCreateGroups);
+      fd->SetChecked(0,toCreateGroups);
+      fd->SetChecked(1,toFindOutDim);
       if ( !anInitialPath.isEmpty() )
         fd->setDirectory( anInitialPath );
       fd->selectFile(aMeshName);
           }
         }
       }
-      toCreateGroups = fd->IsChecked();
+      toCreateGroups = fd->IsChecked(0);
+      toFindOutDim   = fd->IsChecked(1);
       delete fd;
     }
     else
             SMESH::SMESH_Mesh_var        aMeshItem = aMeshOrGroup->GetMesh();
             if ( aMeshOrGroup->_is_equivalent( aMeshItem ))
               aMeshItem->ExportToMEDX( aFilename.toLatin1().data(), toCreateGroups,
-                                       aFormat, toOverwrite && aMeshIndex == 0 );
+                                       aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
             else
               aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups,
-                                          aFormat, toOverwrite && aMeshIndex == 0 );
+                                          aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
           }
         }
         else if ( isSAUV )
index 0700b59a9e6da7b0b2c28c6cbe9c60040a2c64dc..b2709a1ba400b1c5a0d306632e0d96353a57944d 100644 (file)
@@ -1269,6 +1269,10 @@ Please enter correct values and try again</translation>
         <source>SMESH_AUTO_GROUPS</source>
         <translation>Automatically create groups</translation>
     </message>
+    <message>
+        <source>SMESH_AUTO_DIM</source>
+        <translation>Automatically define space dimension</translation>
+    </message>
     <message>
         <source>SMESH_REQUIRED_GROUPS</source>
         <translation>Create groups of required entities</translation>
index 32f1a980d1dc559beb204c275fa5c39b679530d6..cb9f47f3f2ad21cf65d24b66ddaf60142e60154a 100644 (file)
@@ -2708,7 +2708,8 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char*    file,
 void SMESH_Mesh_i::ExportToMEDX (const char*        file,
                                  CORBA::Boolean     auto_groups,
                                  SMESH::MED_VERSION theVersion,
-                                 CORBA::Boolean     overwrite)
+                                 CORBA::Boolean     overwrite,
+                                 CORBA::Boolean     autoDimension)
   throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
@@ -2717,9 +2718,11 @@ void SMESH_Mesh_i::ExportToMEDX (const char*        file,
 
   string aMeshName = prepareMeshNameAndGroups(file, overwrite);
   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,29 +2851,39 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart,
                                    const char*                 file,
                                    CORBA::Boolean              auto_groups,
                                    ::SMESH::MED_VERSION        version,
-                                   ::CORBA::Boolean            overwrite)
+                                   ::CORBA::Boolean            overwrite,
+                                   ::CORBA::Boolean            autoDimension)
   throw (SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
-  if ( _preMeshInfo )
-    _preMeshInfo->FullLoadFromFile();
+  TPythonDump pyDump;
 
-  PrepareForWriting(file, overwrite);
+  if ( SMESH_Mesh_i * mesh = SMESH::DownCast< SMESH_Mesh_i* >( meshPart ))
+  {
+    mesh->ExportToMEDX( file, auto_groups, version, autoDimension );
+  }
+  else
+  {
+    if ( _preMeshInfo )
+      _preMeshInfo->FullLoadFromFile();
 
-  string aMeshName = "Mesh";
-  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
-  if ( !aStudy->_is_nil() ) {
-    SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
-    if ( !SO->_is_nil() ) {
-      CORBA::String_var name = SO->GetName();
-      aMeshName = name;
+    PrepareForWriting(file, overwrite);
+
+    string aMeshName = "Mesh";
+    SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
+    if ( !aStudy->_is_nil() ) {
+      SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
+      if ( !SO->_is_nil() ) {
+        CORBA::String_var name = SO->GetName();
+        aMeshName = name;
+      }
     }
+    SMESH_MeshPartDS partDS( meshPart );
+    _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS, autoDimension );
   }
-  SMESH_MeshPartDS partDS( meshPart );
-  _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS );
-
-  TPythonDump() << _this() << ".ExportPartToMED( " << meshPart << ", r'" << file << "', "
-                << auto_groups << ", " << version << ", " << overwrite << " )";
+  pyDump << _this() << ".ExportPartToMED( " << meshPart << ", r'" << file << "', "
+         << auto_groups << ", " << version << ", " << overwrite << ", "
+         << autoDimension << " )";
 }
 
 //================================================================================
index f9df1792b3d64a84f05addb399a5d449ebe8bfa3..68d60d0e1dd978afc0b4b98c02fff54f40316568 100644 (file)
@@ -231,7 +231,8 @@ public:
   void ExportToMEDX( const char*        file,
                      CORBA::Boolean     auto_groups,
                      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,
                      CORBA::Boolean     auto_groups,
                      SMESH::MED_VERSION version ) throw (SALOME::SALOME_Exception);
@@ -254,7 +255,8 @@ public:
                        const char*               file,
                        CORBA::Boolean            auto_groups,
                        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,
                        const char*               file) throw (SALOME::SALOME_Exception);
   void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
index 5a753f1bffda14a57f7581eab56ec9ebdfe9cdba..e819c6630eb6a23358ed9e99ef504503302cb423 100644 (file)
@@ -1567,14 +1567,21 @@ class Mesh:
     #  @param version MED format version(MED_V2_1 or MED_V2_2)
     #  @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 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
-    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 isinstance( meshPart, list ):
                 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:
-            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
     #  @param f is the file name