Back to index

salome-paravis  6.5.0
Functions | Variables
demo2 Namespace Reference

Functions

def demo2

Variables

tuple testdir = os.getenv("TESTDIR")
tuple pvdata = os.getenv("PVDATA")

Function Documentation

def demo2.demo2 (   fname,
  impth 
)
This demo shows the use of readers, data information and display properties.

Definition at line 26 of file demo2.py.

00026 
00027 def demo2(fname, impth):
00028     """This demo shows the use of readers, data information and display properties."""
00029    
00030  # The view
00031     v = GetRenderView()
00032     if not v:
00033        v = CreateRenderView()
00034     v.CameraPosition = [-20, -9, -45]
00035     v.CameraFocalPoint = [0.7, 0.3, 1.7]
00036     v.CameraViewUp = [-0.75, -0.6, 0.25]
00037     v.CameraViewAngle = [30]
00038     v.StillRender()
00039 
00040     # Create the exodus reader and specify a file name
00041     reader = ExodusIIReader(FileName=fname)
00042 
00043     # Get the list of point arrays.
00044     avail = reader.PointVariables.Available
00045     print avail
00046 
00047     # Select all arrays
00048     reader.PointVariables = avail
00049 
00050     # Turn on the visibility of the reader
00051     Show(reader)
00052 
00053     # Set representation to wireframe
00054     SetDisplayProperties(Representation = "Wireframe")
00055    
00056     # Black background
00057     SetViewProperties(Background = [0., 0., 0.])
00058     Render()
00059 
00060     # Change the elevation of the camera.
00061     GetActiveCamera().Elevation(45)
00062     Render()
00063 
00064     # Now that the reader executed, let's get some information about it's output.
00065     pdi = reader[0].PointData
00066 
00067     # This prints a list of all read point data arrays as well as their value ranges.
00068     print 'Number of point arrays:', len(pdi)
00069     for i in range(len(pdi)):
00070         ai = pdi[i]
00071         print "----------------"
00072         print "Array:", i, " ", ai.Name, ":"
00073         numComps = ai.GetNumberOfComponents()
00074         print "Number of components:", numComps
00075         for j in range(numComps):
00076             print "Range:", ai.GetRange(j)
00077 
00078     # 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. 
00079     SetDisplayProperties(LookupTable = MakeBlueToRedLT(0.00678, 0.0288))
00080 
00081     # Color by point array called Pres
00082     SetDisplayProperties(ColorAttributeType = "POINT_DATA")
00083     SetDisplayProperties(ColorArrayName = "Pres")
00084 
00085     WriteImage(filename = (impth + "demo2_1.png"), view=v, Magnification=2)
00086 
00087     # Set representation to surface
00088     SetDisplayProperties(Representation = "Surface")
00089 
00090     # Scalar Bar
00091     lt = MakeBlueToRedLT(0.00678, 0.0288)
00092     ScalarBar = CreateScalarBar(LookupTable = lt, Title = "Sample")
00093     GetRenderView().Representations.append(ScalarBar)
00094     WriteImage(filename = (impth + "demo2_2.png"), view=v, Magnification=2)
00095     Render()
00096 


Variable Documentation

tuple demo2.pvdata = os.getenv("PVDATA")

Definition at line 98 of file demo2.py.

tuple demo2.testdir = os.getenv("TESTDIR")

Definition at line 97 of file demo2.py.