]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_SWIG/visu_cache.py
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VISU_SWIG / visu_cache.py
1 import os
2 import time
3 import VISU
4 import SALOMEDS
5 from batchmode_visu import *
6
7 #---------------------------------------------------------------
8 def WalkTroughTimeStamps(theVISUType,
9                          theInput,
10                          theViewManager):
11   aView = theViewManager.Create3DView();
12   aView.SetTitle("To test presentation of %s type" % theVISUType)
13
14   aCache = myVisu.GetColoredPrs3dCache(myVisu.GetCurrentStudy())
15   aHolder = aCache.CreateHolder(theVISUType, theInput)
16
17   if not aHolder:
18     print "It is impossible to create such kind of holder (%s) with the given parameters" % theVISUType
19     print "\ttheMeshName = '%s'" % theInput.myMeshName
20     print "\ttheEntity = %s" % theInput.myEntity
21     print "\ttheFieldName = '%s'" % theInput.myFieldName
22     print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
23     return
24
25   aPrs3d = aHolder.GetDevice()
26
27   if not aHolder.Apply(aPrs3d, theInput, aView):
28     print "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType
29     print "\ttheMeshName = '%s'" % theInput.myMeshName
30     print "\ttheEntity = %s" % theInput.myEntity
31     print "\ttheFieldName = '%s'" % theInput.myFieldName
32     print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
33     return
34
35   aView.FitAll()
36
37   aDelay = 0.0
38   aRange = aHolder.GetTimeStampsRange()
39   for anInfo in aRange:
40     print "%d (%s); " % (anInfo.myNumber, anInfo.myTime)
41     theInput.myTimeStampNumber = anInfo.myNumber
42     aHolder.Apply(aPrs3d, theInput, aView)
43     time.sleep(aDelay)
44     pass
45   pass
46
47 #---------------------------------------------------------------
48 PRS3D_TYPE_LIST = []
49 PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
50 PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
51 PRS3D_TYPE_LIST.append(VISU.TISOSURFACES)
52 PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
53 PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
54 PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
55 PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
56 PRS3D_TYPE_LIST.append(VISU.TVECTORS)
57 PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
58 PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
59
60
61 #---------------------------------------------------------------
62 aMedFile = "TimeStamps.med"
63 aMedFile = "ResOK_0000.med"
64 aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile
65 aResult = myVisu.ImportFile(aMedFile)
66
67 aMeshName ="dom"
68 anEntity = VISU.NODE
69 aFieldName = "vitesse";
70 aTimeStampNumber = 1
71
72 anInput = VISU.ColoredPrs3dHolder.BasicInput(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
73
74 aViewManager = myVisu.GetViewManager();
75
76 WalkTroughTimeStamps(VISU.TSCALARMAP, anInput, aViewManager)
77
78 for aVISUType in PRS3D_TYPE_LIST:
79   WalkTroughTimeStamps(aVISUType, anInput, aViewManager)
80   pass
81
82 anInput.myEntity = VISU.CELL;
83 anInput.myFieldName = "pression";
84 WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager)
85
86 #execfile('/data/apo/a.py')