Salome HOME
Dump Puthon extension
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.cxx
index 064955be5a1403232b09bfa674e4f1d6c48b89d4..2af4dc18e57320f9fabbec0188c89b36f1205941 100644 (file)
@@ -1353,12 +1353,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 );
@@ -1401,10 +1402,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 << " )";
@@ -1429,21 +1429,23 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
                                             CORBA::Long              theNbOfSteps,
                                             CORBA::Double            theTolerance)
 {
+  SMESH::ListOfGroups *aGroups = rotationSweep(theIDsOfElements,
+                                               theAxis,
+                                               theAngleInRadians,
+                                               theNbOfSteps,
+                                               theTolerance,
+                                               true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
-    TPythonDump() << this << ".RotationSweepMakeGroups( "
-                  << theIDsOfElements
-                  << ", axis, "
-                  << theAngleInRadians << ", "
-                  << theNbOfSteps << ", "
-                  << theTolerance << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump<< this << ".RotationSweepMakeGroups( "
+               << theIDsOfElements << ", "
+               << theAxis << ", "
+               << theAngleInRadians << ", "
+               << theNbOfSteps << ", "
+               << theTolerance << " )";
   }
-  return rotationSweep(theIDsOfElements,
-                       theAxis,
-                       theAngleInRadians,
-                       theNbOfSteps,
-                       theTolerance,
-                       true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -1458,10 +1460,9 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
                                             CORBA::Double             theTolerance)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump() << this << ".RotationSweepObject( "
-                  << theObject
-                  << ", axis, "
+                  << theObject << ", "
+                  << theAxis << ", "
                   << theAngleInRadians << ", "
                   << theNbOfSteps << ", "
                   << theTolerance << " )";
@@ -1475,6 +1476,64 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
                 false);
 }
 
+//=======================================================================
+//function : RotationSweepObject1D
+//purpose  :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
+                                              const SMESH::AxisStruct & theAxis,
+                                              CORBA::Double             theAngleInRadians,
+                                              CORBA::Long               theNbOfSteps,
+                                              CORBA::Double             theTolerance)
+{
+  if ( !myPreviewMode ) {
+    TPythonDump() << this << ".RotationSweepObject1D( "
+                  << theObject << ", "
+                  << theAxis << ", "
+                  << theAngleInRadians << ", "
+                  << theNbOfSteps << ", "
+                  << theTolerance << " )";
+  }
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  rotationSweep(anElementsId,
+                theAxis,
+                theAngleInRadians,
+                theNbOfSteps,
+                theTolerance,
+                false,
+               SMDSAbs_Edge);
+}
+
+//=======================================================================
+//function : RotationSweepObject2D
+//purpose  :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
+                                              const SMESH::AxisStruct & theAxis,
+                                              CORBA::Double             theAngleInRadians,
+                                              CORBA::Long               theNbOfSteps,
+                                              CORBA::Double             theTolerance)
+{
+  if ( !myPreviewMode ) {
+    TPythonDump() << this << ".RotationSweepObject2D( "
+                  << theObject << ", "
+                  << theAxis << ", "
+                  << theAngleInRadians << ", "
+                  << theNbOfSteps << ", "
+                  << theTolerance << " )";
+  }
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  rotationSweep(anElementsId,
+                theAxis,
+                theAngleInRadians,
+                theNbOfSteps,
+                theTolerance,
+                false,
+               SMDSAbs_Face);
+}
+
 //=======================================================================
 //function : RotationSweepObjectMakeGroups
 //purpose  : 
@@ -1487,22 +1546,90 @@ SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theO
                                                   CORBA::Long               theNbOfSteps,
                                                   CORBA::Double             theTolerance)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+                                               theAxis,
+                                               theAngleInRadians,
+                                               theNbOfSteps,
+                                               theTolerance,
+                                               true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
-    TPythonDump() << this << ".RotationSweepObjectMakeGroups( "
-                  << theObject
-                  << ", axis, "
-                  << theAngleInRadians << ", "
-                  << theNbOfSteps << ", "
-                  << theTolerance << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
+               << theObject << ", "
+              << theAxis << ", "
+               << theAngleInRadians << ", "
+               << theNbOfSteps << ", "
+               << theTolerance << " )";
   }
+  return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject1DMakeGroups
+//purpose  : 
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+                                                   const SMESH::AxisStruct&  theAxis,
+                                                   CORBA::Double             theAngleInRadians,
+                                                   CORBA::Long               theNbOfSteps,
+                                                   CORBA::Double             theTolerance)
+{
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return rotationSweep(anElementsId,
-                       theAxis,
-                       theAngleInRadians,
-                       theNbOfSteps,
-                       theTolerance,
-                       true);
+  SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+                                               theAxis,
+                                               theAngleInRadians,
+                                               theNbOfSteps,
+                                               theTolerance,
+                                               true,
+                                              SMDSAbs_Edge);
+  if ( !myPreviewMode ) {
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump<< this << ".RotationSweepObject1DMakeGroups( "
+               << theObject << ", "
+              << theAxis << ", "
+               << theAngleInRadians << ", "
+               << theNbOfSteps << ", "
+               << theTolerance << " )";
+  }
+  return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject2DMakeGroups
+//purpose  : 
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+                                                   const SMESH::AxisStruct&  theAxis,
+                                                   CORBA::Double             theAngleInRadians,
+                                                   CORBA::Long               theNbOfSteps,
+                                                   CORBA::Double             theTolerance)
+{
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+                                               theAxis,
+                                               theAngleInRadians,
+                                               theNbOfSteps,
+                                               theTolerance,
+                                               true,
+                                              SMDSAbs_Face);
+  if ( !myPreviewMode ) {
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump<< this << ".RotationSweepObject2DMakeGroups( "
+               << theObject << ", "
+              << theAxis << ", "
+               << theAngleInRadians << ", "
+               << theNbOfSteps << ", "
+               << theTolerance << " )";
+  }
+  return aGroups;
 }
 
 
@@ -1557,9 +1684,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 << " )";
   }
 }
 
@@ -1576,9 +1702,8 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
   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 << " )";
   }
 }
 
@@ -1594,9 +1719,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 << " )";
   }
 }
 
@@ -1612,9 +1736,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 << " )";
   }
 }
 
@@ -1628,12 +1751,15 @@ SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfEl
                                              const SMESH::DirStruct&  theStepVector,
                                              CORBA::Long              theNbOfSteps)
 {
+  SMESH::ListOfGroups* aGroups = extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
+    
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
-    TPythonDump() << this << ".ExtrusionSweepMakeGroups( "
-                  << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump  << this << ".ExtrusionSweepMakeGroups( "
+                 << theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
   }
-  return extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
+  return aGroups;
 }
 //=======================================================================
 //function : ExtrusionSweepObjectMakeGroups
@@ -1645,13 +1771,16 @@ SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr the
                                                    const SMESH::DirStruct&   theStepVector,
                                                    CORBA::Long               theNbOfSteps)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
+  
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
-    TPythonDump() << this << ".ExtrusionSweepObjectMakeGroups( "
-                  << theObject << ", stepVector, " << theNbOfSteps << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump<< this << ".ExtrusionSweepObjectMakeGroups( "
+               << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
-  SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
+  return aGroups;
 }
 
 //=======================================================================
@@ -1664,13 +1793,15 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
                                                      const SMESH::DirStruct&   theStepVector,
                                                      CORBA::Long               theNbOfSteps)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
-    TPythonDump() << this << ".ExtrusionSweepObject1DMakeGroups( "
-                  << theObject << ", stepVector, " << theNbOfSteps << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
+               << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
-  SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
+  return aGroups;
 }
 
 //=======================================================================
@@ -1683,13 +1814,15 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
                                                      const SMESH::DirStruct&   theStepVector,
                                                      CORBA::Long               theNbOfSteps)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
   if ( !myPreviewMode ) {
-    TPythonDump() << "stepVector = " << theStepVector;
-    TPythonDump() << this << ".ExtrusionSweepObject2DMakeGroups( "
-                  << theObject << ", stepVector, " << theNbOfSteps << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
+               << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
   }
-  SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
+  return aGroups;
 }
 
 
@@ -1764,21 +1897,25 @@ SMESH_MeshEditor_i::AdvancedExtrusionMakeGroups(const SMESH::long_array& theIDsO
                                                 CORBA::Long              theExtrFlags,
                                                 CORBA::Double            theSewTolerance)
 {
+  SMESH::ListOfGroups * aGroups = advancedExtrusion( theIDsOfElements,
+                                                    theStepVector,
+                                                    theNbOfSteps,
+                                                    theExtrFlags,
+                                                    theSewTolerance,
+                                                    true);
+  
   if ( !myPreviewMode ) {
     TPythonDump() << "stepVector = " << theStepVector;
-    TPythonDump() << this << ".AdvancedExtrusionMakeGroups("
-                  << theIDsOfElements
-                  << ", stepVector, "
-                  << theNbOfSteps << ","
-                  << theExtrFlags << ", "
-                  << theSewTolerance <<  " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".AdvancedExtrusionMakeGroups("
+                << theIDsOfElements
+                << ", stepVector, "
+                << theNbOfSteps << ","
+                << theExtrFlags << ", "
+                << theSewTolerance <<  " )";
   }
-  return advancedExtrusion( theIDsOfElements,
-                            theStepVector,
-                            theNbOfSteps,
-                            theExtrFlags,
-                            theSewTolerance,
-                            true);
+  return aGroups;
 }
 
 
@@ -1820,7 +1957,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();
 
@@ -1845,7 +1983,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++) {
@@ -1890,24 +2028,18 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
                                         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,
@@ -1939,24 +2071,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();
@@ -1973,6 +2099,96 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObje
   return anError;
 }
 
+//=======================================================================
+//function : ExtrusionAlongPathObject1D
+//purpose  :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr   theObject,
+                                              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() << "error = " << this << ".ExtrusionAlongPathObject1D( "
+                  << theObject        << ", "
+                  << thePathMesh      << ", "
+                  << thePathShape     << ", "
+                  << theNodeStart     << ", "
+                  << theHasAngles     << ", "
+                  << 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();
+  extrusionAlongPath( anElementsId,
+                      thePathMesh,
+                      thePathShape,
+                      theNodeStart,
+                      theHasAngles,
+                      theAngles,
+                      theHasRefPoint,
+                      theRefPoint,
+                      false,
+                      anError,
+                     SMDSAbs_Edge);
+  return anError;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject2D
+//purpose  :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr   theObject,
+                                              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() << "error = " << this << ".ExtrusionAlongPathObject2D( "
+                  << theObject        << ", "
+                  << thePathMesh      << ", "
+                  << thePathShape     << ", "
+                  << theNodeStart     << ", "
+                  << theHasAngles     << ", "
+                  << 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();
+  extrusionAlongPath( anElementsId,
+                      thePathMesh,
+                      thePathShape,
+                      theNodeStart,
+                      theHasAngles,
+                      theAngles,
+                      theHasRefPoint,
+                      theRefPoint,
+                      false,
+                      anError,
+                     SMDSAbs_Face);
+  return anError;
+}
+
 
 //=======================================================================
 //function : ExtrusionAlongPathMakeGroups
@@ -1990,36 +2206,41 @@ 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);
   if ( !myPreviewMode ) {
-    TPythonDump() << "rotAngles = " << theAngles;
-
-    if ( theHasRefPoint )
-      TPythonDump() << "refPoint = SMESH.PointStruct( "
-                    << theRefPoint.x << ", "
-                    << theRefPoint.y << ", "
-                    << theRefPoint.z << " )";
+    bool isDumpGroups = aGroups && aGroups->length() > 0;
+    TPythonDump aPythonDump;
+    if(isDumpGroups) {
+      aPythonDump << "("<<aGroups;
+    }
+    if(isDumpGroups)
+      aPythonDump << ", error)";
     else
-      TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-
-    TPythonDump() << "groups = " << this << ".ExtrusionAlongPathMakeGroups( "
-                  << theIDsOfElements << ", "
-                  << thePathMesh      << ", "
-                  << thePathShape     << ", "
-                  << theNodeStart     << ", "
-                  << theHasAngles     << ", "
-                  << "rotAngles"      << ", "
-                  << theHasRefPoint   << ", refPoint )";
+      aPythonDump <<"error";
+    
+    aPythonDump<<" = "<< this << ".ExtrusionAlongPathMakeGroups( "
+               << theIDsOfElements << ", "
+               << thePathMesh      << ", "
+               << thePathShape     << ", "
+               << theNodeStart     << ", "
+               << theHasAngles     << ", "
+               << theAngles        << ", "
+               << theHasRefPoint   << ", "
+               << "SMESH.PointStruct( "
+               << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
-  return extrusionAlongPath( theIDsOfElements,
-                             thePathMesh,
-                             thePathShape,
-                             theNodeStart,
-                             theHasAngles,
-                             theAngles,
-                             theHasRefPoint,
-                             theRefPoint,
-                             true,
-                             Error);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2038,37 +2259,155 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
                                    const SMESH::PointStruct&  theRefPoint,
                                    SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+                                                      thePathMesh,
+                                                      thePathShape,
+                                                      theNodeStart,
+                                                      theHasAngles,
+                                                      theAngles,
+                                                      theHasRefPoint,
+                                                      theRefPoint,
+                                                      true,
+                                                      Error);
+  
   if ( !myPreviewMode ) {
-    TPythonDump() << "rotAngles = " << theAngles;
+    bool isDumpGroups = aGroups && aGroups->length() > 0;
+    TPythonDump aPythonDump;
+    if(isDumpGroups) {
+      aPythonDump << "("<<aGroups;
+    }
+    if(isDumpGroups)
+      aPythonDump << ", error)";
+    else
+      aPythonDump <<"error";
 
-    if ( theHasRefPoint )
-      TPythonDump() << "refPoint = SMESH.PointStruct( "
-                    << theRefPoint.x << ", "
-                    << theRefPoint.y << ", "
-                    << theRefPoint.z << " )";
+    aPythonDump << " = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
+                << theObject << ", "
+                << thePathMesh      << ", "
+                << thePathShape     << ", "
+                << theNodeStart     << ", "
+                << theHasAngles     << ", "
+                << theAngles        << ", "
+               << theHasRefPoint   << ", "
+               << "SMESH.PointStruct( "
+               << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+  }
+  return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject1DMakeGroups
+//purpose  : 
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
+                                    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::SMESH_MeshEditor::Extrusion_Error& Error)
+{
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+                                                      thePathMesh,
+                                                      thePathShape,
+                                                      theNodeStart,
+                                                      theHasAngles,
+                                                      theAngles,
+                                                      theHasRefPoint,
+                                                      theRefPoint,
+                                                      true,
+                                                      Error,
+                                                     SMDSAbs_Edge);
+  
+  if ( !myPreviewMode ) {
+    bool isDumpGroups = aGroups && aGroups->length() > 0;
+    TPythonDump aPythonDump;
+    if(isDumpGroups) {
+      aPythonDump << "("<<aGroups;
+    }
+    if(isDumpGroups)
+      aPythonDump << ", error)";
     else
-      TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
+      aPythonDump <<"error";
 
-    TPythonDump() << "groups = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
-                  << theObject << ", "
-                  << thePathMesh      << ", "
-                  << thePathShape     << ", "
-                  << theNodeStart     << ", "
-                  << theHasAngles     << ", "
-                  << "rotAngles"      << ", "
-                  << theHasRefPoint   << ", refPoint )";
+    aPythonDump << " = " << this << ".ExtrusionAlongPathObject1DMakeGroups( "
+                << theObject << ", "
+                << thePathMesh      << ", "
+                << thePathShape     << ", "
+                << theNodeStart     << ", "
+                << theHasAngles     << ", "
+                << theAngles        << ", "
+               << theHasRefPoint   << ", "
+               << "SMESH.PointStruct( "
+               << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
+  return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject2DMakeGroups
+//purpose  : 
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
+                                    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::SMESH_MeshEditor::Extrusion_Error& Error)
+{
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return extrusionAlongPath( anElementsId,
-                             thePathMesh,
-                             thePathShape,
-                             theNodeStart,
-                             theHasAngles,
-                             theAngles,
-                             theHasRefPoint,
-                             theRefPoint,
-                             true,
-                             Error);
+  SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+                                                      thePathMesh,
+                                                      thePathShape,
+                                                      theNodeStart,
+                                                      theHasAngles,
+                                                      theAngles,
+                                                      theHasRefPoint,
+                                                      theRefPoint,
+                                                      true,
+                                                      Error,
+                                                     SMDSAbs_Face);
+  
+  if ( !myPreviewMode ) {
+    bool isDumpGroups = aGroups && aGroups->length() > 0;
+    TPythonDump aPythonDump;
+    if(isDumpGroups) {
+      aPythonDump << "("<<aGroups;
+    }
+    if(isDumpGroups)
+      aPythonDump << ", error)";
+    else
+      aPythonDump <<"error";
+
+    aPythonDump << " = " << this << ".ExtrusionAlongPathObject2DMakeGroups( "
+                << theObject << ", "
+                << thePathMesh      << ", "
+                << thePathShape     << ", "
+                << theNodeStart     << ", "
+                << theHasAngles     << ", "
+                << theAngles        << ", "
+               << theHasRefPoint   << ", "
+               << "SMESH.PointStruct( "
+               << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+               << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+  }
+  return aGroups;
 }
 
 //================================================================================
@@ -2238,13 +2577,16 @@ SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array&            theIDsO
                                      const SMESH::AxisStruct&            theMirror,
                                      SMESH::SMESH_MeshEditor::MirrorType theMirrorType)
 {
+  SMESH::ListOfGroups * aGroups = mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
   if ( !myPreviewMode ) {
-    TPythonDump() << this << ".MirrorMakeGroups( "
-                  << theIDsOfElements << ", "
-                  << theMirror          << ", "
-                  << mirrorTypeName(theMirrorType) << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".MirrorMakeGroups( "
+                << theIDsOfElements << ", "
+                << theMirror << ", "
+                << mirrorTypeName(theMirrorType) << " )";
   }
-  return mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2257,14 +2599,17 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           t
                                            const SMESH::AxisStruct&            theMirror,
                                            SMESH::SMESH_MeshEditor::MirrorType theMirrorType)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = mirror(anElementsId, theMirror, theMirrorType, true, true);
   if ( !myPreviewMode ) {
-    TPythonDump() << this << ".MirrorObjectMakeGroups( "
-                  << theObject << ", "
-                  << theMirror   << ", "
-                  << mirrorTypeName(theMirrorType) << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".MirrorObjectMakeGroups( "
+                << theObject << ", "
+                << theMirror << ", "
+                << mirrorTypeName(theMirrorType) << " )";
   }
-  SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return mirror(anElementsId, theMirror, theMirrorType, true, true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2279,24 +2624,35 @@ SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array&            theIDsOfE
                                    CORBA::Boolean                      theCopyGroups,
                                    const char*                         theMeshName)
 {
-  TPythonDump pydump; // to prevent dump at mesh creation
-
-  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
-  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ))
-  {
-    mirror(theIDsOfElements, theMirror, theMirrorType,
-           false, theCopyGroups, & mesh_i->GetImpl());
-    mesh_i->CreateGroupServants();
+  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) {
+      mirror(theIDsOfElements, theMirror, theMirrorType,
+             false, theCopyGroups, & mesh_i->GetImpl());
+      mesh_i->CreateGroupServants();
+    }
+    
+    if ( !myPreviewMode ) {
+      pydump << mesh << " = " << this << ".MirrorMakeMesh( "
+             << theIDsOfElements << ", "
+             << theMirror   << ", "
+             << mirrorTypeName(theMirrorType) << ", "
+             << theCopyGroups << ", '"
+             << theMeshName << "' )";
+    }
   }
 
-  if ( !myPreviewMode ) {
-    pydump << mesh << " = " << this << ".MirrorMakeMesh( "
-           << theIDsOfElements << ", "
-           << theMirror   << ", "
-           << mirrorTypeName(theMirrorType) << ", "
-           << theCopyGroups << ", '"
-           << theMeshName << "' )";
-  }
+  //dump "GetGroups"
+  if(!myPreviewMode && mesh_i)
+    mesh_i->GetGroups();
+  
   return mesh._retn();
 }
 
@@ -2312,24 +2668,36 @@ SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           the
                                          CORBA::Boolean                      theCopyGroups,
                                          const char*                         theMeshName)
 {
-  TPythonDump pydump; // to prevent dump at mesh creation
+  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 ) {
+      SMESH::long_array_var anElementsId = theObject->GetIDs();
+      mirror(anElementsId, theMirror, theMirrorType,
+             false, theCopyGroups, & mesh_i->GetImpl());
+      mesh_i->CreateGroupServants();
+    }
 
-  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
-  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ))
-  {
-    SMESH::long_array_var anElementsId = theObject->GetIDs();
-    mirror(anElementsId, theMirror, theMirrorType,
-           false, theCopyGroups, & mesh_i->GetImpl());
-    mesh_i->CreateGroupServants();
-  }
-  if ( !myPreviewMode ) {
-    pydump << mesh << " = " << this << ".MirrorObjectMakeMesh( "
-           << theObject << ", "
-           << theMirror   << ", "
-           << mirrorTypeName(theMirrorType) << ", "
-           << theCopyGroups << ", '"
-           << theMeshName << "' )";
-  }
+    if ( !myPreviewMode ) {
+      pydump << mesh << " = " << this << ".MirrorObjectMakeMesh( "
+             << theObject << ", "
+             << theMirror   << ", "
+             << mirrorTypeName(theMirrorType) << ", "
+             << theCopyGroups << ", '"
+             << theMeshName << "' )";
+    }
+  } 
+
+  //dump "GetGroups"
+  if(!myPreviewMode && mesh_i)
+    mesh_i->GetGroups();
+  
   return mesh._retn();
 }
 
@@ -2374,10 +2742,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,
@@ -2397,8 +2764,8 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
 {
   if ( !myPreviewMode ) {
     TPythonDump() << this << ".TranslateObject( "
-                  << theObject
-                  << ", vector, "
+                  << theObject << ", "
+                  << theVector << ", "
                   << theCopy << " )";
   }
   SMESH::long_array_var anElementsId = theObject->GetIDs();
@@ -2417,13 +2784,15 @@ SMESH::ListOfGroups*
 SMESH_MeshEditor_i::TranslateMakeGroups(const SMESH::long_array& theIDsOfElements,
                                         const SMESH::DirStruct&  theVector)
 {
+  SMESH::ListOfGroups * aGroups = translate(theIDsOfElements,theVector,true,true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "vector = " << theVector;
-    TPythonDump() << this << ".TranslateMakeGroups( "
-                  << theIDsOfElements
-                  << ", vector )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".TranslateMakeGroups( "
+                << theIDsOfElements << ", "
+                << theVector << " )";
   }
-  return translate(theIDsOfElements,theVector,true,true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2435,14 +2804,18 @@ SMESH::ListOfGroups*
 SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
                                               const SMESH::DirStruct&   theVector)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups = translate(anElementsId, theVector, true, true);
+  
   if ( !myPreviewMode ) {
-    TPythonDump() << "vector = " << theVector;
-    TPythonDump() << this << ".TranslateObjectMakeGroups( "
-                  << theObject
-                  << ", vector )";
+
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".TranslateObjectMakeGroups( "
+                << theObject << ", "
+                << theVector << " )";
   }
-  SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return translate(anElementsId, theVector, true, true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2456,21 +2829,36 @@ SMESH_MeshEditor_i::TranslateMakeMesh(const SMESH::long_array& theIDsOfElements,
                                       CORBA::Boolean           theCopyGroups,
                                       const char*              theMeshName)
 {
-  TPythonDump pydump; // to prevent dump at mesh creation
-  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+  SMESH_Mesh_i* mesh_i;
+  SMESH::SMESH_Mesh_var mesh;
+  
+  { // open new scope to dump "MakeMesh" command
+    // and then "GetGroups" using SMESH_Mesh::GetGroups()
 
-  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
-    translate(theIDsOfElements, theVector,
-              false, theCopyGroups, & mesh_i->GetImpl());
-    mesh_i->CreateGroupServants();
-  }
-  if ( !myPreviewMode ) {
-    pydump << mesh << " = " << this << ".TranslateMakeMesh( "
-           << theIDsOfElements << ", "
-           << theVector   << ", "
-           << theCopyGroups << ", '"
-           << theMeshName << "' )";
+    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 << ", "
+             << theVector   << ", "
+             << theCopyGroups << ", '"
+             << theMeshName << "' )";
+    }
   }
+  
+  //dump "GetGroups"
+  if(!myPreviewMode && mesh_i)
+    mesh_i->GetGroups();
+  
   return mesh._retn();
 }
 
@@ -2485,22 +2873,34 @@ SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
                                             CORBA::Boolean            theCopyGroups,
                                             const char*               theMeshName)
 {
-  TPythonDump pydump; // to prevent dump at mesh creation
-  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
-
-  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
-    SMESH::long_array_var anElementsId = theObject->GetIDs();
-    translate(anElementsId, theVector,
-              false, theCopyGroups, & mesh_i->GetImpl());
-    mesh_i->CreateGroupServants();
-  }
-  if ( !myPreviewMode ) {
-    pydump << mesh << " = " << this << ".TranslateObjectMakeMesh( "
-           << theObject << ", "
-           << theVector   << ", "
-           << theCopyGroups << ", '"
-           << theMeshName << "' )";
+  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 ) {
+      SMESH::long_array_var anElementsId = theObject->GetIDs();
+      translate(anElementsId, theVector,
+                false, theCopyGroups, & mesh_i->GetImpl());
+      mesh_i->CreateGroupServants();
+    }
+    if ( !myPreviewMode ) {
+      pydump << mesh << " = " << this << ".TranslateObjectMakeMesh( "
+             << theObject << ", "
+             << theVector   << ", "
+             << theCopyGroups << ", '"
+             << theMeshName << "' )";
+    }
   }
+  
+  //dump "GetGroups"
+  if(!myPreviewMode && mesh_i)
+    mesh_i->GetGroups();
+  
   return mesh._retn();
 }
 
@@ -2549,10 +2949,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 << " )";
   }
@@ -2574,10 +2973,9 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
                                      CORBA::Boolean            theCopy)
 {
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
     TPythonDump() << this << ".RotateObject( "
-                  << theObject
-                  << ", axis, "
+                  << theObject << ", "
+                  << theAxis << ", "
                   << theAngle << ", "
                   << theCopy << " )";
   }
@@ -2599,14 +2997,16 @@ SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
                                      const SMESH::AxisStruct& theAxis,
                                      CORBA::Double            theAngle)
 {
+  SMESH::ListOfGroups * aGroups =  rotate(theIDsOfElements,theAxis,theAngle,true,true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
-    TPythonDump() << this << ".RotateMakeGroups( "
-                  << theIDsOfElements
-                  << ", axis, "
-                  << theAngle << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".RotateMakeGroups( "
+                << theIDsOfElements << ", "
+               << theAxis << ", "
+                << theAngle << " )";
   }
-  return rotate(theIDsOfElements,theAxis,theAngle,true,true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2619,15 +3019,18 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
                                            const SMESH::AxisStruct&  theAxis,
                                            CORBA::Double             theAngle)
 {
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  SMESH::ListOfGroups * aGroups =  rotate(anElementsId,theAxis,theAngle,true,true);
   if ( !myPreviewMode ) {
-    TPythonDump() << "axis = " << theAxis;
-    TPythonDump() << this << ".RotateObjectMakeGroups( "
-                  << theObject
-                  << ", axis, "
-                  << theAngle << " )";
+    TPythonDump aPythonDump;
+    DumpGroupsList(aPythonDump,aGroups);
+    aPythonDump << this << ".RotateObjectMakeGroups( "
+               << theObject << ", "
+               << theAxis << ", "
+               << theAngle << " )";
   }
-  SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return rotate(anElementsId,theAxis,theAngle,true,true);
+  return aGroups;
 }
 
 //=======================================================================
@@ -2642,22 +3045,36 @@ SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
                                    CORBA::Boolean           theCopyGroups,
                                    const char*              theMeshName)
 {
-  TPythonDump pydump; // to prevent dump at mesh creation
-  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+  SMESH::SMESH_Mesh_var mesh;
+  SMESH_Mesh_i* mesh_i;
 
-  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
-    rotate(theIDsOfElements, theAxis, theAngleInRadians,
-           false, theCopyGroups, & mesh_i->GetImpl());
-    mesh_i->CreateGroupServants();
-  }
-  if ( !myPreviewMode ) {
-    pydump << mesh << " = " << this << ".RotateMakeMesh( "
-           << theIDsOfElements << ", "
-           << theAxis << ", "
-           << theAngleInRadians   << ", "
-           << theCopyGroups << ", '"
-           << theMeshName << "' )";
+  { // 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());
+      mesh_i->CreateGroupServants();
+    }
+    if ( !myPreviewMode ) {
+      pydump << mesh << " = " << this << ".RotateMakeMesh( "
+             << theIDsOfElements << ", "
+             << theAxis << ", "
+             << theAngleInRadians   << ", "
+             << theCopyGroups << ", '"
+             << theMeshName << "' )";
+    }
   }
+  
+  //dump "GetGroups"
+  if(!myPreviewMode && mesh_i)
+    mesh_i->GetGroups();
+  
   return mesh._retn();
 }
 
@@ -2673,23 +3090,36 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
                                          CORBA::Boolean            theCopyGroups,
                                          const char*               theMeshName)
 {
-  TPythonDump pydump; // to prevent dump at mesh creation
-  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
-
-  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
-    SMESH::long_array_var anElementsId = theObject->GetIDs();
-    rotate(anElementsId, theAxis, theAngleInRadians,
-           false, theCopyGroups, & mesh_i->GetImpl());
-    mesh_i->CreateGroupServants();
-  }
-  if ( !myPreviewMode ) {
-    pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
-           << theObject << ", "
-           << theAxis << ", "
-           << theAngleInRadians   << ", "
-           << theCopyGroups << ", '"
-           << theMeshName << "' )";
+  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,
+             false, theCopyGroups, & mesh_i->GetImpl());
+      mesh_i->CreateGroupServants();
+    }
+    if ( !myPreviewMode ) {
+      pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
+             << theObject << ", "
+             << theAxis << ", "
+             << theAngleInRadians   << ", "
+             << theCopyGroups << ", '"
+             << theMeshName << "' )";
+    }
   }
+  
+  //dump "GetGroups"
+  if(!myPreviewMode && mesh_i)
+    mesh_i->GetGroups();
+  
   return mesh._retn();
 }
 
@@ -3454,3 +3884,16 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName)
 
   return mesh._retn();
 }
+
+//=======================================================================
+//function : DumpGroupsList
+//purpose  : 
+//=======================================================================
+void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPython, 
+                                        const SMESH::ListOfGroups * theGroupList)
+{
+  bool isDumpGroupList = theGroupList && theGroupList->length() > 0;
+  if(isDumpGroupList) {
+    theDumpPython << theGroupList << " = ";
+  }
+}