Salome HOME
untabify
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.cxx
index 54d1128231202e2eabea880efd19dabd3e22532c..82c9ef75d47459152d737ecae45e284e86d1c45e 100644 (file)
@@ -23,7 +23,7 @@
 //  File   : SMESH_MeshEditor_i.cxx
 //  Author : Nicolas REJNERI
 //  Module : SMESH
-//
+
 #include "SMESH_MeshEditor_i.hxx"
 
 #include "SMDS_MeshEdge.hxx"
@@ -34,6 +34,8 @@
 #include "SMESH_subMeshEventListener.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_Filter_i.hxx"
+#include "SMESH_subMesh_i.hxx"
+#include "SMESH_Group_i.hxx"
 #include "SMESH_PythonDump.hxx"
 
 #include "utilities.h"
@@ -146,24 +148,26 @@ namespace {
     }
   };// struct TPreviewMesh
 
-  static SMESH_NodeSearcher * myNodeSearcher = 0;
+  static SMESH_NodeSearcher *    theNodeSearcher    = 0;
+  static SMESH_ElementSearcher * theElementSearcher = 0;
 
   //=============================================================================
   /*!
-   * \brief Deleter of myNodeSearcher at any compute event occured
+   * \brief Deleter of theNodeSearcher at any compute event occured
    */
   //=============================================================================
 
-  struct TNodeSearcherDeleter : public SMESH_subMeshEventListener
+  struct TSearchersDeleter : public SMESH_subMeshEventListener
   {
     SMESH_Mesh* myMesh;
     //!< Constructor
-    TNodeSearcherDeleter(): SMESH_subMeshEventListener( false ), // won't be deleted by submesh
-    myMesh(0) {}
-    //!< Delete myNodeSearcher
+    TSearchersDeleter(): SMESH_subMeshEventListener( false ), // won't be deleted by submesh
+                         myMesh(0) {}
+    //!< Delete theNodeSearcher
     static void Delete()
     {
-      if ( myNodeSearcher ) { delete myNodeSearcher; myNodeSearcher = 0; }
+      if ( theNodeSearcher )    delete theNodeSearcher;    theNodeSearcher    = 0;
+      if ( theElementSearcher ) delete theElementSearcher; theElementSearcher = 0;
     }
     typedef map < int, SMESH_subMesh * > TDependsOnMap;
     //!< The meshod called by submesh: do my main job
@@ -175,19 +179,22 @@ namespace {
         Unset( sm->GetFather() );
       }
     }
-    //!< set self on all submeshes and delete myNodeSearcher if other mesh is set
+    //!< set self on all submeshes and delete theNodeSearcher if other mesh is set
     void Set(SMESH_Mesh* mesh)
     {
-      if ( myMesh && myMesh != mesh ) {
-        Delete();
-        Unset( myMesh );
-      }
-      myMesh = mesh;
-      if ( SMESH_subMesh* myMainSubMesh = mesh->GetSubMeshContaining(1) ) {
-        const TDependsOnMap & subMeshes = myMainSubMesh->DependsOn();
-        TDependsOnMap::const_iterator sm;
-        for (sm = subMeshes.begin(); sm != subMeshes.end(); sm++)
-          sm->second->SetEventListener( this, 0, sm->second );
+      if ( myMesh != mesh )
+      {
+        if ( myMesh ) {
+          Delete();
+          Unset( myMesh );
+        }
+        myMesh = mesh;
+        if ( SMESH_subMesh* myMainSubMesh = mesh->GetSubMeshContaining(1) ) {
+          const TDependsOnMap & subMeshes = myMainSubMesh->DependsOn();
+          TDependsOnMap::const_iterator sm;
+          for (sm = subMeshes.begin(); sm != subMeshes.end(); sm++)
+            sm->second->SetEventListener( this, 0, sm->second );
+        }
       }
     }
     //!<  delete self from all submeshes
@@ -201,7 +208,8 @@ namespace {
       }
       myMesh = 0;
     }
-  };
+
+  } theSearchersDeleter;
 
   TCollection_AsciiString mirrorTypeName( SMESH::SMESH_MeshEditor::MirrorType theMirrorType )
   {
@@ -249,7 +257,7 @@ SMESH_MeshEditor_i::~SMESH_MeshEditor_i()
  */
 //================================================================================
 
-void SMESH_MeshEditor_i::initData()
+void SMESH_MeshEditor_i::initData(bool deleteSearchers)
 {
   if ( myPreviewMode ) {
     myPreviewData = new SMESH::MeshPreviewStruct();
@@ -257,7 +265,8 @@ void SMESH_MeshEditor_i::initData()
   else {
     myLastCreatedElems = new SMESH::long_array();
     myLastCreatedNodes = new SMESH::long_array();
-    TNodeSearcherDeleter::Delete();
+    if ( deleteSearchers )
+      TSearchersDeleter::Delete();
   }
 }
 
@@ -268,7 +277,7 @@ void SMESH_MeshEditor_i::initData()
 //=============================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements)
+SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements)
 {
   initData();
 
@@ -406,6 +415,9 @@ CORBA::Long SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
     elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3],
                                 nodes[4], nodes[5], nodes[6], nodes[7]);
   }
+  else if (NbNodes > 2) {
+    elem = GetMeshDS()->AddPolygonalFace(nodes);
+  }
 
   // Update Python script
   TPythonDump() << "faceID = " << this << ".AddFace( " << IDsOfNodes << " )";
@@ -421,8 +433,7 @@ CORBA::Long SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
  *  AddPolygonalFace
  */
 //=============================================================================
-CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace
-                                   (const SMESH::long_array & IDsOfNodes)
+CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace (const SMESH::long_array & IDsOfNodes)
 {
   initData();
 
@@ -432,7 +443,7 @@ CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace
     nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
 
   const SMDS_MeshElement* elem = GetMeshDS()->AddPolygonalFace(nodes);
-  
+
   // Update Python script
   TPythonDump() <<"faceID = "<<this<<".AddPolygonalFace( "<<IDsOfNodes<<" )";
 #ifdef _DEBUG_
@@ -499,9 +510,8 @@ CORBA::Long SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNodes)
  *  AddPolyhedralVolume
  */
 //=============================================================================
-CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume
-                                   (const SMESH::long_array & IDsOfNodes,
-                                    const SMESH::long_array & Quantities)
+CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume (const SMESH::long_array & IDsOfNodes,
+                                                     const SMESH::long_array & Quantities)
 {
   initData();
 
@@ -535,8 +545,7 @@ CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume
  *  AddPolyhedralVolumeByFaces
  */
 //=============================================================================
-CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
-                                   (const SMESH::long_array & IdsOfFaces)
+CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces (const SMESH::long_array & IdsOfFaces)
 {
   initData();
 
@@ -672,10 +681,10 @@ void SMESH_MeshEditor_i::SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
   if ( isOut ) {
 #ifdef _DEBUG_
     MESSAGE ( "FACE " << FaceID << " (" << u << "," << v << ") out of "
-           << " u( " <<  surf.FirstUParameter() 
-           << "," <<  surf.LastUParameter()  
-           << ") v( " <<  surf.FirstVParameter() 
-           << "," <<  surf.LastVParameter() << ")" );
+              << " u( " <<  surf.FirstUParameter() 
+              << "," <<  surf.LastUParameter()  
+              << ") v( " <<  surf.FirstVParameter() 
+              << "," <<  surf.LastVParameter() << ")" );
 #endif    
     THROW_SALOME_CORBA_EXCEPTION("Invalid UV", SALOME::BAD_PARAM);
   }
@@ -746,33 +755,6 @@ void SMESH_MeshEditor_i::SetMeshElementOnShape(CORBA::Long ElementID,
   mesh->SetMeshElementOnShape( elem, ShapeID );
 }
 
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long   NodeID,
-                                            CORBA::Double x,
-                                            CORBA::Double y,
-                                            CORBA::Double z)
-{
-  initData();
-
-  const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
-  if ( !node )
-    return false;
-
-  GetMeshDS()->MoveNode(node, x, y, z);
-
-  // Update Python script
-  TPythonDump() << "isDone = " << this << ".MoveNode( "
-                << NodeID << ", " << x << ", " << y << ", " << z << " )";
-
-  return true;
-}
-
 //=============================================================================
 /*!
  *
@@ -879,10 +861,10 @@ namespace
   //================================================================================
   /*!
    * \brief function for conversion long_array to TIDSortedElemSet
-    * \param IDs - array of IDs
-    * \param aMesh - mesh
-    * \param aMap - collection to fill
-    * \param aType - element type
+   * \param IDs - array of IDs
+   * \param aMesh - mesh
+   * \param aMap - collection to fill
+   * \param aType - element type
    */
   //================================================================================
 
@@ -893,7 +875,9 @@ namespace
   { 
     for (int i=0; i<IDs.length(); i++) {
       CORBA::Long ind = IDs[i];
-      const SMDS_MeshElement * elem = aMesh->FindElement(ind);
+      const SMDS_MeshElement * elem =
+        (aType == SMDSAbs_Node ? aMesh->FindNode(ind)
+         : aMesh->FindElement(ind));
       if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType ))
         aMap.insert( elem );
     }
@@ -1139,14 +1123,14 @@ CORBA::Long SMESH_MeshEditor_i::BestSplit (CORBA::Long                 IDOfQuad,
 //=======================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::Smooth(const SMESH::long_array &              IDsOfElements,
-                             const SMESH::long_array &              IDsOfFixedNodes,
-                             CORBA::Long                            MaxNbOfIterations,
-                             CORBA::Double                          MaxAspectRatio,
-                             SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::Smooth(const SMESH::long_array &              IDsOfElements,
+                           const SMESH::long_array &              IDsOfFixedNodes,
+                           CORBA::Long                            MaxNbOfIterations,
+                           CORBA::Double                          MaxAspectRatio,
+                           SMESH::SMESH_MeshEditor::Smooth_Method Method)
 {
   return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
-                MaxAspectRatio, Method, false );
+                 MaxAspectRatio, Method, false );
 }
 
 
@@ -1156,14 +1140,14 @@ CORBA::Boolean
 //=======================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array &              IDsOfElements,
-                                       const SMESH::long_array &              IDsOfFixedNodes,
-                                       CORBA::Long                            MaxNbOfIterations,
-                                       CORBA::Double                          MaxAspectRatio,
-                                       SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array &              IDsOfElements,
+                                     const SMESH::long_array &              IDsOfFixedNodes,
+                                     CORBA::Long                            MaxNbOfIterations,
+                                     CORBA::Double                          MaxAspectRatio,
+                                     SMESH::SMESH_MeshEditor::Smooth_Method Method)
 {
   return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
-                MaxAspectRatio, Method, true );
+                 MaxAspectRatio, Method, true );
 }
 
 
@@ -1173,11 +1157,11 @@ CORBA::Boolean
 //=======================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr              theObject,
-                                  const SMESH::long_array &              IDsOfFixedNodes,
-                                  CORBA::Long                            MaxNbOfIterations,
-                                  CORBA::Double                          MaxAspectRatio,
-                                  SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr              theObject,
+                                 const SMESH::long_array &              IDsOfFixedNodes,
+                                 CORBA::Long                            MaxNbOfIterations,
+                                 CORBA::Double                          MaxAspectRatio,
+                                 SMESH::SMESH_MeshEditor::Smooth_Method Method)
 {
   return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
                        MaxAspectRatio, Method, false);
@@ -1190,11 +1174,11 @@ CORBA::Boolean
 //=======================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr              theObject,
-                                  const SMESH::long_array &              IDsOfFixedNodes,
-                                  CORBA::Long                            MaxNbOfIterations,
-                                  CORBA::Double                          MaxAspectRatio,
-                                  SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr              theObject,
+                                           const SMESH::long_array &              IDsOfFixedNodes,
+                                           CORBA::Long                            MaxNbOfIterations,
+                                           CORBA::Double                          MaxAspectRatio,
+                                           SMESH::SMESH_MeshEditor::Smooth_Method Method)
 {
   return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
                        MaxAspectRatio, Method, true);
@@ -1208,12 +1192,12 @@ CORBA::Boolean
 //=============================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::smooth(const SMESH::long_array &              IDsOfElements,
-                             const SMESH::long_array &              IDsOfFixedNodes,
-                             CORBA::Long                            MaxNbOfIterations,
-                             CORBA::Double                          MaxAspectRatio,
-                             SMESH::SMESH_MeshEditor::Smooth_Method Method,
-                             bool                                   IsParametric)
+SMESH_MeshEditor_i::smooth(const SMESH::long_array &              IDsOfElements,
+                           const SMESH::long_array &              IDsOfFixedNodes,
+                           CORBA::Long                            MaxNbOfIterations,
+                           CORBA::Double                          MaxAspectRatio,
+                           SMESH::SMESH_MeshEditor::Smooth_Method Method,
+                           bool                                   IsParametric)
 {
   initData();
 
@@ -1328,9 +1312,9 @@ void SMESH_MeshEditor_i::RenumberElements()
 }
 
 //=======================================================================
-  /*!
  * \brief Return groups by their IDs
  */
+/*!
+ * \brief Return groups by their IDs
+ */
 //=======================================================================
 
 SMESH::ListOfGroups* SMESH_MeshEditor_i::getGroups(const std::list<int>* groupIDs)
@@ -1352,12 +1336,13 @@ SMESH_MeshEditor_i::rotationSweep(const SMESH::long_array & theIDsOfElements,
                                   CORBA::Double             theAngleInRadians,
                                   CORBA::Long               theNbOfSteps,
                                   CORBA::Double             theTolerance,
-                                  const bool                theMakeGroups)
+                                  const bool                theMakeGroups,
+                                  const SMDSAbs_ElementType theElementType)
 {
   initData();
 
   TIDSortedElemSet inElements, copyElements;
-  arrayToSet(theIDsOfElements, GetMeshDS(), inElements);
+  arrayToSet(theIDsOfElements, GetMeshDS(), inElements, theElementType);
 
   TIDSortedElemSet* workElements = & inElements;
   TPreviewMesh      tmpMesh( SMDSAbs_Face );
@@ -1381,8 +1366,8 @@ SMESH_MeshEditor_i::rotationSweep(const SMESH::long_array & theIDsOfElements,
 
   ::SMESH_MeshEditor anEditor( mesh );
   ::SMESH_MeshEditor::PGroupIDs groupIds =
-    anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
-                            theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
+      anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
+                              theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
   storeResult(anEditor);
 
   return theMakeGroups ? getGroups(groupIds.get()) : 0;
@@ -1400,10 +1385,9 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
                                        CORBA::Double             theTolerance)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump() << this << ".RotationSweep( "
-                  << theIDsOfElements
-                  << ", axis, "
+                  << theIDsOfElements << ", "
+                  << theAxis << ", "
                   << theAngleInRadians << ", "
                   << theNbOfSteps << ", "
                   << theTolerance << " )";
@@ -1435,12 +1419,11 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
                                                theTolerance,
                                                true);
   if ( !myPreviewMode ) {
-    TPythonDump()<< "axis = " << theAxis;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump<< this << ".RotationSweepMakeGroups( "
-               << theIDsOfElements
-               << ", axis, "
+               << theIDsOfElements << ", "
+               << theAxis << ", "
                << theAngleInRadians << ", "
                << theNbOfSteps << ", "
                << theTolerance << " )";
@@ -1454,16 +1437,15 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
 //=======================================================================
 
 void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
-                                            const SMESH::AxisStruct & theAxis,
-                                            CORBA::Double             theAngleInRadians,
-                                            CORBA::Long               theNbOfSteps,
-                                            CORBA::Double             theTolerance)
+                                             const SMESH::AxisStruct & theAxis,
+                                             CORBA::Double             theAngleInRadians,
+                                             CORBA::Long               theNbOfSteps,
+                                             CORBA::Double             theTolerance)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump() << this << ".RotationSweepObject( "
-                  << theObject
-                  << ", axis, "
+                  << theObject << ", "
+                  << theAxis << ", "
                   << theAngleInRadians << ", "
                   << theNbOfSteps << ", "
                   << theTolerance << " )";
@@ -1497,7 +1479,6 @@ SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theO
                                                theTolerance,
                                                true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
@@ -1562,9 +1543,8 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
 {
   extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump() << this << ".ExtrusionSweep( "
-                  << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
+                  << theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
   }
 }
 
@@ -1575,15 +1555,14 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
 //=======================================================================
 
 void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
-                                             const SMESH::DirStruct &  theStepVector,
-                                             CORBA::Long               theNbOfSteps)
+                                              const SMESH::DirStruct &  theStepVector,
+                                              CORBA::Long               theNbOfSteps)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump() << this << ".ExtrusionSweepObject( "
-                  << theObject << ", stepVector, " << theNbOfSteps << " )";
+                  << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
 }
 
@@ -1599,9 +1578,8 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump() << this << ".ExtrusionSweepObject1D( "
-                  << theObject << ", stepVector, " << theNbOfSteps << " )";
+                  << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
 }
 
@@ -1617,9 +1595,8 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObj
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump() << this << ".ExtrusionSweepObject2D( "
-                  << theObject << ", stepVector, " << theNbOfSteps << " )";
+                  << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
 }
 
@@ -1634,13 +1611,12 @@ SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfEl
                                              CORBA::Long              theNbOfSteps)
 {
   SMESH::ListOfGroups* aGroups = extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
-    
+
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump  << this << ".ExtrusionSweepMakeGroups( "
-                 << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
+                 << theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
   }
   return aGroups;
 }
@@ -1656,13 +1632,12 @@ SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr the
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
-  
+
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump<< this << ".ExtrusionSweepObjectMakeGroups( "
-               << theObject << ", stepVector, " << theNbOfSteps << " )";
+               << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
   return aGroups;
 }
@@ -1680,11 +1655,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
-                << theObject << ", stepVector, " << theNbOfSteps << " )";
+                << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
   return aGroups;
 }
@@ -1702,11 +1676,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
-                << theObject << ", stepVector, " << theNbOfSteps << " )";
+                << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
   return aGroups;
 }
@@ -1749,10 +1722,10 @@ SMESH_MeshEditor_i::advancedExtrusion(const SMESH::long_array & theIDsOfElements
 //=======================================================================
 
 void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
-                                          const SMESH::DirStruct &  theStepVector,
-                                          CORBA::Long               theNbOfSteps,
-                                          CORBA::Long               theExtrFlags,
-                                          CORBA::Double             theSewTolerance)
+                                           const SMESH::DirStruct &  theStepVector,
+                                           CORBA::Long               theNbOfSteps,
+                                           CORBA::Long               theExtrFlags,
+                                           CORBA::Double             theSewTolerance)
 {
   if ( !myPreviewMode ) {
     TPythonDump() << "stepVector = " << theStepVector;
@@ -1784,12 +1757,12 @@ SMESH_MeshEditor_i::AdvancedExtrusionMakeGroups(const SMESH::long_array& theIDsO
                                                 CORBA::Double            theSewTolerance)
 {
   SMESH::ListOfGroups * aGroups = advancedExtrusion( theIDsOfElements,
-                                                    theStepVector,
-                                                    theNbOfSteps,
-                                                    theExtrFlags,
-                                                    theSewTolerance,
-                                                    true);
-  
+                                                     theStepVector,
+                                                     theNbOfSteps,
+                                                     theExtrFlags,
+                                                     theSewTolerance,
+                                                     true);
+
   if ( !myPreviewMode ) {
     TPythonDump() << "stepVector = " << theStepVector;
     TPythonDump aPythonDump;
@@ -1816,13 +1789,13 @@ SMESH_MeshEditor_i::AdvancedExtrusionMakeGroups(const SMESH::long_array& theIDsO
 static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_MeshEditor::Extrusion_Error e )
 {
   switch ( e ) {
-  RETCASE( EXTR_OK );
-  RETCASE( EXTR_NO_ELEMENTS );
-  RETCASE( EXTR_PATH_NOT_EDGE );
-  RETCASE( EXTR_BAD_PATH_SHAPE );
-  RETCASE( EXTR_BAD_STARTING_NODE );
-  RETCASE( EXTR_BAD_ANGLES_NUMBER );
-  RETCASE( EXTR_CANT_GET_TANGENT );
+    RETCASE( EXTR_OK );
+    RETCASE( EXTR_NO_ELEMENTS );
+    RETCASE( EXTR_PATH_NOT_EDGE );
+    RETCASE( EXTR_BAD_PATH_SHAPE );
+    RETCASE( EXTR_BAD_STARTING_NODE );
+    RETCASE( EXTR_BAD_ANGLES_NUMBER );
+    RETCASE( EXTR_CANT_GET_TANGENT );
   }
   return SMESH::SMESH_MeshEditor::EXTR_OK;
 }
@@ -1843,7 +1816,8 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array &   theIDsOfEleme
                                        CORBA::Boolean              theHasRefPoint,
                                        const SMESH::PointStruct &  theRefPoint,
                                        const bool                  theMakeGroups,
-                                       SMESH::SMESH_MeshEditor::Extrusion_Error & theError)
+                                       SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
+                                       const SMDSAbs_ElementType   theElementType)
 {
   initData();
 
@@ -1868,7 +1842,7 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array &   theIDsOfEleme
   }
 
   TIDSortedElemSet elements;
-  arrayToSet(theIDsOfElements, GetMeshDS(), elements);
+  arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
 
   list<double> angles;
   for (int i = 0; i < theAngles.length(); i++) {
@@ -1882,7 +1856,7 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array &   theIDsOfEleme
   ::SMESH_MeshEditor anEditor( myMesh );
   ::SMESH_MeshEditor::Extrusion_Error error =
       anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
-                                    theHasAngles, angles,
+                                    theHasAngles, angles, false,
                                     theHasRefPoint, refPnt, theMakeGroups );
   storeResult(anEditor);
   theError = convExtrError( error );
@@ -1903,34 +1877,28 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array &   theIDsOfEleme
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Extrusion_Error
-  SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array &   theIDsOfElements,
-                                        SMESH::SMESH_Mesh_ptr       thePathMesh,
-                                        GEOM::GEOM_Object_ptr       thePathShape,
-                                        CORBA::Long                 theNodeStart,
-                                        CORBA::Boolean              theHasAngles,
-                                        const SMESH::double_array & theAngles,
-                                        CORBA::Boolean              theHasRefPoint,
-                                        const SMESH::PointStruct &  theRefPoint)
+SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array &   theIDsOfElements,
+                                       SMESH::SMESH_Mesh_ptr       thePathMesh,
+                                       GEOM::GEOM_Object_ptr       thePathShape,
+                                       CORBA::Long                 theNodeStart,
+                                       CORBA::Boolean              theHasAngles,
+                                       const SMESH::double_array & theAngles,
+                                       CORBA::Boolean              theHasRefPoint,
+                                       const SMESH::PointStruct &  theRefPoint)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "rotAngles = " << theAngles;
-
-    if ( theHasRefPoint )
-      TPythonDump() << "refPoint = SMESH.PointStruct( "
-                    << theRefPoint.x << ", "
-                    << theRefPoint.y << ", "
-                    << theRefPoint.z << " )";
-    else
-      TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-
     TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
                   << theIDsOfElements << ", "
                   << thePathMesh      << ", "
                   << thePathShape     << ", "
                   << theNodeStart     << ", "
                   << theHasAngles     << ", "
-                  << "rotAngles"      << ", "
-                  << theHasRefPoint   << ", refPoint )";
+                  << theAngles        << ", "
+                  << theHasRefPoint   << ", "
+                  << "SMESH.PointStruct( "
+                  << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+                  << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+                  << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   SMESH::SMESH_MeshEditor::Extrusion_Error anError;
   extrusionAlongPath( theIDsOfElements,
@@ -1962,24 +1930,18 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObje
                                              const SMESH::PointStruct &  theRefPoint)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "rotAngles = " << theAngles;
-
-    if ( theHasRefPoint )
-      TPythonDump() << "refPoint = SMESH.PointStruct( "
-                    << theRefPoint.x << ", "
-                    << theRefPoint.y << ", "
-                    << theRefPoint.z << " )";
-    else
-      TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-
     TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
                   << theObject        << ", "
                   << thePathMesh      << ", "
                   << thePathShape     << ", "
                   << theNodeStart     << ", "
                   << theHasAngles     << ", "
-                  << "rotAngles"      << ", "
-                  << theHasRefPoint   << ", refPoint )";
+                  << theAngles        << ", "
+                  << theHasRefPoint   << ", "
+                  << "SMESH.PointStruct( "
+                  << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+                  << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+                  << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   SMESH::SMESH_MeshEditor::Extrusion_Error anError;
   SMESH::long_array_var anElementsId = theObject->GetIDs();
@@ -1996,7 +1958,6 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObje
   return anError;
 }
 
-
 //=======================================================================
 //function : ExtrusionAlongPathMakeGroups
 //purpose  : 
@@ -2013,16 +1974,16 @@ SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array&   theI
                                                  const SMESH::PointStruct&  theRefPoint,
                                                  SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
 {
-    SMESH::ListOfGroups * aGroups =  extrusionAlongPath( theIDsOfElements,
-                                                         thePathMesh,
-                                                         thePathShape,
-                                                         theNodeStart,
-                                                         theHasAngles,
-                                                         theAngles,
-                                                         theHasRefPoint,
-                                                         theRefPoint,
-                                                         true,
-                                                         Error);
+  SMESH::ListOfGroups * aGroups =  extrusionAlongPath( theIDsOfElements,
+                                                       thePathMesh,
+                                                       thePathShape,
+                                                       theNodeStart,
+                                                       theHasAngles,
+                                                       theAngles,
+                                                       theHasRefPoint,
+                                                       theRefPoint,
+                                                       true,
+                                                       Error);
   if ( !myPreviewMode ) {
     TPythonDump() << "rotAngles = " << theAngles;
 
@@ -2043,15 +2004,19 @@ SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array&   theI
       aPythonDump << ", error)";
     else
       aPythonDump <<"error";
-    
+
     aPythonDump<<" = "<< this << ".ExtrusionAlongPathMakeGroups( "
                << theIDsOfElements << ", "
                << thePathMesh      << ", "
                << thePathShape     << ", "
                << theNodeStart     << ", "
                << theHasAngles     << ", "
-               << "rotAngles"      << ", "
-               << theHasRefPoint   << ", refPoint )";
+               << theAngles        << ", "
+               << theHasRefPoint   << ", "
+               << "SMESH.PointStruct( "
+               << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   return aGroups;
 }
@@ -2083,18 +2048,8 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
                                                       theRefPoint,
                                                       true,
                                                       Error);
-  
-  if ( !myPreviewMode ) {
-    TPythonDump() << "rotAngles = " << theAngles;
 
-    if ( theHasRefPoint )
-      TPythonDump() << "refPoint = SMESH.PointStruct( "
-                    << theRefPoint.x << ", "
-                    << theRefPoint.y << ", "
-                    << theRefPoint.z << " )";
-    else
-      TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-    
+  if ( !myPreviewMode ) {
     bool isDumpGroups = aGroups && aGroups->length() > 0;
     TPythonDump aPythonDump;
     if(isDumpGroups) {
@@ -2111,8 +2066,12 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
                 << thePathShape     << ", "
                 << theNodeStart     << ", "
                 << theHasAngles     << ", "
-                << "rotAngles"      << ", "
-                << theHasRefPoint   << ", refPoint )";
+                << theAngles        << ", "
+                << theHasRefPoint   << ", "
+                << "SMESH.PointStruct( "
+                << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+                << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+                << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   return aGroups;
 }
@@ -2121,10 +2080,10 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
 /*!
  * \brief Compute rotation angles for ExtrusionAlongPath as linear variation
  * of given angles along path steps
 * \param PathMesh mesh containing a 1D sub-mesh on the edge, along 
 *                which proceeds the extrusion
 * \param PathShape is shape(edge); as the mesh can be complex, the edge 
 *                 is used to define the sub-mesh for the path
+ * \param PathMesh mesh containing a 1D sub-mesh on the edge, along 
+ *                which proceeds the extrusion
+ * \param PathShape is shape(edge); as the mesh can be complex, the edge 
+ *                 is used to define the sub-mesh for the path
  */
 //================================================================================
 
@@ -2164,7 +2123,7 @@ SMESH_MeshEditor_i::LinearAnglesVariation(SMESH::SMESH_Mesh_ptr       thePathMes
           int iP = int( angPrevFloor );
           double angPrevCeil = ceil(angPrev);
           angle = ( angPrevCeil - angPrev ) * theAngles[ iP ];
-          
+
           int iC = int( angCurFloor );
           if ( iC < nbAngles )
             angle += ( angCur - angCurFloor ) * theAngles[ iC ];
@@ -2259,9 +2218,9 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array &           theIDsOfElem
 //=======================================================================
 
 void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObject,
-                                     const SMESH::AxisStruct &           theAxis,
-                                     SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
-                                     CORBA::Boolean                      theCopy)
+                                      const SMESH::AxisStruct &           theAxis,
+                                      SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+                                      CORBA::Boolean                      theCopy)
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".MirrorObject( "
@@ -2286,12 +2245,11 @@ SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array&            theIDsO
 {
   SMESH::ListOfGroups * aGroups = mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
   if ( !myPreviewMode ) {
-    TPythonDump()<<"axis = "<<theMirror;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".MirrorMakeGroups( "
                 << theIDsOfElements << ", "
-                << "axis, "
+                << theMirror << ", "
                 << mirrorTypeName(theMirrorType) << " )";
   }
   return aGroups;
@@ -2310,12 +2268,11 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           t
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = mirror(anElementsId, theMirror, theMirrorType, true, true);
   if ( !myPreviewMode ) {
-    TPythonDump()<<"axis = "<<theMirror;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".MirrorObjectMakeGroups( "
                 << theObject << ", "
-                << "axis, "
+                << theMirror << ", "
                 << mirrorTypeName(theMirrorType) << " )";
   }
   return aGroups;
@@ -2337,7 +2294,7 @@ SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array&            theIDsOfE
   SMESH::SMESH_Mesh_var mesh;
   { // open new scope to dump "MakeMesh" command
     // and then "GetGroups" using SMESH_Mesh::GetGroups()
-    
+
     TPythonDump pydump; // to prevent dump at mesh creation
 
     mesh = makeMesh( theMeshName );
@@ -2347,7 +2304,7 @@ SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array&            theIDsOfE
              false, theCopyGroups, & mesh_i->GetImpl());
       mesh_i->CreateGroupServants();
     }
-    
+
     if ( !myPreviewMode ) {
       pydump << mesh << " = " << this << ".MirrorMakeMesh( "
              << theIDsOfElements << ", "
@@ -2361,7 +2318,7 @@ SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array&            theIDsOfE
   //dump "GetGroups"
   if(!myPreviewMode && mesh_i)
     mesh_i->GetGroups();
-  
+
   return mesh._retn();
 }
 
@@ -2381,7 +2338,7 @@ SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           the
   SMESH::SMESH_Mesh_var mesh;
   { // open new scope to dump "MakeMesh" command
     // and then "GetGroups" using SMESH_Mesh::GetGroups()
-    
+
     TPythonDump pydump; // to prevent dump at mesh creation
 
     mesh = makeMesh( theMeshName );
@@ -2406,7 +2363,7 @@ SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           the
   //dump "GetGroups"
   if(!myPreviewMode && mesh_i)
     mesh_i->GetGroups();
-  
+
   return mesh._retn();
 }
 
@@ -2451,10 +2408,9 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
                                    CORBA::Boolean            theCopy)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "vector = " << theVector;
     TPythonDump() << this << ".Translate( "
-                  << theIDsOfElements
-                  << ", vector, "
+                  << theIDsOfElements << ", "
+                  << theVector << ", "
                   << theCopy << " )";
   }
   translate(theIDsOfElements,
@@ -2469,13 +2425,13 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
 //=======================================================================
 
 void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
-                                        const SMESH::DirStruct &  theVector,
-                                        CORBA::Boolean            theCopy)
+                                         const SMESH::DirStruct &  theVector,
+                                         CORBA::Boolean            theCopy)
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".TranslateObject( "
-                  << theObject
-                  << ", vector, "
+                  << theObject << ", "
+                  << theVector << ", "
                   << theCopy << " )";
   }
   SMESH::long_array_var anElementsId = theObject->GetIDs();
@@ -2496,12 +2452,11 @@ SMESH_MeshEditor_i::TranslateMakeGroups(const SMESH::long_array& theIDsOfElement
 {
   SMESH::ListOfGroups * aGroups = translate(theIDsOfElements,theVector,true,true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "vector = " << theVector;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".TranslateMakeGroups( "
-                << theIDsOfElements
-                << ", vector )";
+                << theIDsOfElements << ", "
+                << theVector << " )";
   }
   return aGroups;
 }
@@ -2517,15 +2472,14 @@ SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObjec
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = translate(anElementsId, theVector, true, true);
-  
+
   if ( !myPreviewMode ) {
 
-    TPythonDump() << "vector = " << theVector;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".TranslateObjectMakeGroups( "
-                << theObject
-                << ", vector )";
+                << theObject << ", "
+                << theVector << " )";
   }
   return aGroups;
 }
@@ -2543,21 +2497,21 @@ SMESH_MeshEditor_i::TranslateMakeMesh(const SMESH::long_array& theIDsOfElements,
 {
   SMESH_Mesh_i* mesh_i;
   SMESH::SMESH_Mesh_var mesh;
-  
+
   { // open new scope to dump "MakeMesh" command
     // and then "GetGroups" using SMESH_Mesh::GetGroups()
 
     TPythonDump pydump; // to prevent dump at mesh creation
-    
+
     mesh = makeMesh( theMeshName );
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-    
+
     if ( mesh_i ) {
       translate(theIDsOfElements, theVector,
                 false, theCopyGroups, & mesh_i->GetImpl());
       mesh_i->CreateGroupServants();
     }
-    
+
     if ( !myPreviewMode ) {
       pydump << mesh << " = " << this << ".TranslateMakeMesh( "
              << theIDsOfElements << ", "
@@ -2566,11 +2520,11 @@ SMESH_MeshEditor_i::TranslateMakeMesh(const SMESH::long_array& theIDsOfElements,
              << theMeshName << "' )";
     }
   }
-  
+
   //dump "GetGroups"
   if(!myPreviewMode && mesh_i)
     mesh_i->GetGroups();
-  
+
   return mesh._retn();
 }
 
@@ -2589,11 +2543,11 @@ SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
   SMESH::SMESH_Mesh_var mesh;
   { // open new scope to dump "MakeMesh" command
     // and then "GetGroups" using SMESH_Mesh::GetGroups()
-    
+
     TPythonDump pydump; // to prevent dump at mesh creation
     mesh = makeMesh( theMeshName );
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-    
+
     if ( mesh_i ) {
       SMESH::long_array_var anElementsId = theObject->GetIDs();
       translate(anElementsId, theVector,
@@ -2608,11 +2562,11 @@ SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
              << theMeshName << "' )";
     }
   }
-  
+
   //dump "GetGroups"
   if(!myPreviewMode && mesh_i)
     mesh_i->GetGroups();
-  
+
   return mesh._retn();
 }
 
@@ -2661,10 +2615,9 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
                                 CORBA::Boolean            theCopy)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump() << this << ".Rotate( "
-                  << theIDsOfElements
-                  << ", axis, "
+                  << theIDsOfElements << ", "
+                  << theAxis << ", "
                   << theAngle << ", "
                   << theCopy << " )";
   }
@@ -2681,15 +2634,14 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
 //=======================================================================
 
 void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
-                                     const SMESH::AxisStruct & theAxis,
-                                     CORBA::Double             theAngle,
-                                     CORBA::Boolean            theCopy)
+                                      const SMESH::AxisStruct & theAxis,
+                                      CORBA::Double             theAngle,
+                                      CORBA::Boolean            theCopy)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump() << this << ".RotateObject( "
-                  << theObject
-                  << ", axis, "
+                  << theObject << ", "
+                  << theAxis << ", "
                   << theAngle << ", "
                   << theCopy << " )";
   }
@@ -2713,12 +2665,11 @@ SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
 {
   SMESH::ListOfGroups * aGroups =  rotate(theIDsOfElements,theAxis,theAngle,true,true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".RotateMakeGroups( "
-                << theIDsOfElements
-                << ", axis, "
+                << theIDsOfElements << ", "
+                << theAxis << ", "
                 << theAngle << " )";
   }
   return aGroups;
@@ -2736,15 +2687,14 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups =  rotate(anElementsId,theAxis,theAngle,true,true);
+
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump aPythonDump;
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".RotateObjectMakeGroups( "
-                  << theObject
-                  << ", axis, "
-                  << theAngle << " )";
+                << theObject << ", "
+                << theAxis << ", "
+                << theAngle << " )";
   }
   return aGroups;
 }
@@ -2766,12 +2716,12 @@ SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
 
   { // open new scope to dump "MakeMesh" command
     // and then "GetGroups" using SMESH_Mesh::GetGroups()
-    
+
     TPythonDump pydump; // to prevent dump at mesh creation
 
     mesh = makeMesh( theMeshName );
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-    
+
     if ( mesh_i ) {
       rotate(theIDsOfElements, theAxis, theAngleInRadians,
              false, theCopyGroups, & mesh_i->GetImpl());
@@ -2786,11 +2736,11 @@ SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
              << theMeshName << "' )";
     }
   }
-  
+
   //dump "GetGroups"
   if(!myPreviewMode && mesh_i)
     mesh_i->GetGroups();
-  
+
   return mesh._retn();
 }
 
@@ -2808,14 +2758,14 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
 {
   SMESH::SMESH_Mesh_var mesh;
   SMESH_Mesh_i* mesh_i;
-  
+
   {// open new scope to dump "MakeMesh" command
    // and then "GetGroups" using SMESH_Mesh::GetGroups()
-    
+
     TPythonDump pydump; // to prevent dump at mesh creation
     mesh = makeMesh( theMeshName );
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-    
+
     if (mesh_i ) {
       SMESH::long_array_var anElementsId = theObject->GetIDs();
       rotate(anElementsId, theAxis, theAngleInRadians,
@@ -2831,11 +2781,11 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
              << theMeshName << "' )";
     }
   }
-  
+
   //dump "GetGroups"
   if(!myPreviewMode && mesh_i)
     mesh_i->GetGroups();
-  
+
   return mesh._retn();
 }
 
@@ -2884,7 +2834,7 @@ void SMESH_MeshEditor_i::FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr
   set<const SMDS_MeshNode*> nodes;
 
   if ( !CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(theObject)) &&
-      SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) {
+       SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) {
     for(int i = 0; i < aElementsId->length(); i++) {
       CORBA::Long ind = aElementsId[i];
       const SMDS_MeshNode * elem = aMesh->FindNode(ind);
@@ -2903,13 +2853,13 @@ void SMESH_MeshEditor_i::FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr
       }
     }
   }
-    
-  
+
+
   ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
   ::SMESH_MeshEditor anEditor( myMesh );
   if(!nodes.empty())
     anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
-  
+
   GroupsOfNodes = new SMESH::array_of_long_array;
   GroupsOfNodes->length( aListOfListOfNodes.size() );
   ::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
@@ -2969,11 +2919,11 @@ void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfN
 //purpose  :
 //=======================================================================
 void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr      theObject,
-                                          SMESH::array_of_long_array_out GroupsOfElementsID)
+                                           SMESH::array_of_long_array_out GroupsOfElementsID)
 {
   initData();
   if ( !(!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(theObject)) &&
-        SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) ) {
+         SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) ) {
     typedef list<int> TListOfIDs;
     set<const SMDS_MeshElement*> elems;
     SMESH::long_array_var aElementsId = theObject->GetIDs();
@@ -2983,7 +2933,7 @@ void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr      theObj
       CORBA::Long anID = aElementsId[i];
       const SMDS_MeshElement * elem = aMesh->FindElement(anID);
       if (elem) {
-       elems.insert(elem);
+        elems.insert(elem);
       }
     }
 
@@ -3001,12 +2951,12 @@ void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr      theObj
       aGroup.length( listOfIDs.size() );
       TListOfIDs::iterator idIt = listOfIDs.begin();
       for (int k = 0; idIt != listOfIDs.end(); ++idIt, ++k ) {
-       aGroup[ k ] = *idIt;
+        aGroup[ k ] = *idIt;
       }
     }
 
-  TPythonDump() << "equal_elements = " << this << ".FindEqualElements( "
-                <<theObject<<" )";
+    TPythonDump() << "equal_elements = " << this << ".FindEqualElements( "
+                  <<theObject<<" )";
   }
 }
 
@@ -3059,6 +3009,61 @@ void SMESH_MeshEditor_i::MergeEqualElements()
   TPythonDump() << this << ".MergeEqualElements()";
 }
 
+//=============================================================================
+/*!
+ * Move the node to a given point
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long   NodeID,
+                                            CORBA::Double x,
+                                            CORBA::Double y,
+                                            CORBA::Double z)
+{
+  initData(/*deleteSearchers=*/false);
+
+  const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
+  if ( !node )
+    return false;
+
+  if ( theNodeSearcher )
+    theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+  if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
+    theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
+  else
+    GetMeshDS()->MoveNode(node, x, y, z);
+
+  // Update Python script
+  TPythonDump() << "isDone = " << this << ".MoveNode( "
+                << NodeID << ", " << x << ", " << y << ", " << z << " )";
+
+  return true;
+}
+
+//================================================================================
+/*!
+ * \brief Return ID of node closest to a given point
+ */
+//================================================================================
+
+CORBA::Long SMESH_MeshEditor_i::FindNodeClosestTo(CORBA::Double x,
+                                                  CORBA::Double y,
+                                                  CORBA::Double z)
+{
+  theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+  if ( !theNodeSearcher ) {
+    ::SMESH_MeshEditor anEditor( myMesh );
+    theNodeSearcher = anEditor.GetNodeSearcher();
+  }
+  gp_Pnt p( x,y,z );
+  if ( const SMDS_MeshNode* node = theNodeSearcher->FindClosestTo( p ))
+    return node->GetID();
+
+  return 0;
+}
+
 //================================================================================
 /*!
  * \brief If the given ID is a valid node ID (nodeID > 0), just move this node, else
@@ -3071,24 +3076,24 @@ CORBA::Long SMESH_MeshEditor_i::MoveClosestNodeToPoint(CORBA::Double x,
                                                        CORBA::Double z,
                                                        CORBA::Long   theNodeID)
 {
-  // We keep myNodeSearcher until any mesh modification:
-  // 1) initData() deletes myNodeSearcher at any edition,
-  // 2) TNodeSearcherDeleter - at any mesh compute event and mesh change
+  // We keep theNodeSearcher until any mesh modification:
+  // 1) initData() deletes theNodeSearcher at any edition,
+  // 2) TSearchersDeleter - at any mesh compute event and mesh change
 
-  initData();
+  initData(/*deleteSearchers=*/false);
+
+  theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
 
   int nodeID = theNodeID;
   const SMDS_MeshNode* node = GetMeshDS()->FindNode( nodeID );
-  if ( !node )
+  if ( !node ) // preview moving node
   {
-    static TNodeSearcherDeleter deleter;
-    deleter.Set( myMesh );
-    if ( !myNodeSearcher ) {
+    if ( !theNodeSearcher ) {
       ::SMESH_MeshEditor anEditor( myMesh );
-      myNodeSearcher = anEditor.GetNodeSearcher();
+      theNodeSearcher = anEditor.GetNodeSearcher();
     }
     gp_Pnt p( x,y,z );
-    node = myNodeSearcher->FindClosestTo( p );
+    node = theNodeSearcher->FindClosestTo( p );
   }
   if ( node ) {
     nodeID = node->GetID();
@@ -3112,6 +3117,10 @@ CORBA::Long SMESH_MeshEditor_i::MoveClosestNodeToPoint(CORBA::Double x,
       ::SMESH_MeshEditor anEditor( & tmpMesh );
       storeResult( anEditor );
     }
+    else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
+    {
+      theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
+    }
     else
     {
       GetMeshDS()->MoveNode(node, x, y, z);
@@ -3127,6 +3136,44 @@ CORBA::Long SMESH_MeshEditor_i::MoveClosestNodeToPoint(CORBA::Double x,
   return nodeID;
 }
 
+//=======================================================================
+/*!
+ * Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes
+ */
+//=======================================================================
+
+SMESH::long_array* SMESH_MeshEditor_i::FindElementsByPoint(CORBA::Double      x,
+                                                           CORBA::Double      y,
+                                                           CORBA::Double      z,
+                                                           SMESH::ElementType type)
+{
+  SMESH::long_array_var res = new SMESH::long_array;
+  vector< const SMDS_MeshElement* > foundElems;
+
+  theSearchersDeleter.Set( myMesh );
+  if ( !theElementSearcher ) {
+    ::SMESH_MeshEditor anEditor( myMesh );
+    theElementSearcher = anEditor.GetElementSearcher();
+  }
+  theElementSearcher->FindElementsByPoint( gp_Pnt( x,y,z ),
+                                           SMDSAbs_ElementType( type ),
+                                           foundElems);
+  res->length( foundElems.size() );
+  for ( int i = 0; i < foundElems.size(); ++i )
+    res[i] = foundElems[i]->GetID();
+
+  if ( !myPreviewMode ) // call from tui
+    TPythonDump() << res << " = " << this << ".FindElementsByPoint( "
+                  << x << ", "
+                  << y << ", "
+                  << z << ", "
+                  << type << " )";
+
+  return res._retn();
+}
+
 //=======================================================================
 //function : convError
 //purpose  :
@@ -3137,16 +3184,16 @@ CORBA::Long SMESH_MeshEditor_i::MoveClosestNodeToPoint(CORBA::Double x,
 static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e )
 {
   switch ( e ) {
-  RETCASE( SEW_OK );
-  RETCASE( SEW_BORDER1_NOT_FOUND );
-  RETCASE( SEW_BORDER2_NOT_FOUND );
-  RETCASE( SEW_BOTH_BORDERS_NOT_FOUND );
-  RETCASE( SEW_BAD_SIDE_NODES );
-  RETCASE( SEW_VOLUMES_TO_SPLIT );
-  RETCASE( SEW_DIFF_NB_OF_ELEMENTS );
-  RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
-  RETCASE( SEW_BAD_SIDE1_NODES );
-  RETCASE( SEW_BAD_SIDE2_NODES );
+    RETCASE( SEW_OK );
+    RETCASE( SEW_BORDER1_NOT_FOUND );
+    RETCASE( SEW_BORDER2_NOT_FOUND );
+    RETCASE( SEW_BOTH_BORDERS_NOT_FOUND );
+    RETCASE( SEW_BAD_SIDE_NODES );
+    RETCASE( SEW_VOLUMES_TO_SPLIT );
+    RETCASE( SEW_DIFF_NB_OF_ELEMENTS );
+    RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
+    RETCASE( SEW_BAD_SIDE1_NODES );
+    RETCASE( SEW_BAD_SIDE2_NODES );
   }
   return SMESH::SMESH_MeshEditor::SEW_OK;
 }
@@ -3157,14 +3204,14 @@ static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Se
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Sew_Error
-  SMESH_MeshEditor_i::SewFreeBorders(CORBA::Long FirstNodeID1,
-                                     CORBA::Long SecondNodeID1,
-                                     CORBA::Long LastNodeID1,
-                                     CORBA::Long FirstNodeID2,
-                                     CORBA::Long SecondNodeID2,
-                                     CORBA::Long LastNodeID2,
-                                     CORBA::Boolean CreatePolygons,
-                                     CORBA::Boolean CreatePolyedrs)
+SMESH_MeshEditor_i::SewFreeBorders(CORBA::Long FirstNodeID1,
+                                   CORBA::Long SecondNodeID1,
+                                   CORBA::Long LastNodeID1,
+                                   CORBA::Long FirstNodeID2,
+                                   CORBA::Long SecondNodeID2,
+                                   CORBA::Long LastNodeID2,
+                                   CORBA::Boolean CreatePolygons,
+                                   CORBA::Boolean CreatePolyedrs)
 {
   initData();
 
@@ -3386,9 +3433,9 @@ SMESH_MeshEditor_i::SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
 //================================================================================
 /*!
  * \brief Set new nodes for given element
 * \param ide - element id
 * \param newIDs - new node ids
 * \retval CORBA::Boolean - true if result is OK
+ * \param ide - element id
+ * \param newIDs - new node ids
+ * \retval CORBA::Boolean - true if result is OK
  */
 //================================================================================
 
@@ -3419,11 +3466,11 @@ CORBA::Boolean SMESH_MeshEditor_i::ChangeElemNodes(CORBA::Long ide,
 
   return GetMeshDS()->ChangeElementNodes( elem, & aNodes[0], nbn1+1 );
 }
-  
+
 //================================================================================
 /*!
  * \brief Update myLastCreated* or myPreviewData
 * \param anEditor - it contains last modification results
+ * \param anEditor - it contains last modification results
  */
 //================================================================================
 
@@ -3481,8 +3528,8 @@ void SMESH_MeshEditor_i::storeResult(::SMESH_MeshEditor& anEditor)
       /*if (aMeshElem->GetType() == SMDSAbs_Volume) {
         aType = SMDSAbs_Node;
         isPoly = false;
-      }
-      else*/ {
+        }
+        else*/ {
         aType = aMeshElem->GetType();
         isPoly = aMeshElem->IsPoly();
       }
@@ -3500,7 +3547,7 @@ void SMESH_MeshEditor_i::storeResult(::SMESH_MeshEditor& anEditor)
     myPreviewData->elementConnectivities.length(aNodesConnectivity.size());
     for( int i = 0; aConnIter != aNodesConnectivity.end(); aConnIter++, i++ )
       myPreviewData->elementConnectivities[i] = *aConnIter;
-    
+
     return;
   }
 
@@ -3534,7 +3581,7 @@ SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData()
 //================================================================================
 /*!
  * \brief Returns list of it's IDs of created nodes
 * \retval SMESH::long_array* - list of node ID
+ * \retval SMESH::long_array* - list of node ID
  */
 //================================================================================
 
@@ -3546,7 +3593,7 @@ SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedNodes()
 //================================================================================
 /*!
  * \brief Returns list of it's IDs of created elements
 * \retval SMESH::long_array* - list of elements' ID
+ * \retval SMESH::long_array* - list of elements' ID
  */
 //================================================================================
 
@@ -3599,9 +3646,9 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName)
 
 //=======================================================================
 //function : DumpGroupsList
-//purpose  : 
+//purpose  :
 //=======================================================================
-void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPython, 
+void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump &               theDumpPython, 
                                         const SMESH::ListOfGroups * theGroupList)
 {
   bool isDumpGroupList = theGroupList && theGroupList->length() > 0;
@@ -3609,3 +3656,252 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPython,
     theDumpPython << theGroupList << " = ";
   }
 }
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  \param theElems - the list of elements (edges or faces) to be replicated
+  The nodes for duplication could be found from these elements
+  \param theNodesNot - list of nodes to NOT replicate
+  \param theAffectedElems - the list of elements (cells and edges) to which the 
+  replicated nodes should be associated to.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodeGroup(), DoubleNodeGroups()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElems, 
+                                                const SMESH::long_array& theNodesNot,
+                                                const SMESH::long_array& theAffectedElems )
+
+{
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+  TIDSortedElemSet anElems, aNodes, anAffected;
+  arrayToSet(theElems, aMeshDS, anElems, SMDSAbs_All);
+  arrayToSet(theNodesNot, aMeshDS, aNodes, SMDSAbs_Node);
+  arrayToSet(theAffectedElems, aMeshDS, anAffected, SMDSAbs_All);
+
+  bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  \param theElems - the list of elements (edges or faces) to be replicated
+  The nodes for duplication could be found from these elements
+  \param theNodesNot - list of nodes to NOT replicate
+  \param theShape - shape to detect affected elements (element which geometric center
+  located on or inside shape).
+  The replicated nodes should be associated to affected elements.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesInRegion
+( const SMESH::long_array& theElems, 
+  const SMESH::long_array& theNodesNot,
+  GEOM::GEOM_Object_ptr    theShape )
+
+{
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+  TIDSortedElemSet anElems, aNodes;
+  arrayToSet(theElems, aMeshDS, anElems, SMDSAbs_All);
+  arrayToSet(theNodesNot, aMeshDS, aNodes, SMDSAbs_Node);
+
+  TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
+  bool aResult = aMeshEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  \param theElems - group of of elements (edges or faces) to be replicated
+  \param theNodesNot - group of nodes not to replicated
+  \param theAffectedElems - group of elements to which the replicated nodes
+  should be associated to.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodes(), DoubleNodeGroups()
+*/
+//================================================================================
+
+static void groupToSet(SMESH::SMESH_GroupBase_ptr theGrp,
+                       SMESHDS_Mesh*              theMeshDS,
+                       TIDSortedElemSet&          theElemSet,
+                       const SMDSAbs_ElementType  theType)
+
+{
+  if ( CORBA::is_nil( theGrp ) )
+    return;
+  SMESH::long_array_var anIDs = theGrp->GetIDs();
+  arrayToSet( anIDs, theMeshDS, theElemSet, theType);
+}
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( 
+                                                   SMESH::SMESH_GroupBase_ptr theElems,
+                                                   SMESH::SMESH_GroupBase_ptr theNodesNot,
+                                                   SMESH::SMESH_GroupBase_ptr theAffectedElems )
+
+{
+  if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE )
+    return false;
+
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+  TIDSortedElemSet anElems, aNodes, anAffected;
+  groupToSet( theElems, aMeshDS, anElems, SMDSAbs_All ); 
+  groupToSet( theNodesNot, aMeshDS, aNodes, SMDSAbs_Node ); 
+  groupToSet( theAffectedElems, aMeshDS, anAffected, SMDSAbs_All );
+
+  bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  \param theElems - group of of elements (edges or faces) to be replicated
+  \param theNodesNot - group of nodes not to replicated
+  \param theShape - shape to detect affected elements (element which geometric center
+  located on or inside shape).
+  The replicated nodes should be associated to affected elements.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupInRegion( 
+                                                           SMESH::SMESH_GroupBase_ptr theElems,
+                                                           SMESH::SMESH_GroupBase_ptr theNodesNot,
+                                                           GEOM::GEOM_Object_ptr      theShape )
+
+{
+  if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE )
+    return false;
+
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+  TIDSortedElemSet anElems, aNodes, anAffected;
+  groupToSet( theElems, aMeshDS, anElems, SMDSAbs_All ); 
+  groupToSet( theNodesNot, aMeshDS, aNodes, SMDSAbs_Node ); 
+
+  TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
+  bool aResult = aMeshEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  This method provided for convenience works as DoubleNodes() described above.
+  \param theElems - list of groups of elements (edges or faces) to be replicated
+  \param theNodesNot - list of groups of nodes not to replicated
+  \param theAffectedElems - group of elements to which the replicated nodes
+  should be associated to.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodeGroup(), DoubleNodes()
+*/
+//================================================================================
+
+static void listOfGroupToSet(const SMESH::ListOfGroups& theGrpList,
+                             SMESHDS_Mesh*              theMeshDS,
+                             TIDSortedElemSet&          theElemSet,
+                             const bool                 theIsNodeGrp)
+{
+  for ( int i = 0, n = theGrpList.length(); i < n; i++ )
+  {
+    SMESH::SMESH_GroupBase_var aGrp = theGrpList[ i ];
+    if ( !CORBA::is_nil( aGrp ) && (theIsNodeGrp ? aGrp->GetType() == SMESH::NODE 
+                                    : aGrp->GetType() != SMESH::NODE ) )
+    {
+      SMESH::long_array_var anIDs = aGrp->GetIDs();
+      arrayToSet( anIDs, theMeshDS, theElemSet, theIsNodeGrp ? SMDSAbs_Node : SMDSAbs_All );
+    }
+  }
+}
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( 
+                                                    const SMESH::ListOfGroups& theElems,
+                                                    const SMESH::ListOfGroups& theNodesNot,
+                                                    const SMESH::ListOfGroups& theAffectedElems )
+{
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+  TIDSortedElemSet anElems, aNodes, anAffected;
+  listOfGroupToSet(theElems, aMeshDS, anElems, false );
+  listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
+  listOfGroupToSet(theAffectedElems, aMeshDS, anAffected, false );
+
+  bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  This method provided for convenience works as DoubleNodes() described above.
+  \param theElems - list of groups of elements (edges or faces) to be replicated
+  \param theNodesNot - list of groups of nodes not to replicated
+  \param theShape - shape to detect affected elements (element which geometric center
+  located on or inside shape).
+  The replicated nodes should be associated to affected elements.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupsInRegion( 
+                                                            const SMESH::ListOfGroups& theElems,
+                                                            const SMESH::ListOfGroups& theNodesNot,
+                                                            GEOM::GEOM_Object_ptr      theShape )
+{
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+  TIDSortedElemSet anElems, aNodes;
+  listOfGroupToSet(theElems, aMeshDS, anElems,false );
+  listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
+
+  TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
+  bool aResult = aMeshEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}