Salome HOME
344652f0dc7f34e37bce0c44e87654db35f9c12d
[modules/paravis.git] / test / demo3.py
1
2 if not ('servermanager' in dir()):
3   from pvsimple import *
4
5 import  os
6
7 def demo3(impth):
8     """This method demonstrates an artificial data sources,
9     probes it with a line, etc"""
10
11     # The TWO views
12     rv = GetRenderView()
13     
14     v = CreateRenderView()  
15     v.CameraPosition = [-30, -20, -65]
16     v.CameraFocalPoint = [0.0, 0.0, 0.0]
17     v.CameraViewUp = [-0.65, -0.55, 0.5]
18     v.CameraViewAngle = [30]
19     SetActiveView(rv)
20
21     src = Wavelet()
22     # Get some information about the data. First, for the source to execute
23     UpdatePipeline()
24
25     di = src.GetDataInformation()
26     print "Data type:", di.GetPrettyDataTypeString()
27     print "Extent:", di.GetExtent()
28
29     ##src.Representation = 3 # outline
30     Show(src, view=v)
31     v.StillRender()
32
33     # Apply a contour filter
34     cf = Contour(Input = src)
35     cf.ContourBy = ['POINTS', 'RTData']
36     cf.Isosurfaces = [37.353099999999998, 63.961533333333335, 90.569966666666673, 117.1784, 143.78683333333333, 170.39526666666666, 
37                                  197.00370000000001, 223.61213333333333, 250.22056666666668, 276.82900000000001]
38     Show(cf, view=rv)
39
40     #Set background
41     SetViewProperties(Background = [.50, .20, .30])
42     Render()
43
44     # Reset the camera to include the whole thing
45     rv.StillRender()
46     rv.ResetCamera()
47     rv.CameraPosition = [-2.50, 60, -40]
48     rv.CameraFocalPoint = [1.25, 1.0, 1.35]
49     rv.CameraViewUp = [-0.955, 0.1, 0.25]
50     rv.CameraViewAngle = [30]
51     rv.StillRender()
52
53     # Now, let's probe the data
54     probe = ResampleWithDataset(Input=src)
55
56     # with a line
57     line = Line(Resolution=60)
58
59     # that spans the dataset
60     bounds = di.GetBounds()
61
62     print "Bounds: ", bounds
63     line.Point1 = bounds[0:6:2]
64     line.Point2 = bounds[1:6:2]
65
66     probe.Source = line
67
68     # Render with the line
69     Show(line, view=rv)
70     rv.StillRender()
71     WriteImage(filename = (impth + "demo3_1.png"), view=v, Magnification=2)
72     WriteImage(filename = (impth + "demo3_2.png"), view=rv, Magnification=2)
73
74 testdir = os.getenv("TESTDIR")
75 pvdata = os.getenv("PVDATA")
76
77 if __name__ == "__main__":
78  demo3(impth=testdir+"/Pic/")