From 356740c49532bcd9900990e8d1ee3b02df35d469 Mon Sep 17 00:00:00 2001 From: smh Date: Mon, 19 Apr 2004 06:04:10 +0000 Subject: [PATCH] Improve scripts --- src/VISU_SWIG/batchmode_visu_view3d.py | 8 +- src/VISU_SWIG/visu_view3d.py | 117 ++++++++++++++++++------- 2 files changed, 87 insertions(+), 38 deletions(-) diff --git a/src/VISU_SWIG/batchmode_visu_view3d.py b/src/VISU_SWIG/batchmode_visu_view3d.py index 44805be4..fa2034a7 100644 --- a/src/VISU_SWIG/batchmode_visu_view3d.py +++ b/src/VISU_SWIG/batchmode_visu_view3d.py @@ -20,13 +20,7 @@ aDelay = 1 medFile = "fra.med" myFieldName = "VITESSE"; -#medFile = "minimail.dat" -#myFieldName = "Pressures"; - -#medFile = "brideResultats.dat" -#myFieldName = "VM_Elem."; - -medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile myResult = myVisu.ImportFile(medFile) diff --git a/src/VISU_SWIG/visu_view3d.py b/src/VISU_SWIG/visu_view3d.py index 1248289f..ea6d8ec2 100644 --- a/src/VISU_SWIG/visu_view3d.py +++ b/src/VISU_SWIG/visu_view3d.py @@ -4,82 +4,137 @@ # # # -# File : visu_view3d.py +# File : batchmode_visu_view3d.py # Module : VISU -import visu_gui import os +import time import VISU import SALOMEDS +from visu_gui import * -from libSALOME_Swig import * -sg = SALOMEGUI_Swig() +aDelay = 1 -myVisu = visu_gui.myVisu +#mySession = batchmode_visu.mySession medFile = "fra.med" myFieldName = "VITESSE"; -medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile myResult = myVisu.ImportFile(medFile) + aMeshName ="LE VOLUME" anEntity = VISU.NODE aMesh = myVisu.MeshOnEntity(myResult, aMeshName, anEntity) aTimeStampId = 1 -# aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) -if aScalarMap is not None: - aScalarMap.SetScaling(VISU.LOGARITHMIC) -else: - print "Null scalar map is created" -# aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) -if aCutPlanes is not None: - aCutPlanes.SetScaling(VISU.LOGARITHMIC) -else: print "Null aCutPlanes is created" -# aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) -if aIsoSurfaces is not None: - aIsoSurfaces.SetScaling(VISU.LINEAR) -else: print "Null aIsoSurfaces is created" myViewManager = myVisu.GetViewManager(); -#myView = myViewManager.Create3DView(); -myView = myViewManager.GetCurrentView(); + +#myView = myViewManager.GetCurrentView(); +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) + +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be set to 'AAA' view params") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +myView.Display(aScalarMap); +print "myView.Display(aScalarMap)" myView.SetFocalPoint([0,0,0]); +print "myView.SetFocalPoint(...)" +time.sleep(aDelay) myView.SetParallelScale(2); +print "myView.SetParallelScale(...)" +time.sleep(aDelay) + 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) + aColor = SALOMEDS.Color(0.0,0.3,1.0) myView.SetBackground(aColor); +print "myView.SetBackground(...)" myView.Update(); -myView.Display(aScalarMap); -#myView.Erase(aScalarMap); -#myView.DisplayOnly(aCutPlanes); +print "myView.Update()" +time.sleep(aDelay) + +myView.FitAll(); +print "myView.FitAll()" +time.sleep(aDelay) + +myView.Erase(aScalarMap); +print "myView.Erase(aScalarMap)" +time.sleep(aDelay) + +myView.DisplayOnly(aCutPlanes); +print "myView.DisplayOnly(aCutPlanes)" myView.SaveViewParams('AAA') +print "myView.SaveViewParams('AAA')" +time.sleep(aDelay) + +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be set to 'BBB' view params") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +myView.DisplayOnly(aIsoSurfaces); +print "myView.DisplayOnly(aCutPlanes)" +time.sleep(aDelay) +myView.RestoreViewParams('AAA') myView.RemoveScale(); -myView.FitAll(); +print "myView.RemoveScale()" +time.sleep(aDelay) + aColor = SALOMEDS.Color(0.0,0.0,0.0) myView.SetBackground(aColor); +print "myView.SetBackground(...)" myView.SaveViewParams('BBB'); +print "myView.SaveViewParams('BBB')" +time.sleep(aDelay) aColor = SALOMEDS.Color(1.0,1.0,1.0) myView.SetBackground(aColor); +print "myView.SetBackground(...)" +time.sleep(aDelay) + myView.ScaleView(VISU.View3D.ZAxis,0.5); +print "myView.SetBackground(...)" myView.SaveViewParams('CCC'); +print "myView.SaveViewParams('CCC')" +time.sleep(aDelay) -myView.RestoreViewParams('AAA'); - -sg.updateObjBrowser(0) - - - +myView.RestoreViewParams('BBB'); +print "myView.RestoreViewParams('BBB')" -- 2.39.2