Salome HOME
0021308: Remove hard-coded dependency of the external mesh plugins from the SMESH...
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.cxx
index 4c034b99c814a093e75ebe3077c425e0c04e6ff3..0ae64289ecc79bc4a9677a2ad6fe940a4462718a 100644 (file)
@@ -75,6 +75,7 @@
 
 using namespace std;
 using SMESH::TPythonDump;
+using SMESH::TVar;
 
 namespace {
 
@@ -94,7 +95,7 @@ namespace {
       myPreviewType = previewElements;
     }
     //!< Destructor
-    virtual ~TPreviewMesh() { delete _myMeshDS; }
+    virtual ~TPreviewMesh() { delete _myMeshDS; _myMeshDS = 0; }
     //!< Copy a set of elements
     void Copy(const TIDSortedElemSet & theElements,
               TIDSortedElemSet&        theCopyElements,
@@ -111,8 +112,12 @@ namespace {
         if ( type == theAvoidType ||
              ( theSelectType != SMDSAbs_All && type != theSelectType ))
           continue;
-
-        if ( const SMDS_MeshElement* anElemCopy = Copy( anElem ))
+        const SMDS_MeshElement* anElemCopy;
+        if ( type == SMDSAbs_Node)
+          anElemCopy = Copy( cast2Node(anElem) );
+        else
+          anElemCopy = Copy( anElem );
+        if ( anElemCopy )
           theCopyElements.insert( theCopyElements.end(), anElemCopy );
       }
     }
@@ -169,7 +174,8 @@ namespace {
     SMESH_Mesh* myMesh;
     string      myMeshPartIOR;
     //!< Constructor
-    TSearchersDeleter(): SMESH_subMeshEventListener( false ), // won't be deleted by submesh
+    TSearchersDeleter(): SMESH_subMeshEventListener( false, // won't be deleted by submesh
+                                                     "SMESH_MeshEditor_i::TSearchersDeleter"),
                          myMesh(0) {}
     //!< Delete theNodeSearcher
     static void Delete()
@@ -429,6 +435,7 @@ struct _IDSource : public POA_SMESH::SMESH_IDSource
   SMESH::long_array* GetIDs()      { return new SMESH::long_array( _ids ); }
   SMESH::long_array* GetMeshInfo() { return 0; }
   SMESH::SMESH_Mesh_ptr GetMesh()  { return SMESH::SMESH_Mesh::_duplicate( _mesh ); }
+  bool IsMeshInfoCorrect()         { return true; }
   SMESH::array_of_ElementType* GetTypes()
   {
     SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
@@ -530,12 +537,14 @@ CORBA::Long SMESH_MeshEditor_i::RemoveOrphanNodes()
   for ( int i = 0; i < seq.size(); i++ )
     IdList.push_back( seq[i] );
 
-  bool ret = anEditor.Remove( IdList, true );
+  int nbNodesBefore = myMesh->NbNodes();
+  anEditor.Remove( IdList, true );
   myMesh->GetMeshDS()->Modified();
   if ( IdList.size() )
     myMesh->SetIsModified( true );
+  int nbNodesAfter = myMesh->NbNodes();
 
-  return ret;
+  return nbNodesBefore - nbNodesAfter;
 }
 
 //=============================================================================
@@ -553,7 +562,7 @@ CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
 
   // Update Python script
   TPythonDump() << "nodeID = " << this << ".AddNode( "
-                << x << ", " << y << ", " << z << " )";
+                << TVar( x ) << ", " << TVar( y ) << ", " << TVar( z )<< " )";
 
   myMesh->GetMeshDS()->Modified();
   myMesh->SetIsModified( true ); // issue 0020693
@@ -1145,7 +1154,7 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array &   IDsOfE
 
   // Update Python script
   TPythonDump() << "isDone = " << this << ".TriToQuad( "
-                << IDsOfElements << ", " << aNumericalFunctor << ", " << MaxAngle << " )";
+                << IDsOfElements << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
 
   ::SMESH_MeshEditor anEditor( myMesh );
 
@@ -1180,7 +1189,7 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr
 
   // Update Python script
   aTPythonDump << "isDone = " << this << ".TriToQuadObject("
-               << theObject << ", " << aNumericalFunctor << ", " << MaxAngle << " )";
+               << theObject << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
 
   return isDone;
 }
@@ -1474,7 +1483,7 @@ SMESH_MeshEditor_i::smooth(const SMESH::long_array &              IDsOfElements,
   TPythonDump() << "isDone = " << this << "."
                 << (IsParametric ? "SmoothParametric( " : "Smooth( ")
                 << IDsOfElements << ", "     << IDsOfFixedNodes << ", "
-                << MaxNbOfIterations << ", " << MaxAspectRatio << ", "
+                << TVar( MaxNbOfIterations ) << ", " << TVar( MaxAspectRatio ) << ", "
                 << "SMESH.SMESH_MeshEditor."
                 << ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ?
                      "CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )");
@@ -1509,7 +1518,7 @@ SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr              theObjec
   aTPythonDump << "isDone = " << this << "."
                << (IsParametric ? "SmoothParametricObject( " : "SmoothObject( ")
                << theObject << ", " << IDsOfFixedNodes << ", "
-               << MaxNbOfIterations << ", " << MaxAspectRatio << ", "
+               << TVar( MaxNbOfIterations ) << ", " << TVar( MaxAspectRatio ) << ", "
                << "SMESH.SMESH_MeshEditor."
                << ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ?
                     "CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )");
@@ -1625,11 +1634,11 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".RotationSweep( "
-                  << theIDsOfElements << ", "
-                  << theAxis << ", "
-                  << theAngleInRadians << ", "
-                  << theNbOfSteps << ", "
-                  << theTolerance << " )";
+                  << theIDsOfElements          << ", "
+                  << theAxis                   << ", "
+                  << TVar( theAngleInRadians ) << ", "
+                  << TVar( theNbOfSteps      ) << ", "
+                  << TVar( theTolerance      ) << " )";
   }
   rotationSweep(theIDsOfElements,
                 theAxis,
@@ -1662,11 +1671,11 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".RotationSweepMakeGroups( "
-                << theIDsOfElements << ", "
-                << theAxis << ", "
-                << theAngleInRadians << ", "
-                << theNbOfSteps << ", "
-                << theTolerance << " )";
+                << theIDsOfElements        << ", "
+                << theAxis                   << ", "
+                << TVar( theAngleInRadians ) << ", "
+                << TVar( theNbOfSteps      ) << ", "
+                << TVar( theTolerance      ) << " )";
   }
   return aGroups;
 }
@@ -1712,11 +1721,11 @@ void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObje
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".RotationSweepObject1D( "
-                  << theObject << ", "
-                  << theAxis << ", "
-                  << theAngleInRadians << ", "
-                  << theNbOfSteps << ", "
-                  << theTolerance << " )";
+                  << theObject                 << ", "
+                  << theAxis                   << ", "
+                  << TVar( theAngleInRadians ) << ", "
+                  << TVar( theNbOfSteps      ) << ", "
+                  << TVar( theTolerance      ) << " )";
   }
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   rotationSweep(anElementsId,
@@ -1741,11 +1750,11 @@ void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObje
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".RotationSweepObject2D( "
-                  << theObject << ", "
-                  << theAxis << ", "
-                  << theAngleInRadians << ", "
-                  << theNbOfSteps << ", "
-                  << theTolerance << " )";
+                  << theObject                 << ", "
+                  << theAxis                   << ", "
+                  << TVar( theAngleInRadians ) << ", "
+                  << TVar( theNbOfSteps      ) << ", "
+                  << TVar( theTolerance      ) << " )";
   }
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   rotationSweep(anElementsId,
@@ -1815,11 +1824,11 @@ SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr th
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".RotationSweepObject1DMakeGroups( "
-                << theObject << ", "
-                << theAxis << ", "
-                << theAngleInRadians << ", "
-                << theNbOfSteps << ", "
-                << theTolerance << " )";
+                << theObject                 << ", "
+                << theAxis                   << ", "
+                << TVar( theAngleInRadians ) << ", "
+                << TVar( theNbOfSteps )      << ", "
+                << TVar( theTolerance )      << " )";
   }
   return aGroups;
 }
@@ -1849,11 +1858,11 @@ SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr th
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".RotationSweepObject2DMakeGroups( "
-                << theObject << ", "
-                << theAxis << ", "
-                << theAngleInRadians << ", "
-                << theNbOfSteps << ", "
-                << theTolerance << " )";
+                << theObject                 << ", "
+                << theAxis                   << ", "
+                << TVar( theAngleInRadians ) << ", "
+                << TVar( theNbOfSteps      ) << ", "
+                << TVar( theTolerance      ) << " )";
   }
   return aGroups;
 }
@@ -1884,9 +1893,17 @@ SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
     gp_Vec stepVec( P->x, P->y, P->z );
 
     TIDSortedElemSet* workElements = & elements;
-    TPreviewMesh      tmpMesh( SMDSAbs_Face );
-    SMESH_Mesh*       mesh = myMesh;
-    
+
+    SMDSAbs_ElementType aType = SMDSAbs_Face;
+    //::SMESH_MeshEditor::ExtrusionFlags aFlag = ::SMESH_MeshEditor::ExtrusionFlags::EXTRUSION_FLAG_BOUNDARY;
+    if (theElementType == SMDSAbs_Node)
+    {
+      aType = SMDSAbs_Edge;
+      //aFlag = ::SMESH_MeshEditor::ExtrusionFlags::EXTRUSION_FLAG_SEW;
+    }
+    TPreviewMesh      tmpMesh( aType );
+    SMESH_Mesh* mesh = myMesh;
+
     if ( myPreviewMode ) {
       SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
       tmpMesh.Copy( elements, copyElements, select, avoid );
@@ -1897,7 +1914,7 @@ SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
 
     TElemOfElemListMap aHystory;
     ::SMESH_MeshEditor anEditor( mesh );
-    ::SMESH_MeshEditor::PGroupIDs groupIds =
+    ::SMESH_MeshEditor::PGroupIDs groupIds = 
         anEditor.ExtrusionSweep (*workElements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
 
     myMesh->GetMeshDS()->Modified();
@@ -1924,10 +1941,25 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
   extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
   if (!myPreviewMode) {
     TPythonDump() << this << ".ExtrusionSweep( "
-                  << theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
+                  << theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps) << " )";
   }
 }
 
+//=======================================================================
+//function : ExtrusionSweep0D
+//purpose  :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweep0D(const SMESH::long_array & theIDsOfElements,
+                                          const SMESH::DirStruct &  theStepVector,
+                                          CORBA::Long               theNbOfSteps)
+{
+  extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
+  if (!myPreviewMode) {
+    TPythonDump() << this << ".ExtrusionSweep0D( "
+                  << theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps)<< " )";
+  }
+}
 
 //=======================================================================
 //function : ExtrusionSweepObject
@@ -1946,6 +1978,23 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
   }
 }
 
+//=======================================================================
+//function : ExtrusionSweepObject0D
+//purpose  :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
+                                                const SMESH::DirStruct &  theStepVector,
+                                                CORBA::Long               theNbOfSteps)
+{
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
+  if ( !myPreviewMode ) {
+    TPythonDump() << this << ".ExtrusionSweepObject0D( "
+                  << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+  }
+}
+
 //=======================================================================
 //function : ExtrusionSweepObject1D
 //purpose  :
@@ -1959,7 +2008,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".ExtrusionSweepObject1D( "
-                  << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
+                  << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
   }
 }
 
@@ -1976,7 +2025,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObj
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".ExtrusionSweepObject2D( "
-                  << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
+                  << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
   }
 }
 
@@ -1997,7 +2046,29 @@ SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfEl
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".ExtrusionSweepMakeGroups( " << theIDsOfElements
-                << ", " << theStepVector <<", " << theNbOfSteps << " )";
+                << ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
+  }
+  return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionSweepMakeGroups0D
+//purpose  :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepMakeGroups0D(const SMESH::long_array& theIDsOfElements,
+                                               const SMESH::DirStruct&  theStepVector,
+                                               CORBA::Long              theNbOfSteps)
+{
+  TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+  SMESH::ListOfGroups* aGroups = extrusionSweep(theIDsOfElements, theStepVector, theNbOfSteps, true,SMDSAbs_Node);
+
+  if (!myPreviewMode) {
+    DumpGroupsList(aPythonDump, aGroups);
+    aPythonDump << this << ".ExtrusionSweepMakeGroups0D( " << theIDsOfElements
+                << ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
   }
   return aGroups;
 }
@@ -2025,6 +2096,29 @@ SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr the
   return aGroups;
 }
 
+//=======================================================================
+//function : ExtrusionSweepObject0DMakeGroups
+//purpose  :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+                                                     const SMESH::DirStruct&   theStepVector,
+                                                     CORBA::Long               theNbOfSteps)
+{
+  TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
+                                                 theNbOfSteps, true, SMDSAbs_Node);
+  if (!myPreviewMode) {
+    DumpGroupsList(aPythonDump, aGroups);
+    aPythonDump << this << ".ExtrusionSweepObject0DMakeGroups( " << theObject
+                << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+  }
+  return aGroups;
+}
+
 //=======================================================================
 //function : ExtrusionSweepObject1DMakeGroups
 //purpose  :
@@ -2043,7 +2137,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( " << theObject
-                << ", " << theStepVector << ", " << theNbOfSteps << " )";
+                << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
   }
   return aGroups;
 }
@@ -2066,7 +2160,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( " << theObject
-                << ", " << theStepVector << ", " << theNbOfSteps << " )";
+                << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
   }
   return aGroups;
 }
@@ -2796,17 +2890,17 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr  Object,
       aPythonDump << "error";
 
     aPythonDump << " = " << this << ".ExtrusionAlongPathObjX( "
-                << Object      << ", "
-                << Path        << ", "
-                << NodeStart   << ", "
-                << HasAngles   << ", "
-                << Angles      << ", "
+                << Object          << ", "
+                << Path            << ", "
+                << NodeStart       << ", "
+                << HasAngles       << ", "
+                << TVar( Angles )  << ", "
                 << LinearVariation << ", "
-                << HasRefPoint << ", "
+                << HasRefPoint     << ", "
                 << "SMESH.PointStruct( "
-                << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
-                << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
-                << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+                << TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
+                << TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
+                << TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
                 << MakeGroups << ", "
                 << ElemType << " )";
   }
@@ -2853,17 +2947,17 @@ ExtrusionAlongPathX(const SMESH::long_array&   IDsOfElements,
       aPythonDump <<"error";
 
     aPythonDump << " = " << this << ".ExtrusionAlongPathX( "
-                << IDsOfElements << ", "
-                << Path        << ", "
-                << NodeStart   << ", "
-                << HasAngles   << ", "
-                << Angles      << ", "
+                << IDsOfElements   << ", "
+                << Path            << ", "
+                << NodeStart       << ", "
+                << HasAngles       << ", "
+                << TVar( Angles )  << ", "
                 << LinearVariation << ", "
-                << HasRefPoint << ", "
+                << HasRefPoint     << ", "
                 << "SMESH.PointStruct( "
-                << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
-                << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
-                << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+                << TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
+                << TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
+                << TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
                 << MakeGroups << ", "
                 << ElemType << " )";
   }
@@ -3000,11 +3094,19 @@ SMESH_MeshEditor_i::mirror(TIDSortedElemSet &                  theElements,
       anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
 
   if(theCopy || myPreviewMode)
-    storeResult(anEditor);
-  else
+    storeResult(anEditor); // store preview data or new elements
+
+  if ( !myPreviewMode )
   {
-    myMesh->SetIsModified( true );
-    myMesh->GetMeshDS()->Modified();
+    if ( theTargetMesh )
+    {
+      theTargetMesh->GetMeshDS()->Modified();
+    }
+    else
+    {
+      myMesh->GetMeshDS()->Modified();
+      myMesh->SetIsModified( true );
+    }
   }
   return theMakeGroups ? getGroups(groupIds.get()) : 0;
 }
@@ -3021,10 +3123,10 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array &           theIDsOfElem
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".Mirror( "
-                  << theIDsOfElements << ", "
-                  << theAxis          << ", "
+                  << theIDsOfElements              << ", "
+                  << theAxis                       << ", "
                   << mirrorTypeName(theMirrorType) << ", "
-                  << theCopy          << " )";
+                  << theCopy                       << " )";
   }
   if ( theIDsOfElements.length() > 0 )
   {
@@ -3047,10 +3149,10 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObj
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".MirrorObject( "
-                  << theObject << ", "
-                  << theAxis   << ", "
+                  << theObject                     << ", "
+                  << theAxis                       << ", "
                   << mirrorTypeName(theMirrorType) << ", "
-                  << theCopy   << " )";
+                  << theCopy                       << " )";
   }
   TIDSortedElemSet elements;
 
@@ -3082,8 +3184,8 @@ SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array&            theIDsO
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".MirrorMakeGroups( "
-                << theIDsOfElements << ", "
-                << theMirror << ", "
+                << theIDsOfElements              << ", "
+                << theMirror                     << ", "
                 << mirrorTypeName(theMirrorType) << " )";
   }
   return aGroups;
@@ -3110,8 +3212,8 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           t
   {
     DumpGroupsList(aPythonDump,aGroups);
     aPythonDump << this << ".MirrorObjectMakeGroups( "
-                << theObject << ", "
-                << theMirror << ", "
+                << theObject                     << ", "
+                << theMirror                     << ", "
                 << mirrorTypeName(theMirrorType) << " )";
   }
   return aGroups;
@@ -3149,11 +3251,11 @@ SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array&            theIDsOfE
 
     if (!myPreviewMode) {
       pydump << mesh << " = " << this << ".MirrorMakeMesh( "
-             << theIDsOfElements << ", "
-             << theMirror   << ", "
+             << theIDsOfElements              << ", "
+             << theMirror                     << ", "
              << mirrorTypeName(theMirrorType) << ", "
-             << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theCopyGroups                 << ", '"
+             << theMeshName                   << "' )";
     }
   }
 
@@ -3195,11 +3297,11 @@ SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           the
     }
     if (!myPreviewMode) {
       pydump << mesh << " = " << this << ".MirrorObjectMakeMesh( "
-             << theObject << ", "
-             << theMirror   << ", "
+             << theObject                     << ", "
+             << theMirror                     << ", "
              << mirrorTypeName(theMirrorType) << ", "
-             << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theCopyGroups                 << ", '"
+             << theMeshName                   << "' )";
     }
   }
 
@@ -3256,10 +3358,18 @@ SMESH_MeshEditor_i::translate(TIDSortedElemSet        & theElements,
 
   if(theCopy || myPreviewMode)
     storeResult(anEditor);
-  else
+
+  if ( !myPreviewMode )
   {
-    myMesh->GetMeshDS()->Modified();
-    myMesh->SetIsModified( true );
+    if ( theTargetMesh )
+    {
+      theTargetMesh->GetMeshDS()->Modified();
+    }
+    else
+    {
+      myMesh->GetMeshDS()->Modified();
+      myMesh->SetIsModified( true );
+    }
   }
 
   return theMakeGroups ? getGroups(groupIds.get()) : 0;
@@ -3277,8 +3387,8 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
   if (!myPreviewMode) {
     TPythonDump() << this << ".Translate( "
                   << theIDsOfElements << ", "
-                  << theVector << ", "
-                  << theCopy << " )";
+                  << theVector        << ", "
+                  << theCopy          << " )";
   }
   if (theIDsOfElements.length()) {
     TIDSortedElemSet elements;
@@ -3300,7 +3410,7 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
     TPythonDump() << this << ".TranslateObject( "
                   << theObject << ", "
                   << theVector << ", "
-                  << theCopy << " )";
+                  << theCopy   << " )";
   }
   TIDSortedElemSet elements;
 
@@ -3331,7 +3441,7 @@ SMESH_MeshEditor_i::TranslateMakeGroups(const SMESH::long_array& theIDsOfElement
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".TranslateMakeGroups( "
                 << theIDsOfElements << ", "
-                << theVector << " )";
+                << theVector        << " )";
   }
   return aGroups;
 }
@@ -3394,9 +3504,9 @@ SMESH_MeshEditor_i::TranslateMakeMesh(const SMESH::long_array& theIDsOfElements,
     if ( !myPreviewMode ) {
       pydump << mesh << " = " << this << ".TranslateMakeMesh( "
              << theIDsOfElements << ", "
-             << theVector   << ", "
-             << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theVector        << ", "
+             << theCopyGroups    << ", '"
+             << theMeshName      << "' )";
     }
   }
 
@@ -3436,10 +3546,10 @@ SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
     }
     if ( !myPreviewMode ) {
       pydump << mesh << " = " << this << ".TranslateObjectMakeMesh( "
-             << theObject << ", "
-             << theVector   << ", "
+             << theObject     << ", "
+             << theVector     << ", "
              << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theMeshName   << "' )";
     }
   }
 
@@ -3498,10 +3608,18 @@ SMESH_MeshEditor_i::rotate(TIDSortedElemSet &        theElements,
 
   if(theCopy || myPreviewMode)
     storeResult(anEditor);
-  else
+
+  if ( !myPreviewMode )
   {
-    myMesh->GetMeshDS()->Modified();
-    myMesh->SetIsModified( true );
+    if ( theTargetMesh )
+    {
+      theTargetMesh->GetMeshDS()->Modified();
+    }
+    else
+    {
+      myMesh->GetMeshDS()->Modified();
+      myMesh->SetIsModified( true );
+    }
   }
 
   return theMakeGroups ? getGroups(groupIds.get()) : 0;
@@ -3520,9 +3638,9 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
   if (!myPreviewMode) {
     TPythonDump() << this << ".Rotate( "
                   << theIDsOfElements << ", "
-                  << theAxis << ", "
-                  << theAngle << ", "
-                  << theCopy << " )";
+                  << theAxis          << ", "
+                  << TVar( theAngle ) << ", "
+                  << theCopy          << " )";
   }
   if (theIDsOfElements.length() > 0)
   {
@@ -3544,10 +3662,10 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".RotateObject( "
-                  << theObject << ", "
-                  << theAxis << ", "
-                  << theAngle << ", "
-                  << theCopy << " )";
+                  << theObject        << ", "
+                  << theAxis          << ", "
+                  << TVar( theAngle ) << ", "
+                  << theCopy          << " )";
   }
   TIDSortedElemSet elements;
   bool emptyIfIsMesh = myPreviewMode ? false : true;
@@ -3578,8 +3696,8 @@ SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".RotateMakeGroups( "
                 << theIDsOfElements << ", "
-                << theAxis << ", "
-                << theAngle << " )";
+                << theAxis          << ", "
+                << TVar( theAngle ) << " )";
   }
   return aGroups;
 }
@@ -3604,9 +3722,9 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".RotateObjectMakeGroups( "
-                << theObject << ", "
-                << theAxis << ", "
-                << theAngle << " )";
+                << theObject        << ", "
+                << theAxis          << ", "
+                << TVar( theAngle ) << " )";
   }
   return aGroups;
 }
@@ -3644,11 +3762,11 @@ SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
     }
     if ( !myPreviewMode ) {
       pydump << mesh << " = " << this << ".RotateMakeMesh( "
-             << theIDsOfElements << ", "
-             << theAxis << ", "
-             << theAngleInRadians   << ", "
-             << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theIDsOfElements          << ", "
+             << theAxis                   << ", "
+             << TVar( theAngleInRadians ) << ", "
+             << theCopyGroups             << ", '"
+             << theMeshName               << "' )";
     }
   }
 
@@ -3691,11 +3809,11 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
     }
     if ( !myPreviewMode ) {
       pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
-             << theObject << ", "
-             << theAxis << ", "
-             << theAngleInRadians   << ", "
-             << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theObject                 << ", "
+             << theAxis                   << ", "
+             << TVar( theAngleInRadians ) << ", "
+             << theCopyGroups             << ", '"
+             << theMeshName               << "' )";
     }
   }
 
@@ -3769,11 +3887,20 @@ SMESH_MeshEditor_i::scale(SMESH::SMESH_IDSource_ptr  theObject,
 
   if(theCopy || myPreviewMode )
     storeResult(anEditor);
-  else
+
+  if ( !myPreviewMode )
   {
-    myMesh->GetMeshDS()->Modified();
-    myMesh->SetIsModified( true );
+    if ( theTargetMesh )
+    {
+      theTargetMesh->GetMeshDS()->Modified();
+    }
+    else
+    {
+      myMesh->GetMeshDS()->Modified();
+      myMesh->SetIsModified( true );
+    }
   }
+
   return theMakeGroups ? getGroups(groupIds.get()) : 0;
 }
 
@@ -3789,11 +3916,10 @@ void SMESH_MeshEditor_i::Scale(SMESH::SMESH_IDSource_ptr  theObject,
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".Scale( "
-                  << theObject << ", "
-                  << "SMESH.PointStruct( "  << thePoint.x << ", "
-                  << thePoint.y << ", " << thePoint.z << " ) ,"
-                  << theScaleFact << ", "
-                  << theCopy << " )";
+                  << theObject            << ", "
+                  << thePoint             << ", "
+                  << TVar( theScaleFact ) << ", "
+                  << theCopy              << " )";
   }
   scale(theObject, thePoint, theScaleFact, theCopy, false);
 }
@@ -3815,10 +3941,9 @@ SMESH_MeshEditor_i::ScaleMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
   if (!myPreviewMode) {
     DumpGroupsList(aPythonDump, aGroups);
     aPythonDump << this << ".Scale("
-                << theObject << ","
-                << "SMESH.PointStruct(" <<thePoint.x << ","
-                << thePoint.y << "," << thePoint.z << "),"
-                << theScaleFact << ",True,True)";
+                << theObject            << ","
+                << thePoint             << ","
+                << TVar( theScaleFact ) << ",True,True)";
   }
   return aGroups;
 }
@@ -3852,12 +3977,11 @@ SMESH_MeshEditor_i::ScaleMakeMesh(SMESH::SMESH_IDSource_ptr  theObject,
     }
     if ( !myPreviewMode )
       pydump << mesh << " = " << this << ".ScaleMakeMesh( "
-             << theObject << ", "
-             << "SMESH.PointStruct( "  << thePoint.x << ", "
-             << thePoint.y << ", " << thePoint.z << " ) ,"
-             << theScaleFact << ", "
-             << theCopyGroups << ", '"
-             << theMeshName << "' )";
+             << theObject            << ", "
+             << thePoint             << ", "
+             << TVar( theScaleFact ) << ", "
+             << theCopyGroups        << ", '"
+             << theMeshName          << "' )";
   }
 
   // dump "GetGroups"
@@ -4118,6 +4242,8 @@ void SMESH_MeshEditor_i::MergeEqualElements()
   ::SMESH_MeshEditor anEditor( myMesh );
   anEditor.MergeEqualElements();
 
+  myMesh->GetMeshDS()->Modified();
+
   TPythonDump() << this << ".MergeEqualElements()";
 }
 
@@ -4170,7 +4296,7 @@ CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long   NodeID,
   {
     // Update Python script
     TPythonDump() << "isDone = " << this << ".MoveNode( "
-                  << NodeID << ", " << x << ", " << y << ", " << z << " )";
+                  << NodeID << ", " << TVar(x) << ", " << TVar(y) << ", " << TVar(z) << " )";
     myMesh->GetMeshDS()->Modified();
     myMesh->SetIsModified( true );
   }
@@ -5701,8 +5827,8 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
     SMESH::SMESH_GroupBase_var aGrp = theDomains[ i ];
     if ( !CORBA::is_nil( aGrp ) /*&& ( aGrp->GetType() != SMESH::NODE )*/ )
     {
-      if ( aGrp->GetType() != SMESH::VOLUME )
-        THROW_SALOME_CORBA_EXCEPTION("Not a volume group", SALOME::BAD_PARAM);
+//      if ( aGrp->GetType() != SMESH::VOLUME )
+//        THROW_SALOME_CORBA_EXCEPTION("Not a volume group", SALOME::BAD_PARAM);
       TIDSortedElemSet domain;
       domain.clear();
       domains.push_back(domain);