Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/visu.git] / src / VISU_I / VISU_DumpPython.cc
index aea67bc018a99c96bcf6ac2e5e88351c5bb46f0f..c91a9c014c385fa6c1de056e1cfe98a371fff1eb 100644 (file)
@@ -1,6 +1,6 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 //  This library is free software; you can redistribute it and/or
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  VISU OBJECT : interactive object for VISU entities implementation
 //  File   : VISU_DumpPython.cc
 //  Author : Alexey PETROV
 //  Module : VISU
-
+//
 #include "VISU_Gen_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_PrsObject_i.hh"
@@ -39,8 +39,9 @@
 #include "VISU_StreamLines_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
 #include "VISU_GaussPoints_i.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
 #include "VISU_ColoredPrs3dCache_i.hh"
 #include "VISU_ColoredPrs3dHolder_i.hh"
 
@@ -50,8 +51,8 @@
 #include <strstream>
 #include <functional>
 
-#include <qstring.h>
-#include <qfileinfo.h>
+#include <QString>
+#include <QFileInfo>
 
 //#define COUT
 
@@ -105,7 +106,7 @@ namespace VISU
   {
     CORBA::String_var aString = theSObject->GetName();
 
-    std::string aName = QString(aString.in()).simplifyWhiteSpace().latin1();
+    std::string aName = QString(aString.in()).simplified().toLatin1().data();
 
     //replace_if(aName.begin(),aName.end(),not1(ptr_fun(isxdigit)),'_');
     replace_if(aName.begin(),aName.end(),TReplacePredicate(),'_');
@@ -178,6 +179,28 @@ namespace VISU
 
 
   //---------------------------------------------------------------------------
+  void SetClippingPlane(Prs3d_i* thePrs, string theName,
+                       std::ostream& theStr,
+                       std::string thePrefix) 
+  {
+    VISU_CutPlaneFunction* aPlane;
+    VISU_Gen_i* aGen = VISU_Gen_i::GetVisuGenImpl();
+    VISU_ClippingPlaneMgr& aMgr = aGen->GetClippingPlaneMgr();
+    int aId;
+    for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) {
+      aPlane = dynamic_cast<VISU_CutPlaneFunction*>(thePrs->GetClippingPlane(i));
+      if (aPlane) {
+       if (!aPlane->isAuto()) {
+         aId = aMgr.GetPlaneId(aPlane);
+         if (aId > -1) {
+           theStr<<thePrefix<<"aVisu.ApplyClippingPlane("<<theName<<", "<<aId<<")"<<endl;
+         }
+       }
+      }
+    }
+  }
+  
+
   void
   Prs3dToPython(VISU::Prs3d_i* theServant,
                std::ostream& theStr,
@@ -187,6 +210,7 @@ namespace VISU
     float x, y, z;
     theServant->GetOffset(x,y,z);
     theStr<<thePrefix<<theName<<".SetOffset("<<x<<", "<<y<<", "<<z<<")"<<endl;
+    SetClippingPlane(theServant, theName, theStr, thePrefix);
   }
 
   //---------------------------------------------------------------------------
@@ -289,10 +313,10 @@ namespace VISU
 
     std::string aParam;
     switch(theServant->GetBarOrientation()){
-    case ColoredPrs3d::HORIZONTAL:
+    case ColoredPrs3dBase::HORIZONTAL:
       aParam = "VISU.ColoredPrs3d.HORIZONTAL";
       break;
-    case ColoredPrs3d::VERTICAL:
+    case ColoredPrs3dBase::VERTICAL:
       aParam = "VISU.ColoredPrs3d.VERTICAL";
       break;
     }
@@ -363,7 +387,7 @@ namespace VISU
 
     QString aMainTexture = theServant->GetQMainTexture();
     QString anAlphaTexture = theServant->GetQAlphaTexture();
-    theStr<<thePrefix<<theName<<".SetTextures('"<<aMainTexture.latin1()<<"', '"<<anAlphaTexture.latin1()<<"')"<<endl;
+    theStr<<thePrefix<<theName<<".SetTextures('"<<aMainTexture.toLatin1().data()<<"', '"<<anAlphaTexture.toLatin1().data()<<"')"<<endl;
 
     theStr<<thePrefix<<theName<<".SetAlphaThreshold("<<theServant->GetAlphaThreshold()<<")"<<endl;
 
@@ -410,11 +434,28 @@ namespace VISU
       aParam = "VISU.LOGARITHMIC";
       break;
     }
+    std::string aVisible = theServant->IsBarVisible()? "True" : "False";
     theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetBarVisible("<<aVisible<<")"<<endl;
 
     return thePrefix;
   }
 
+  //---------------------------------------------------------------------------
+  std::string
+  MonoColorPrsToPython(SALOMEDS::SObject_ptr theSObject,
+                      VISU::MonoColorPrs_i* theServant,
+                      std::ostream& theStr,
+                      const std::string& theName,
+                      TColoredPrs3dFactory& thePrsFactory,
+                      std::string thePrefix)
+  {
+    thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    theStr<<thePrefix<<endl;
+    theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+    return thePrefix;
+  }
 
   //---------------------------------------------------------------------------
   std::string
@@ -425,12 +466,12 @@ namespace VISU
                        TColoredPrs3dFactory& thePrsFactory,
                        std::string thePrefix)
   {
-    thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    thePrefix = MonoColorPrsToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
     theStr<<thePrefix<<endl;
 
     theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
-    theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
-    theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+//     theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+//     theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
 
     return thePrefix;
   }
@@ -446,7 +487,8 @@ namespace VISU
                      TColoredPrs3dFactory& thePrsFactory,
                      std::string thePrefix)
   {
-    thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    thePrefix = MonoColorPrsToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    //    thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
     theStr<<thePrefix<<endl;
     
     std::string aParam;
@@ -490,12 +532,12 @@ namespace VISU
 
   //---------------------------------------------------------------------------
   std::string
-  ScalarMapOnDeformedShapeToPython(SALOMEDS::SObject_ptr theSObject,
-                                  VISU::ScalarMapOnDeformedShape_i* theServant,
-                                  std::ostream& theStr,
-                                  const std::string& theName,
-                                  TColoredPrs3dFactory& thePrsFactory,
-                                  std::string thePrefix)
+  DeformedShapeAndScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
+                                   VISU::DeformedShapeAndScalarMap_i* theServant,
+                                   std::ostream& theStr,
+                                   const std::string& theName,
+                                   TColoredPrs3dFactory& thePrsFactory,
+                                   std::string thePrefix)
   {
     thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
     theStr<<thePrefix<<endl;
@@ -594,6 +636,7 @@ namespace VISU
     theStr<<thePrefix<<endl;
 
     theStr<<thePrefix<<theName<<".SetNbSurfaces("<<theServant->GetNbSurfaces()<<")"<<endl;
+    theStr<<thePrefix<<theName<<".ShowLabels("<<theServant->IsLabeled()<<","<<theServant->GetNbLabels()<<")"<<endl;
 
     return thePrefix;
   }
@@ -634,6 +677,27 @@ namespace VISU
        theStr<<thePrefix<<theName<<".SetPlanePosition("<<anId<<", "<<theServant->GetPlanePosition(anId)<<")"<<endl;
     }
 
+    theStr<<thePrefix<<theName<<".UseDeformation("<<GetBoolean(theServant->IsDeformed())<<")"<<endl;
+    if(theServant->IsDeformed()){
+      theStr<< thePrefix << theName << ".SetScale(" << theServant->GetScale()<<")"<<endl;
+      std::string aStringEntity;
+      VISU::Entity anEntity = theServant->GetVectorialFieldEntity();
+      switch(anEntity){
+      case NODE:
+       aStringEntity = "VISU.NODE";
+       break;
+      case EDGE:
+       aStringEntity = "VISU.EDGE";
+       break;
+      case FACE:
+       aStringEntity = "VISU.FACE";
+       break;
+      case CELL:
+       aStringEntity = "VISU.CELL";
+       break;
+      }
+      theStr<< thePrefix << theName << ".SetVectorialField("<<aStringEntity<<", '" << theServant->GetVectorialFieldName() <<"')"<<endl;
+    }
     return thePrefix;
   }
 
@@ -731,7 +795,6 @@ namespace VISU
     return thePrefix;
   }
 
-
   //---------------------------------------------------------------------------
   // declaration
   void DumpChildrenToPython(SALOMEDS::Study_ptr theStudy,
@@ -770,7 +833,7 @@ namespace VISU
       bool anIsExist;
       QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
       if(anIsExist){
-       if(strcmp(aMethodName.latin1(),"ImportTables") == 0){
+       if(strcmp(aMethodName.toLatin1().data(),"ImportTables") == 0){
          return;
        }
       }
@@ -959,7 +1022,7 @@ namespace VISU
     }
   }
 
-  
+
 
   //---------------------------------------------------------------------------
   void
@@ -1194,6 +1257,7 @@ namespace VISU
              break;
            }
            theStr<<thePrefix<<aName<<".SetPresentationType("<<aParam<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetShrink("<<(aServant->IsShrank()? "True" : "False")<<")"<<endl;
            theStr<<thePrefix<<endl;
 
            DumpChildrenToPython(theStudy,
@@ -1232,9 +1296,10 @@ namespace VISU
           }
           return;
         case VISU::TSCALARMAPONDEFORMEDSHAPE:
-          if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(GetServant(anObj).in())){
-           TCreateFromResult aPrsFactory(theSObject, aServant, aName, "ScalarMapOnDeformedShapeOnField", theArgumentName);
-           thePrefix = ScalarMapOnDeformedShapeToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
+       case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+          if(DeformedShapeAndScalarMap_i* aServant = dynamic_cast<DeformedShapeAndScalarMap_i*>(GetServant(anObj).in())){
+           TCreateFromResult aPrsFactory(theSObject, aServant, aName, "DeformedShapeAndScalarMapOnField", theArgumentName);
+           thePrefix = DeformedShapeAndScalarMapToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
            theStr<<thePrefix<<"pass"<<endl<<endl;
           }
           return;
@@ -1285,6 +1350,78 @@ namespace VISU
             theStr<<thePrefix<<"pass"<<endl<<endl;
           }
           return;
+        case VISU::TPOINTMAP3D:
+          if (PointMap3d_i* aServant = dynamic_cast<PointMap3d_i*>(GetServant(anObj).in())) {
+           CORBA::Short aTag = theSObject->Tag();
+           theStr<<thePrefix<<"anIsFound, aSObject = "<<theArgumentName<<".FindSubObject("<<aTag<<")"<<endl;
+           theStr<<thePrefix<<"if anIsFound:"<<endl;
+           thePrefix += PREFIX;
+           
+           theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
+           theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+           
+           // Set name (as this object could be renamed by user)
+           theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 3"<<endl;
+
+           // Set PointMap3D Properties
+
+           theStr<<thePrefix<<aName<<".SetScaleFactor("<<aServant->GetScaleFactor()<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetContourPrs("<<aServant->GetIsContourPrs()<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetNbOfContours("<<aServant->GetNbOfContours()<<")"<<endl;
+
+           std::string aParam;
+           switch(aServant->GetScaling()){
+           case LINEAR:
+             aParam = "VISU.LINEAR";
+             break;
+           case LOGARITHMIC:
+             aParam = "VISU.LOGARITHMIC";
+             break;
+           }
+           theStr<<thePrefix<<aName<<".SetScaling("<<aParam<<")"<<endl;
+
+           theStr<<thePrefix<<aName<<".SetNbColors("<<aServant->GetNbColors()<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetLabels("<<aServant->GetLabels()<<")"<<endl;
+
+           switch(aServant->GetBarOrientation()){
+           case ColoredPrs3dBase::HORIZONTAL:
+             aParam = "VISU.ColoredPrs3d.HORIZONTAL";
+             break;
+           case ColoredPrs3dBase::VERTICAL:
+             aParam = "VISU.ColoredPrs3d.VERTICAL";
+             break;
+           }
+           theStr<<thePrefix<<aName<<".SetBarOrientation("<<aParam<<")"<<endl;
+
+           if(aServant->IsRangeFixed())
+             theStr<<thePrefix<<aName<<".SetRange("<<aServant->GetMin()<<", "<<aServant->GetMax()<<")"<<endl;
+           else
+             theStr<<thePrefix<<aName<<".SetSourceRange()"<<endl;
+
+           theStr<<thePrefix<<aName<<".SetPosition("<<aServant->GetPosX()<<", "<<aServant->GetPosY()<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetSize("<<aServant->GetWidth()<<", "<<aServant->GetHeight()<<")"<<endl;
+
+           float dx, dy, dz;
+           aServant->GetOffset(dx, dy, dz);
+           theStr<<thePrefix<<aName<<".SetOffset("<<dx<<", "<<dy<<", "<<dz<<")"<<endl;
+
+           
+           theStr<<thePrefix<<endl;
+           
+           theArgumentName = aName;
+           DumpChildrenToPython(theStudy,
+                                theIsPublished,
+                                theIsValidScript,
+                                theSObject,
+                                theStr,
+                                theName2EntryMap,
+                                theEntry2NameMap,
+                                theArgumentName,
+                                thePrefix);
+
+           theStr<<thePrefix<<"pass"<<endl<<endl;
+          }
+          return;
         case VISU::TGAUSSPOINTS:
           if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(GetServant(anObj).in())){
            TCreateFromResult aPrsFactory(theSObject, aServant, aName, "GaussPointsOnField", theArgumentName);
@@ -1350,7 +1487,7 @@ namespace VISU
              bool anIsExist;
              QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist);
              if(anIsExist){
-               if(strcmp(aSourceId.latin1(),"CutLines") == 0){
+               if( aSourceId == "CutLines" ){
                  theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<theArgumentName<<"'):"<<endl;
                  thePrefix += PREFIX;
 
@@ -1382,7 +1519,7 @@ namespace VISU
 
                  theStr<<thePrefix<<"pass"<<endl<<endl;
                  theStr<<aPrefix<<"pass"<<endl<<endl;
-               }else if(strcmp(aSourceId.latin1(),"TableFile") == 0){
+               }else if( aSourceId == "TableFile" ){
                  CORBA::Short aTag = theSObject->Tag();
                  theStr<<thePrefix<<"anIsFound, aSObject = "<<theArgumentName<<".FindSubObject("<<aTag<<")"<<endl;
                  theStr<<thePrefix<<"if anIsFound:"<<endl;
@@ -1408,7 +1545,7 @@ namespace VISU
                                       thePrefix);
 
                  theStr<<thePrefix<<"pass"<<endl<<endl;
-               }else if(strcmp(aSourceId.latin1(),"TableAttr") == 0){
+               }else if( aSourceId == "TableAttr" ){
                  theArgumentName = aName;
                  DumpTableAttrToPython(theStudy,
                                        theIsPublished,
@@ -1437,11 +1574,11 @@ namespace VISU
        bool anIsExist;
        QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
        if (anIsExist) {
-         if (strcmp(aTypeName.latin1(),"ImportTables") == 0) {
+         if (aTypeName == "ImportTables") {
            QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist);
            if(anIsExist){
              std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
-             theStr<<thePrefix<<aName<<" = aVisu.ImportTables('"<<aFileName.latin1()<<"')"<<endl;
+             theStr<<thePrefix<<aName<<" = aVisu.ImportTables('"<<aFileName.toLatin1().data()<<"')"<<endl;
              theStr<<thePrefix<<"if "<<aName<<":"<<endl;
              thePrefix += PREFIX;
 
@@ -1459,7 +1596,7 @@ namespace VISU
              theStr<<thePrefix<<"pass"<<endl<<endl;
              return;
            }
-         } else if (strcmp(aTypeName.latin1(),"VIEW3D") == 0) {
+         } else if (aTypeName == "VIEW3D") {
            std::string aName = GetName(theSObject);
            theStr<<thePrefix<<aName<<" = aBuilder.NewObject(aSComponent)"<<endl;
 
@@ -1476,8 +1613,8 @@ namespace VISU
            return;
          } else if (aTypeName == "ENTITY" || aTypeName == "FAMILY" || aTypeName == "GROUP") {
            // Set name (as this object could be renamed by user)
-           string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
-           string aSubMeshName = VISU::Storable::FindValue(aMap,"myName").latin1();
+           string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").toLatin1().data();
+           string aSubMeshName = VISU::Storable::FindValue(aMap,"myName").toLatin1().data();
            string anEntityTypeKey = "myEntityId";
            if (aTypeName == "ENTITY") anEntityTypeKey = "myId";
            int anEntity = VISU::Storable::FindValue(aMap,anEntityTypeKey,"0").toInt();
@@ -1721,8 +1858,9 @@ namespace VISU
                    break;
                  }
                case VISU::TSCALARMAPONDEFORMEDSHAPE:
-                 if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(aDevice)){
-                   ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+               case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+                 if(DeformedShapeAndScalarMap_i* aServant = dynamic_cast<DeformedShapeAndScalarMap_i*>(aDevice)){
+                   DeformedShapeAndScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
                    break;
                  }
                case VISU::TVECTORS:
@@ -1801,12 +1939,12 @@ namespace VISU
       //ANIMATION
       theStr<<thePrefix<<endl;
       QString animName = aSObject->GetName();
-      theStr<<thePrefix<<"#Animation: "<<animName<<endl;
+      theStr<<thePrefix<<"#Animation: "<<animName.toLatin1().data()<<endl;
       theStr<<thePrefix<<endl;
       theStr<<thePrefix<<"animSO = aBuilder.NewObject(aSComponent)"<<endl;
-      theStr<<thePrefix<<"aBuilder.SetName(animSO, '"<<animName<<"')"<< endl;
+      theStr<<thePrefix<<"aBuilder.SetName(animSO, '"<<animName.toLatin1().data()<<"')"<< endl;
       theStr<<thePrefix<<"strAttr = aBuilder.FindOrCreateAttribute(animSO, 'AttributeString')"<< endl;
-      theStr<<thePrefix<<"strAttr.SetValue('"<<value<<"')"<< endl;
+      theStr<<thePrefix<<"strAttr.SetValue('"<<value.toLatin1().data()<<"')"<< endl;
 
 
     
@@ -1828,10 +1966,10 @@ namespace VISU
          value = refObj->GetName();
          QString path(theStudy->GetObjectPath(father));
          //The following code requierd as a field name can contain '/' character
-         theStr<<thePrefix<<"aBuilder.Addreference(fieldSO,getSObjectByFatherPathAndName(theStudy, '"<<path<<"', '"<<value<<"'))"<<endl;
+         theStr<<thePrefix<<"aBuilder.Addreference(fieldSO,getSObjectByFatherPathAndName(theStudy, '"<<path.toLatin1().data()<<"', '"<<value.toLatin1().data()<<"'))"<<endl;
        }
        value = anObj->GetName();
-       if(!value.isEmpty()) theStr<<thePrefix<<"aBuilder.SetName(fieldSO, '"<<value<<"')"<< endl;
+       if(!value.isEmpty()) theStr<<thePrefix<<"aBuilder.SetName(fieldSO, '"<<value.toLatin1().data()<<"')"<< endl;
 
        //SCALARMAP,...
        SALOMEDS::ChildIterator_var aSubIter = theStudy->NewChildIterator(anObj);
@@ -1840,7 +1978,7 @@ namespace VISU
          
          theStr<<thePrefix<<"subSO = aBuilder.NewObject(fieldSO)"<<endl;
          value = aSubObj->GetName();
-         if(!value.isEmpty()) theStr<<thePrefix<<"aBuilder.SetName(subSO, '"<<value<<"')"<< endl;
+         if(!value.isEmpty()) theStr<<thePrefix<<"aBuilder.SetName(subSO, '"<<value.toLatin1().data()<<"')"<< endl;
          if (aSubObj->FindAttribute(anAttr, "AttributeString")) {
            aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr);
            theStr<<thePrefix<<"strAttr = aBuilder.FindOrCreateAttribute(subSO, 'AttributeString')"<< endl;
@@ -1855,6 +1993,35 @@ namespace VISU
     theStr<<thePrefix<<endl;
   }
 
+
+  void
+  DumpClippingPlanesToPython(SALOMEDS::Study_ptr theStudy,
+                            CORBA::Boolean theIsPublished,
+                            CORBA::Boolean& theIsValidScript,
+                            SALOMEDS::SObject_ptr theSObject,
+                            std::ostream& theStr,
+                            std::string thePrefix,
+                            VISU_ClippingPlaneMgr& thePlaneMgr)
+  {
+
+    if(!theIsPublished) return;
+
+    VISU_CutPlaneFunction* aPlane;
+    double aOrigin[3], aDir[3];
+    for (int i = 0; i < thePlaneMgr.GetClippingPlanesNb(); i++) {
+      aPlane = thePlaneMgr.GetClippingPlane(i);
+      aPlane->GetOrigin(aOrigin);
+      aPlane->GetNormal(aDir);
+
+      theStr<<thePrefix<<"aVisu.CreateClippingPlane("<<
+       aOrigin[0]<<","<<aOrigin[1]<<","<<aOrigin[2]<<","<<
+       aDir[0]<<","<<aDir[1]<<","<<aDir[2]<<","<<
+       aPlane->isAuto()<<",\""<<aPlane->getName()<<"\")"<<endl;      
+    }
+    theStr<<endl;
+  }  
+
+
   //---------------------------------------------------------------------------
   Engines::TMPFile*
   VISU_Gen_i::
@@ -1895,6 +2062,16 @@ namespace VISU
     aStr<<endl;
 
     SALOMEDS::SComponent_var aComponent = FindOrCreateVisuComponent(aStudy);
+
+    VISU::DumpClippingPlanesToPython(aStudy,
+                                    theIsPublished,
+                                    theIsValidScript,
+                                    aComponent.in(),
+                                    aStr,
+                                    aPrefix, 
+                                    myClippingPlaneMgr);
+
+
     VISU::DumpChildrenToPython(aStudy,
                               theIsPublished,
                               theIsValidScript,
@@ -1932,6 +2109,7 @@ namespace VISU
                                 aStr,
                                 aPrefix);
 
+
     //Output the script that sets up the visul parameters.
     if(theIsPublished) {
       char* script = aStudy->GetDefaultScript("Post-Pro", aPrefix.c_str());