]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Issue 20429: [ CEA 345 ] Python split views does not work with VISU
authorvsr <vsr@opencascade.com>
Thu, 27 Aug 2009 11:57:24 +0000 (11:57 +0000)
committervsr <vsr@opencascade.com>
Thu, 27 Aug 2009 11:57:24 +0000 (11:57 +0000)
src/VISU_SWIG/visu_split_views.py

index 42de24e40793ee821bb80c8c3cd5f4b7dd080d1a..520cc546d785afdf151e7138f2ce35742958abf8 100644 (file)
 import VISU
 import SALOMEDS
 from visu_gui import *
+from time import sleep
+
+DELAY = 2
 
 myViewManager = myVisu.GetViewManager()
 
 ################################################
 
+medFile = "fra.med"
+myFieldName = "VITESSE";
+
+aMeshName ="LE VOLUME"
+anEntity = VISU.NODE
+aTimeStampId = 1
+
+medFile = os.path.join(os.getenv('DATA_DIR'), 'MedFiles', medFile)
+myResult = myVisu.ImportFile(medFile)
+
+################################################
+
 myView1 = myViewManager.Create3DView()
-myView1.SetTitle("The window will be soon destroyed!")
 print "myView1 = myViewManager.Create3DView()"
+myView1.SetTitle("The window will be soon destroyed!")
 
 myView1.Maximize()
 print "myView1.Maximize()"
@@ -40,6 +55,8 @@ print "myView1.Restore()"
 myView1.Minimize()
 print "myView1.Minimize()"
 
+sleep(DELAY)
+
 myViewManager.Destroy(myView1)
 print "myViewManager.Destroy(myView1)"
 
@@ -47,23 +64,34 @@ print "myViewManager.Destroy(myView1)"
 
 myView2 = myViewManager.Create3DView()
 print "myView2 = myViewManager.Create3DView()"
-myView2.SetTitle("myView2")
+myView2.SetTitle("The window to display Scalar Map")
 
 aColor = SALOMEDS.Color(0.0,0.3,1.0)
-myView2.SetBackground(aColor)
 print "aColor = SALOMEDS.Color(0.0,0.3,1.0)"
+myView2.SetBackground(aColor)
 print "myView2.SetBackground(aColor)"
 
+aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+print "myVisu.ScalarMapOnField(...)"
+
+myView2.Display(aScalarMap);
+print "myView2.Display(aScalarMap)"
+
 myView2.SetFocalPoint([0,0,0])
 print "myView2.SetFocalPoint([0,0,0])"
 myView2.SetParallelScale(2)
 print "myView2.SetParallelScale(2)"
 
+myView2.FitAll()
+print "myView3.FitAll"
+
+sleep(DELAY)
+
 ################################################
 
 myView3 = myViewManager.Create3DView()
 print "myView3 = myViewManager.Create3DView()"
-myView3.SetTitle("myView3")
+myView3.SetTitle("The window to display Cut Planes")
 
 myView3.SplitRight()
 print "myView3.SplitRight()"
@@ -73,6 +101,14 @@ print "aColor = SALOMEDS.Color(0.0,0.7,0.0)"
 myView3.SetBackground(aColor)
 print "myView3.SetBackground(aColor)"
 
+aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+print "myVisu.CutPlanesOnField(...)"
+aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0)
+print "aCutPlanes.SetOrientation(...)"
+
+myView3.DisplayOnly(aCutPlanes);
+print "myView3.DisplayOnly(aCutPlanes)"
+
 aPoint = myView3.GetPointOfView()
 aPoint[0] = aPoint[0] + 10
 myView3.SetPointOfView(aPoint)
@@ -94,56 +130,112 @@ print "myView3.Update()"
 myView3.FitAll()
 print "myView3.FitAll()"
 
+sleep(DELAY)
+
 ################################################
 
 myView4 = myViewManager.Create3DView()
 print "myView4 = myViewManager.Create3DView()"
-myView4.SetTitle("myView4")
+myView4.SetTitle("The window to display Iso Surfaces")
 
 aColor = SALOMEDS.Color(1.0,0.7,0.0)
 print "aColor = SALOMEDS.Color(1.0,0.7,0.0)"
 myView4.SetBackground(aColor)
 print "myView4.SetBackground(aColor)"
 
+aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+print "aIsoSurfaces = myVisu.IsoSurfacesOnField(...)"
+aIsoSurfaces.SetNbSurfaces(10)
+print "aIsoSurfaces.SetNbSurfaces(10)"
+
+myView4.DisplayOnly(aIsoSurfaces)
+print "myView4.DisplayOnly(aIsoSurfaces)"
+
+myView4.FitAll()
+print "myView4.FitAll()"
+
+sleep(DELAY)
+
 ################################################
 
 myView5 = myViewManager.Create3DView()
 print "myView5 = myViewManager.Create3DView()"
-myView5.SetTitle("myView5")
+myView5.SetTitle("The window to display Cut Lines")
 
-myView5.SplitTop()
-print "myView5.SplitTop()"
+myView5.SplitBottom()
+print "myView5.SplitBottom()"
 
 aColor = SALOMEDS.Color(0.7,0.7,0.7)
 print "aColor = SALOMEDS.Color(0.7,0.7,0.7)"
 myView5.SetBackground(aColor)
 print "myView5.SetBackground(aColor)"
 
+aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+print "aCutLines = myVisu.CutLinesOnField(...)"
+aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0)
+print "aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0)"
+aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0)
+print "aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0)"
+
+myView5.DisplayOnly(aCutLines)
+print "myView5.DisplayOnly(aCutLines)"
+myView5.FitAll()
+print "myView5.FitAll()"
+
+sleep(DELAY)
+
 ################################################
 
 myView6 = myViewManager.CreateXYPlot()
 print "myView6 = myViewManager.CreateXYPlot()"
-myView6.SetTitle("myView6")
+myView6.SetTitle("The window to display curves")
+
+aSObj = myStudy.FindObjectIOR(aCutLines.GetID())
+aTable = myVisu.CreateTable( aSObj.GetID() )
+print "aTable = myVisu.CreateTable(...)"
+
+aContainer = myVisu.CreateContainer()
+print "aContainer = myVisu.CreateContainer(...)"
+
+aNbCurve = aTable.GetNbRows() - 1
+for i in range(2,aNbCurve):
+   aCurve = myVisu.CreateCurve( aTable, 1, i )
+   print "myVisu.CreateCurve(aTable, 1, %d)" % i
+   aContainer.AddCurve(aCurve)
+   pass
+
+myView6.Display(aContainer)
+print "myView6.Display(aContainer)"
+
+sleep(DELAY)
 
 ################################################
 
 myView7 = myViewManager.Create3DView()
 print "myView7 = myViewManager.Create3DView()"
-myView7.SetTitle("myView7")
+myView7.SetTitle("The window to display Vectors")
 
-################################################
+aVectors = myVisu.VectorsOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+print "aVectors = myVisu.VectorsOnField"
+aVectors.ShowColored(True)
+print "aVectors.ShowColores(True)"
 
-myView6.OnTop()
-print "myView6.OnTop()"
+myView7.DisplayOnly(aVectors)
+print "myView7.DisplayOnly(aVectors)"
+
+myView7.FitAll();
+print "myView7.FitAll()"
+
+sleep(DELAY)
+
+################################################
 
 myView4.Attract(myView2)
 print "myView4.Attract(myView2)"
 
-myView4.SetRelativePositionInSplitter(0.7)
-print "myView4.SetRelativePositionInSplitter(0.7)"
+sleep(DELAY)
 
-myView4.SetRelativePositionX(0.2)
-print "myView4.SetRelativePositionX(0.7)"
+myView7.OnTop()
+print "myView6.OnTop()"
 
-#myView4.SetRelativePositionY(0.2)
-#print "myView4.SetRelativePositionY(0.2)"
+sleep(DELAY)