Salome HOME
Merge branch 'origin/agy/feedbackads140304'
[modules/paravis.git] / test / VisuPrs / bugs / E0.py
1 # Copyright (C) 2010-2013  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.
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/bugs4/E0 case
21
22 import time
23 from paravistest import datadir
24 from presentations import *
25 import paravis
26 import pvsimple
27
28 sleep_delay = 1
29 my_paravis = paravis.myParavis
30
31 # 1. MED file import
32 print 'Import "ResOK_0000.med"...............',
33 med_file_path = datadir + "ResOK_0000.med"
34 my_paravis.ImportFile(med_file_path)
35 med_reader = pvsimple.GetActiveSource()
36 if med_reader is None:
37     raise RuntimeError, "ResOK_0000.med was not imported!!!"
38 else:
39     print "OK"
40
41 # TODO: in the original VISU script the timestamp id was equal to 2,
42 #       but in PARAVIS it's inly one timestamp accessible
43 timestamp_id = 1
44
45 # 2. Create Scalar Map
46 field_name = 'vitesse'
47
48 print "Creating Scalar Map......."
49 scmap1 = ScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
50 if scmap1 is None : 
51     raise RuntimeError, "ScalarMap presentation is None!!!"
52 else:
53     print "OK"
54
55 display_only(scmap1)
56 reset_view()
57
58 print "WIREFRAME sur scmap1"
59 scmap1.Representation = 'Wireframe'
60 time.sleep(sleep_delay)
61
62 print "POINT sur scmap1"
63 scmap1.Representation = 'Points'
64 time.sleep(sleep_delay)
65
66 print "SURFACEFRAME sur scmap1"
67 scmap1.Representation = 'Surface With Edges'
68 time.sleep(sleep_delay)
69
70 # 3. Create Deformed Shape And Scalar Map
71 print "Creating DeformedShapeAndScalarMap......."
72 scmap2 = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
73 if scmap2 is None : 
74     raise RuntimeError, "DeformedShapeAndScalarMapOnField presentation is None!!!"
75 else:
76     print "OK"
77     
78 scmap2.Input.ScaleFactor = 1.0
79
80 display_only(scmap2)
81 reset_view()
82
83 print "WIREFRAME sur scmap2"
84 scmap2.Representation = 'Wireframe'
85 time.sleep(sleep_delay)
86
87 print "POINT sur scmap2"
88 scmap2.Representation = 'Points'
89 time.sleep(sleep_delay)
90
91 print "SURFACEFRAME sur scmap2"
92 scmap2.Representation = 'Surface With Edges'
93 time.sleep(sleep_delay)
94
95 # 4.Create Deformed Shape
96 print "Creating DeformedShape........"
97 scmap3 = DeformedShapeOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
98 if scmap3 is None : 
99     raise RuntimeError, "DeformedShapeOnField presentation is None!!!"
100 else:
101     print "OK"
102
103 print "WIREFRAME sur scmap3"
104 scmap3.Representation = 'Wireframe'
105 time.sleep(sleep_delay)
106
107 print "POINT sur scmap3"
108 scmap3.Representation = 'Points'
109 time.sleep(sleep_delay)
110
111 print "SURFACEFRAME sur scmap3"
112 scmap3.Representation = 'Surface With Edges'
113 time.sleep(sleep_delay)
114
115 scmap2.Input.ScaleFactor = 1.0
116
117 # show colored:
118 scmap3.ColorAttributeType = EntityType.get_pvtype(EntityType.NODE)
119 scmap3.ColorArrayName = field_name
120
121 display_only(scmap3)
122 reset_view()
123
124
125