Salome HOME
Update ParaVis non-regression test base in the following ways:
[modules/paravis.git] / test / VisuPrs / united / A2.py
1 # Copyright (C) 2010-2015  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/united/A2 case
21
22 from paravistest import datadir
23 from presentations import *
24 import pvsimple
25 from math import radians
26
27 cell_entity = EntityType.CELL
28 node_entity = EntityType.NODE
29
30 # 1. Import MED file
31 print "**** Step1: Import MED file"
32
33 print 'Import "fra.med"....................',
34 file_path = datadir + "fra.med"
35 pvsimple.OpenDataFile(file_path)
36 med_reader = pvsimple.GetActiveSource()
37
38 if med_reader is None:
39     print "FAILED"
40 else:
41     print "OK"
42
43 view = pvsimple.GetRenderView()
44
45 field_name = 'VITESSE'
46 print "Creating Cut Planes.................",
47 orient = Orientation.YZ
48 cutplanes = CutPlanesOnField(med_reader, node_entity, field_name, 1, orientation=orient)
49 if cutplanes is None:
50     print "FAILED"
51 else:
52     display_only(cutplanes, view)
53     print "OK"
54
55 slice_filter = pvsimple.GetActiveSource()
56
57 # 2. Changing view
58 print "**** Step2: Changing view"
59
60 print "Fit All.............................",
61 reset_view(view)
62 print "OK"
63
64 print "Rotate..............................",
65 x_angle = 0
66 y_angle = 0
67
68 nb_planes = len(slice_filter.SliceOffsetValues)
69
70 for i in xrange(1, 50):
71     y_angle = y_angle + 0.05
72     normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
73     slice_filter.SliceType.Normal = normal
74     pvsimple.Render()
75
76 for i in xrange(1,50):
77     y_angle = y_angle - 0.05
78     normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
79     slice_filter.SliceType.Normal = normal
80     pvsimple.Render()
81
82 print "OK"
83
84 print "View Point (FRONT)..................",
85 view.CameraViewUp = [0.0, 0.0, 1.0]
86 view.CameraPosition = [2.4453961849843453, 0.03425, 0.541]
87 pvsimple.Render()
88 print "OK"
89
90 print "View Point (BACK)...................",
91 view.CameraPosition = [-2.0343961849843457, 0.03425, 0.541]
92 pvsimple.Render()
93 print "OK"
94
95 print "View Point (TOP)....................",
96 view.CameraViewUp = [0.0, 1.0, 0.0]
97 view.CameraPosition = [0.2055, 0.03425, 2.7808961849843454]
98 pvsimple.Render()
99 print "OK"
100
101 print "View Point (BOTTOM).................",
102 view.CameraPosition = [0.2055, 0.03425, -1.6988961849843456]
103 pvsimple.Render()
104 print "OK"
105
106 print "View Point (LEFT)...................",
107 view.CameraViewUp = [0.0, 0.0, 1.0]
108 view.CameraPosition = [0.2055, -2.2056461849843454, 0.541]
109 pvsimple.Render()
110 print "OK"
111
112 print "View Point (RIGHT) .................",
113 view.CameraPosition = [0.2055, 2.2741461849843456, 0.541]
114 pvsimple.Render()
115 print "OK"
116
117 print "Restore View........................",
118 reset_view(view)
119 print "OK"