]> SALOME platform Git repositories - modules/paravis.git/blob - test/demo8.py
Salome HOME
Merge from BR_PARAVIS_DEV 29Dec09
[modules/paravis.git] / test / demo8.py
1
2 if not ('servermanager' in dir()):
3   from pvsimple import *
4
5 import os
6
7 def demo8(fname, impth):
8     """This method demonstrates the Glyph filter."""
9
10     reader = ExodusIIReader(FileName=fname)
11     v=GetActiveView()
12     Show(reader, view=v)
13     camera = GetActiveCamera()
14     camera.SetPosition(0, 5, -45)
15     camera.Elevation(30)
16
17     #Change the can to be wireframe so we can see the glyphs
18     dp1 = GetDisplayProperties(reader, view=v)
19     dp1.Representation = 'Wireframe'
20     glyphFilter = Glyph(reader)
21
22     #We won't see much if we don't move forward in the animation a little bit
23     tsteps = reader.TimestepValues
24     v = GetActiveView()
25     v.ViewTime = tsteps[20]
26     glyphFilter.Vectors
27     ## ['POINTS', 'DISPL']
28
29     #Set the glyphs to use the acceleration vectors and adjust scale factor
30     glyphFilter.Vectors = 'ACCL'
31     ##glyphFilter.GetScaleFactor
32     ##1.0
33     glyphFilter.SetScaleFactor = 0.0000002
34     
35     Show()
36     Render()
37     WriteImage(filename = (impth + "glyphFilter_1.png"), view=v, Magnification=2)
38
39     #Set the glyphs to use the velocity vectors and adjust scale factor
40     glyphFilter.Vectors = 'VEL'
41     glyphFilter.SetScaleFactor = 3e-4
42  
43     #Add some color
44     dp2 = GetDisplayProperties(glyphFilter)
45     glyphFilter.PointData[:]
46     ##[Array: PedigreeNodeId, Array: DISPL, Array: VEL, Array: ACCL, Array: GlobalNodeId, Array: GlyphVector]
47
48     #We'll color by velocity so use that array.
49     vel = glyphFilter.PointData[2]
50     vel.GetName()
51     ##'VEL'
52
53     vel.GetRange()
54     ##(-2479.9521484375, 1312.5040283203125)
55     dp2.LookupTable = MakeBlueToRedLT(-2479.9521,1312.5)
56     dp2.ColorAttributeType = 'POINT_DATA'
57     dp2.ColorArrayName = 'VEL'
58     Render()
59     WriteImage(filename = (impth + "glyphFilter_2.png"), view=v, Magnification=2)
60
61 testdir = os.getenv("TESTDIR")
62 pvdata = os.getenv("PVDATA")
63
64 if __name__ == "__main__":
65  demo8(fname=pvdata+"/Data/can.ex2", impth=testdir+"/Pic/")