From: jfa Date: Mon, 25 Apr 2005 10:23:56 +0000 (+0000) Subject: Provide VISU examples X-Git-Tag: smh_before_merge~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=69c1a8ca8ce2df9d7ce7ddc38f3cfc8b6d77e8ee;p=modules%2Fvisu.git Provide VISU examples --- diff --git a/Makefile.in b/Makefile.in index 85b1b76d..2a306bf1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,7 +14,7 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl: @COMMENCE@ -SUBDIRS = idl src doc +SUBDIRS = idl src examples doc RESOURCES_FILES = \ ModuleVisu.png \ diff --git a/examples/Fields_group3D.med b/examples/Fields_group3D.med new file mode 100644 index 00000000..95601774 Binary files /dev/null and b/examples/Fields_group3D.med differ diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 00000000..52f3a639 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,33 @@ +# Copyright (C) 2005 CEA/DEN, EDF R&D +# +# +# +# File : Makefile.in +# Author : Vasily Rusyaev (Open Cascade NN) +# Module : examples +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ +curdir = $(shell pwd) +instdatadir=${prefix}/examples + +SUBDIRS=. + +@COMMENCE@ + +data: + (cd $(srcdir) ; cp -fr `ls | grep -v "Makefile.in"` $(curdir)) + +clean: + rm -rf `ls | grep -v "Makefile"` + +install: + rm -rf $(instdatadir) + mkdir $(instdatadir) + cp -rf `ls | grep -v "Makefile"` $(instdatadir) + +uninstall: + rm -rf $(instdatadir) diff --git a/examples/ResOK_0000.med b/examples/ResOK_0000.med new file mode 100644 index 00000000..47afde89 Binary files /dev/null and b/examples/ResOK_0000.med differ diff --git a/examples/VISU_Example_01.py b/examples/VISU_Example_01.py new file mode 100644 index 00000000..8de2ce6c --- /dev/null +++ b/examples/VISU_Example_01.py @@ -0,0 +1,191 @@ +# T 2.23, 28: Displaying fields (scalar and vectorial) on nodes, change presentation options. +# Uses MED files ResOK_0000.med and Fields_group3D.med +# +# This script is equivalent to non-regression test script 003/A1 + +import salome +import visu_gui +import SALOMEDS +import VISU +import os + +datadir = os.getenv("VISU_ROOT_DIR") + "/examples/" + +#%====================Stage1: Creating a new study====================% + +print "**** Stage1: Creating a new study" + +print "Creating a new study..................", +myVisu = visu_gui.myVisu +myVisu.SetCurrentStudy(salome.myStudy) +myViewManager = myVisu.GetViewManager() +if myViewManager is None : print "Error" +else : print "OK" + +#%====================Stage2: Importing MED file====================% + +print "**** Stage2: Importing MED file" + +print 'Import "ResOK_0000.med"...............', +medFile = datadir + "ResOK_0000.med" +myResult = myVisu.ImportFile(medFile) +if myResult is None : print "Error" +else : print "OK" + +print 'Creating new View3D...................', +myView = myViewManager.Create3DView() +if myView is None : print "Error" +else : print "OK" + +myMeshName = 'dom' +myCellEntity = VISU.CELL +myNodeEntity = VISU.NODE + +#%====================Stage3: Displaying vector field====================% + +print "**** Stage3: Displaying vector field" + +print "Creating Scalar Map.......", +scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if scalarmap is None : print "Error" +else : print "OK" +scalarmap.SetSize(0.15, 0.8) +myView.DisplayOnly(scalarmap) +myView.FitAll() + +print "Creating Stream Lines.....", +streamlines = myVisu.StreamLinesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if streamlines is None : print "Error" +else : print "OK" +myView.DisplayOnly(streamlines) + +print "Creating Vectors..........", +vectors = myVisu.VectorsOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if vectors is None : print "Error" +else : print "OK" +myView.DisplayOnly(vectors) + + +print "Creating Iso Surfaces.....", +isosurfaces = myVisu.IsoSurfacesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if isosurfaces is None : print "Error" +else : print "OK" +myView.DisplayOnly(isosurfaces) + +print "Creating Cut Planes.......", +cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if cutplanes is None : print "Error" +else : print "OK" +cutplanes.SetNbPlanes(30) +cutplanes.SetOrientation(VISU.CutPlanes.YZ, 0, 0) +myView.DisplayOnly(cutplanes) + +#%====================Stage4: Opening a new study and Med file import====================% + +print "**** Stage4: Opening a new study and Med file import" + +print "Creating a new study..................", +newStudy = salome.myStudyManager.NewStudy('newStudy') +myVisu.SetCurrentStudy(newStudy) +myViewManager = myVisu.GetViewManager() +myView = myViewManager.Create3DView() +if myView is None : print "Error" +else : print "OK" + +print 'Importing "Fields_group3D.med"........', +medFile = datadir + "Fields_group3D.med" +myResult1 = myVisu.ImportFile(medFile) +if myResult1 is None : print "Error" +myView1 = myViewManager.Create3DView() +if myView1 is None : print "Error" +else : print "OK" + +#%====================Stage5: Displaying scalar field====================% + +print "**** Stage5: Displaying scalar field" + +myMeshName1 = 'mailles_MED' + +print "Creating Scalar Map.......", +scalarmap1 = myVisu.ScalarMapOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1); +if scalarmap1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(scalarmap1) +myView1.FitAll() + +print "Creating Iso Surfaces.....", +isosurfaces1 = myVisu.IsoSurfacesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1); +if isosurfaces1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(isosurfaces1) + +print "Creating Cut Planes.......", +cutplanes1 = myVisu.CutPlanesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1); +if cutplanes1 is None : print "Error" +else : print "OK" +cutplanes1.SetOrientation(VISU.CutPlanes.YZ, 0, 0) +myView1.DisplayOnly(cutplanes1) + +#%====================Stage6: Object browser popup====================% + +print "**** Stage6: Object browser popup" + +print "Creating mesh.............", +mesh = myVisu.MeshOnEntity(myResult1,myMeshName1,myCellEntity); +if mesh is None : print "Error" +else : print "OK" +myView1.DisplayOnly(mesh) + + +print "Changing type of presentation of mesh:" +mesh.SetPresentationType(VISU.WIREFRAME) +PrsType = mesh.GetPresentationType() +print "Presentation type..", PrsType +myView1.DisplayOnly(mesh) + +mesh.SetPresentationType(VISU.SHADED) +PrsType = mesh.GetPresentationType() +print "Presentation type.....", PrsType +myView1.DisplayOnly(mesh) + +mesh.SetPresentationType(VISU.POINT) +PrsType = mesh.GetPresentationType() +print "Presentation type......", PrsType +myView1.DisplayOnly(mesh) +myView1.Update() + +mesh.SetPresentationType(VISU.SHRINK) +PrsType = mesh.GetPresentationType() +print "Presentation type.....", PrsType +myView1.DisplayOnly(mesh) + +print "Changing color of mesh....", +aColor = SALOMEDS.Color(0,0,1) +mesh.SetCellColor(aColor) +myView1.DisplayOnly(mesh) +print "OK" + +print "Renaming ScalarMap........", +SObj = newStudy.FindObjectIOR(scalarmap1.GetID()) +newName = 'Renamed Object' +SObj.Name = newName +print "OK" + +print "Deleting Cut Planes.......", +SObj = newStudy.FindObjectIOR(cutplanes1.GetID()) +myBuilder = newStudy.NewBuilder() +myBuilder.RemoveObject(SObj) +print "OK" + +print "Changing first IsoSurfaces", +myVisu.SetCurrentStudy(salome.myStudy) +myView.DisplayOnly(isosurfaces) +isosurfaces.SetNbSurfaces(25) +print "OK" + +myView.Maximize() +myView.DisplayOnly(isosurfaces) + +print "Hide IsoSurfaces..........", +myView.Erase(isosurfaces) +print "OK" diff --git a/examples/VISU_Example_02.py b/examples/VISU_Example_02.py new file mode 100644 index 00000000..a54f206d --- /dev/null +++ b/examples/VISU_Example_02.py @@ -0,0 +1,343 @@ +# T 2.24: Save/retrieve view parameters. +# Uses MED file fra.med from ${KERNEL_ROOT_DIR}/examples directory. +# +# This script is equivalent to non-regression test script 003/A3 + +import salome +import visu_gui +import SALOMEDS +import VISU +import os + +medFile = os.getenv("KERNEL_ROOT_DIR") + "/examples/fra.med" + +#%====================Stage1: Creating a new study====================% + +print "**** Stage1: Creating a new study " + +print "Creating a new study..................", +myVisu = visu_gui.myVisu +myVisu.SetCurrentStudy(salome.myStudy) +myViewManager = myVisu.GetViewManager() +if myViewManager is None : print "Error" +else : print "OK" + +#%====================Stage2: Saving view parameters before import====================% + +print "**** Stage2: Saving view parameters before import " + +myView = myViewManager.Create3DView() + +print "Zooming trihedron.....................", +aScale = myView.GetParallelScale() +myView.SetParallelScale(aScale*4) +print "OK" + +print "Rotating trihedron....................", +aPoint = (100,100,100) +myView.SetPointOfView(aPoint) +print "OK" + +print "Saving view parameters................", +aViewParamsName1 = 'ViewParams:1' +aSaveRes = myView.SaveViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +#%====================Stage3: Import MED file====================% + +print "**** Stage3: Import MED file" + +print 'Importing "fra.med"...................', +myResult = myVisu.ImportFile(medFile) +if myResult is None : print "Error" +else : print "OK" + +print "Creating mesh.........................", +myMeshName = 'LE VOLUME' +myCellEntity = VISU.CELL +mesh = myVisu.MeshOnEntity(myResult,myMeshName,myCellEntity); +if mesh is None : print "Error" +else : print "OK" + +myView.Maximize() +myView.Display(mesh) +myView.FitAll() + +#%====================Stage4: Saving view parameters after import====================% + +print "**** Stage4: Saving view parameters after import" + +print "Creating Scalar Map...................", +myFieldName = 'TAUX_DE_VIDE' +myNodeEntity = VISU.NODE +scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,myFieldName,1); +if scalarmap is None : print "Error" +else : print "OK" +myView.DisplayOnly(scalarmap) + +print "Zooming 3D view.......................", +aScale = myView.GetParallelScale() +myView.SetParallelScale(aScale*2) +print "OK" + +print "Setting view point(LEFT)..............", +myView.SetView((VISU.View3D.LEFT)) +print "OK" + +print "Saving view parameters................", +aViewParamsName2 = 'ViewParams:2' +aSaveRes = myView.SaveViewParams(aViewParamsName2) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Creating Cut Planes...................", +cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,myFieldName,1); +if cutplanes is None : print "Error" +else : print "OK" +cutplanes.SetNbPlanes(4) +myView.DisplayOnly(cutplanes) + +print "Setting scaling.......................", + +#Define parameters of scaling: +myXParam = 5 +myYParam = 5 +myZParam = 1 + +myXAxis = VISU.View3D.XAxis +myYAxis = VISU.View3D.YAxis +myZAxis = VISU.View3D.ZAxis + +myView.ScaleView(myXAxis,myXParam) +myView.ScaleView(myYAxis,myYParam) +myView.ScaleView(myZAxis,myZParam) +print "OK" + +print "Rotating 3d view......................", +aPoint = (100,40,0) +myView.SetPointOfView(aPoint) +print "OK" + +print "Fit All...............................", +myView.FitAll() +print "OK" + +print "Saving view parameters................", +aViewParamsName3 = 'ViewParams:3' +aSaveRes = myView.SaveViewParams(aViewParamsName3) +if aSaveRes != 1 : print "Error" +else : print "OK" + +#%====================Stage5: Restoring view parameters====================% + +print "**** Stage5: Restoring view parameters" + +print "Restoring first view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName1) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Restoring second view parameters......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName2) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaing only Scalar Map.............", +myView.DisplayOnly(scalarmap) +print "OK" + +print "Displaing only Cut Planes.............", +myView.DisplayOnly(cutplanes) +print "OK" + +print "Restoring third view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName3) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaing only Mesh...................", +myView.DisplayOnly(mesh) +print "OK" + +print "Displaing only Scalar Map.............", +myView.DisplayOnly(scalarmap) +print "OK" + +print "Displaing only Cut Planes.............", +myView.DisplayOnly(cutplanes) +print "OK" + +#%====================Stage6: Changing of view parameters====================% + +print "**** Stage6: Changing of view parameters" + +print "Remove scaling........................", +myView.RemoveScale() +print "OK" + +print "Fit All...............................", +myView.FitAll() +print "OK" + +print "Rotating 3d view......................", +aPoint = (0,60,150) +myView.SetPointOfView(aPoint) +print "OK" + +print "Resaving first view parameters........", +aSaveRes = myView.SaveViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Restoring third view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName3) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Restoring first view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName1) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaying only Mesh..................", +myView.DisplayOnly(mesh) +print "OK" + +print "Displaying only Scalar Map............", +myView.DisplayOnly(scalarmap) +print "OK" + +#%====================Stage7: Saving of created view parameters====================% + +print "**** Stage7: Saving of created view parameters" + +print "Saving study..........................", + +str = os.getenv("TmpDir") +if str == None: + str = "/tmp" + +file = str+'/VISU_005.hdf' + +salome.myStudyManager.SaveAs(file, salome.myStudy, 0) +#salome.myStudyManager.Close(salome.myStudy) +#salome.myStudy.Close() +print "OK" + +print "Opening just saved study..............", + +openedStudy = salome.myStudyManager.Open(file) +myVisu.SetCurrentStudy(openedStudy) +myViewManager = myVisu.GetViewManager() +myView1 = myViewManager.Create3DView() +if myView1 is None : print "Error" +else : print "OK" + +print "Restoring first view parameters.......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName1) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +Builder = openedStudy.NewBuilder() +SCom = openedStudy.FindComponent("VISU") +Builder.LoadWith(SCom ,myVisu) + +print "Displaying Scalar Map.................", +SObj = openedStudy.FindObject('ScalarMap') +scalarmap1 = visu_gui.visu.SObjectToObject(SObj) +if scalarmap1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(scalarmap1) + +print "Displaying Cut Planes.................", +SObj = openedStudy.FindObject('CutPlanes') +cutplanes1 = visu_gui.visu.SObjectToObject(SObj) +if cutplanes1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(cutplanes1) + +print "Restoring second view parameters......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName2) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaying Scalar Map.................", +myView1.DisplayOnly(scalarmap1) +print "OK" + +print "Restoring third view parameters.......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName3) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaying Cut Planes.................", +myView1.DisplayOnly(cutplanes1) +print "OK" + +#%====================Stage8: Changing of saved session====================% + +print "**** Stage8: Changing of saved session" + +print "Deleting ViewParams:3,1,2.............", +SObj = openedStudy.FindObject(aViewParamsName3) +Builder.RemoveObject(SObj) +SObj = openedStudy.FindObject(aViewParamsName1) +Builder.RemoveObject(SObj) +SObj = openedStudy.FindObject(aViewParamsName2) +Builder.RemoveObject(SObj) +print "OK" + +print "Zooming trihedron.....................", +aScale = myView.GetParallelScale() +myView1.SetParallelScale(aScale*2) +myView1.Update() +print "OK" + +print "Rotating trihedron....................", +aPoint = (200,40,-40) +myView1.SetPointOfView(aPoint) +print "OK" + +print "Saving view parameters................", +aSaveRes = myView1.SaveViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Renaming ViewParams:1.................", +SObj = openedStudy.FindObject(aViewParamsName1) +SObj.Name = "New_view" +print "OK" + +print "Setting scaling.......................", +#Define parameters of scaling: +myXParam = 4 +myYParam = 4 +myZParam = 8 + +myXAxis = VISU.View3D.XAxis +myYAxis = VISU.View3D.YAxis +myZAxis = VISU.View3D.ZAxis + +myView1.ScaleView(myXAxis,myXParam) +myView1.ScaleView(myYAxis,myYParam) +myView1.ScaleView(myZAxis,myZParam) +print "OK" + +myView1.FitAll() + +print "Saving view parameters................", +aSaveRes = myView1.SaveViewParams(aViewParamsName2) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Restoring first view parameters.......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Restoring second view parameters......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName2) +if aRestoreRes != 1 : print "Error" +else : print "OK" + diff --git a/examples/VISU_Example_03.py b/examples/VISU_Example_03.py new file mode 100644 index 00000000..c64de44b --- /dev/null +++ b/examples/VISU_Example_03.py @@ -0,0 +1,60 @@ +# Animation of "vitesse" field, stored in file TimeStamps.med +# +# This script is equivalent to non-regression test script 003/A5 + +import salome +import visu_gui +import SALOMEDS +import VISU +import os +import time + +medFile = os.getenv("KERNEL_ROOT_DIR") + "/examples/TimeStamps.med" + +print 'Importing "TimeStamps.med"................', +myVisu = visu_gui.myVisu +myResult = myVisu.ImportFile(medFile) +if myResult is None : print "Error" +else : print "OK" + +print "Creating Cut Lines........................", +medMesh = 'dom' +medField = "vitesse" +aCutLines = myVisu.CutLinesOnField(myResult,'dom',VISU.NODE,medField,1.0) +aCutLines.SetOrientation(VISU.CutPlanes.XY, 0, 0) +aCutLines.SetOrientation2(VISU.CutPlanes.ZX, 0, 0) +aCutLines.SetNbLines(20) +if aCutLines is None : print "Error" +else : print "OK" + +print "Creating a Viewer.........................", +myViewManager = myVisu.GetViewManager(); +myView = myViewManager.Create3DView(); +if myView is None : print "Error" +else : print "OK" +myView.Display(aCutLines); +myView.FitAll(); + +aCutLinesSObj = salome.myStudy.FindObjectIOR(aCutLines.GetID()) +aFather = aCutLinesSObj.GetFather().GetFather(); + +print "Creating an Animation.....................", +myAnim = myVisu.CreateAnimation(myView); +if myAnim is None : print "Error" +else : print "OK" + +print "Animation.................................", +myAnim.addField(aFather); +myAnim.generatePresentations(0); +myAnim.generateFrames(); +myAnim.setSpeed(33) +myAnim.startAnimation(); + +myView.FitAll() +while 1: + time.sleep(1) + if not myAnim.isRunning(): + myAnim.stopAnimation() + break + +print "OK" diff --git a/examples/VISU_Example_04.py b/examples/VISU_Example_04.py new file mode 100644 index 00000000..71e40845 --- /dev/null +++ b/examples/VISU_Example_04.py @@ -0,0 +1,255 @@ +# Show some results presentations in different 3D and 2D viewers +# with different options (view parameters and display modes). +# Uses MED files fra.med and TimeStamps.med from ${KERNEL_ROOT_DIR}/examples directory. +# +# Pay attention to a viewer title to know its purpose. +# +# This script is equivalent to script VISU_SWIG/visu_view3d.py + +import os +import time +import math +import VISU +import SALOMEDS +from visu_gui import * + +aDelay = 1 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be soon destroyed!") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +myView.Maximize() +print "myView.Maximize()" +time.sleep(aDelay) + +myView.Restore() +print "myView.Restore()" +time.sleep(aDelay) + +myView.Minimize() +print "myView.Minimize()" +time.sleep(aDelay) + +myViewManager.Destroy(myView) +print "myViewManager.Destroy(myView)" +time.sleep(aDelay) + + +medFile = "fra.med" +myFieldName = "VITESSE"; + +aMeshName ="LE VOLUME" +anEntity = VISU.NODE +aTimeStampId = 1 + +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile +myResult = myVisu.ImportFile(medFile) + +myView = myViewManager.Create3DView(); + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.3,1.0) +myView.SetBackground(aColor); + +myView.SetTitle("The viewer will display ScalarMap") +print "myViewManager.Create3DView()" + +aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) + +myView.Display(aScalarMap); +print "myView.Display(aScalarMap)" +myView.SetFocalPoint([0,0,0]); +print "myView.SetFocalPoint(...)" +myView.SetParallelScale(2); +print "myView.SetParallelScale(...)" +myView.FitAll(); + +aMax = aScalarMap.GetMax() +aMin = aScalarMap.GetMin() +aDelta = (aMax - aMin)/2.0 +aNbColors = aScalarMap.GetNbColors() +aNbColors = 64 +for i in range(2,aNbColors) : + aScalarMap.SetNbColors(i) + aX = aMin + aDelta*i/aNbColors + aY = aMax - aDelta*i/aNbColors + aScalarMap.SetRange(aX,aY) + myView.Update(); + time.sleep(aDelay) + +aScalarMap.SetRange(aMin,aMax) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + +myView = myViewManager.Create3DView(); +myView.SetTitle("Here we will display CutPlanes") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.7,0.0) +myView.SetBackground(aColor); + +aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) +print "myVisu.CutPlanesOnField(...)" + +myView.DisplayOnly(aCutPlanes); +print "myView.DisplayOnly(aCutPlanes)" + +aPoint = myView.GetPointOfView(); +aPoint[0] = aPoint[0] + 10; +myView.SetPointOfView(aPoint); +print "myView.SetPointOfView(...)" +myView.ScaleView(VISU.View3D.YAxis,10.0); +myView.ScaleView(VISU.View3D.XAxis,3.0); +print "myView.ScaleView(...)" +time.sleep(aDelay) + +myView.FitAll(); + +aNbPlanes = aCutPlanes.GetNbPlanes() +aNbPlanes = 30 +aXAngle = aCutPlanes.GetRotateX() +aYAngle = aCutPlanes.GetRotateY() +anOrientation = aCutPlanes.GetOrientationType() +for i in range(aNbPlanes,1,-1) : + aCutPlanes.SetNbPlanes(i) + aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aCutPlanes.SetOrientation(anOrientation,aX,aY) + myView.Update(); + time.sleep(aDelay) + +aNbPlanes = 10 +aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0) +for i in range(1,aNbPlanes) : + aCutPlanes.SetNbPlanes(i) + myView.Update(); + time.sleep(aDelay) + +myView.SaveViewParams('AAA') +print "myView.SaveViewParams('AAA')" +time.sleep(aDelay) + +aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0) +myView.RemoveScale(); + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + +myView = myViewManager.Create3DView(); +print "myViewManager.Create3DView()" + +myView.SetTitle("IsoSurface's viewer") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(1.0,0.7,0.0) +myView.SetBackground(aColor); +time.sleep(aDelay) + +aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) + +myView.DisplayOnly(aIsoSurfaces); +myView.FitAll(); +print "myView.DisplayOnly(aCutPlanes)" +time.sleep(aDelay) + +aNbSurfaces = aIsoSurfaces.GetNbSurfaces() +aNbSurfaces = 32 +for i in range(2,aNbSurfaces) : + aIsoSurfaces.SetNbSurfaces(i) + myView.Update(); + time.sleep(aDelay) + +aIsoSurfaces.SetNbSurfaces(10) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for CutLines") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.7,0.7,0.7) +myView.SetBackground(aColor); +time.sleep(aDelay) + +aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) +aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0) +aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0) + +myView.DisplayOnly(aCutLines); +myView.FitAll(); +print "myView.DisplayOnly(aCutLines)" +time.sleep(aDelay) + +aSObj = myStudy.FindObjectIOR(aCutLines.GetID()) +aTable = myVisu.CreateTable( aSObj.GetID() ) +print "myVisu.CreateTable(...)" + +aTableView = myViewManager.CreateTableView(aTable) +aTableView.SetTitle('Changed Title') + +aContainer = myVisu.CreateContainer() +print "myVisu.CreateContainer(...)" + +aNbCurve = aTable.GetNbRows() - 1 +for i in range(2,aNbCurve): + aCurve = myVisu.CreateCurve( aTable, 1, i ) + print i, aCurve + aContainer.AddCurve(aCurve) + + +myView = myViewManager.CreateXYPlot(); +myView.SetTitle("The viewer for Curves from CutLines") +print "myViewManager.CreateXYPlot()" +time.sleep(aDelay) + +myView.Display(aContainer) + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "vitesse"; + +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(2)[1] +anAnim.addField(aSObj) +anAnim.setPresentationType(0,VISU.TISOSURFACE) +print "Generate presentations" +anAnim.generatePresentations(0) +print "Generate frames" +anAnim.generateFrames() +print "Start Animation" +anAnim.setSpeed(99) +anAnim.startAnimation() +myView.FitAll() +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break