From 447761e69d8a7fa8be1d6cacd45ec8beea149bea Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 27 Aug 2009 08:17:57 +0000 Subject: [PATCH] Issue 20429: [ CEA 345 ] Python split views does not work with VISU --- src/VISU_SWIG/visu_split_views.py | 124 +++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 10 deletions(-) diff --git a/src/VISU_SWIG/visu_split_views.py b/src/VISU_SWIG/visu_split_views.py index 42de24e4..9d20a934 100644 --- a/src/VISU_SWIG/visu_split_views.py +++ b/src/VISU_SWIG/visu_split_views.py @@ -22,14 +22,29 @@ 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,22 +130,37 @@ 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()" @@ -119,31 +170,84 @@ 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 Cut Segment") + +aCutSegment = myVisu.CutSegmentOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) +print "aCutSegment = myVisu.CutSegmentOnField(...)" +aCutSegment.SetPoint1(0.0,0.0,0.0) +print "aCutSegment.SetPoint1(0.0,0.0,0.0)" +aCutSegment.SetPoint2(0.4,0.05,1.0) +print "aCutSegment.SetPoint2(0.4,0.05,1.0)" + +myView7.DisplayOnly(aCutSegment) +print "myView7.DisplayOnly(aCutSegment)" + +myView7.FitAll(); +print "myView7.FitAll()" + +sleep(DELAY) ################################################ myView6.OnTop() print "myView6.OnTop()" +sleep(DELAY) + myView4.Attract(myView2) print "myView4.Attract(myView2)" +sleep(DELAY) + myView4.SetRelativePositionInSplitter(0.7) print "myView4.SetRelativePositionInSplitter(0.7)" +sleep(DELAY) + myView4.SetRelativePositionX(0.2) print "myView4.SetRelativePositionX(0.7)" -#myView4.SetRelativePositionY(0.2) -#print "myView4.SetRelativePositionY(0.2)" +sleep(DELAY) -- 2.39.2