2 if not ('servermanager' in dir()):
7 def demo2(fname, impth):
8 """This demo shows the use of readers, data information and display properties."""
13 v = CreateRenderView()
14 v.CameraPosition = [-20, -9, -45]
15 v.CameraFocalPoint = [0.7, 0.3, 1.7]
16 v.CameraViewUp = [-0.75, -0.6, 0.25]
17 v.CameraViewAngle = [30]
20 # Create the exodus reader and specify a file name
21 reader = ExodusIIReader(FileName=fname)
23 # Get the list of point arrays.
24 avail = reader.PointVariables.Available
28 reader.PointVariables = avail
30 # Turn on the visibility of the reader
33 # Set representation to wireframe
34 SetDisplayProperties(Representation = "Wireframe")
37 SetViewProperties(Background = [0., 0., 0.])
40 # Change the elevation of the camera.
41 GetActiveCamera().Elevation(45)
44 # Now that the reader executed, let's get some information about it's output.
45 pdi = reader[0].PointData
47 # This prints a list of all read point data arrays as well as their value ranges.
48 print 'Number of point arrays:', len(pdi)
49 for i in range(len(pdi)):
51 print "----------------"
52 print "Array:", i, " ", ai.Name, ":"
53 numComps = ai.GetNumberOfComponents()
54 print "Number of components:", numComps
55 for j in range(numComps):
56 print "Range:", ai.GetRange(j)
58 # White is boring. Let's color the geometry using a variable. First create a lookup table. This object controls how scalar values are mapped to colors.
59 SetDisplayProperties(LookupTable = MakeBlueToRedLT(0.00678, 0.0288))
61 # Color by point array called Pres
62 SetDisplayProperties(ColorAttributeType = "POINT_DATA")
63 SetDisplayProperties(ColorArrayName = "Pres")
65 WriteImage(filename = (impth + "demo2_1.png"), view=v, Magnification=2)
67 # Set representation to surface
68 SetDisplayProperties(Representation = "Surface")
71 lt = MakeBlueToRedLT(0.00678, 0.0288)
72 ScalarBar = CreateScalarBar(LookupTable = lt, Title = "Sample")
73 GetRenderView().Representations.append(ScalarBar)
74 WriteImage(filename = (impth + "demo2_2.png"), view=v, Magnification=2)
78 testdir = os.getenv("TESTDIR")
79 pvdata = os.getenv("PVDATA")
81 if __name__ == "__main__":
82 demo2(fname=pvdata+"/Data/disk_out_ref.ex2", impth=testdir+"/Pic/")