1 # Copyright (C) 2010-2013 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # This case corresponds to: /visu/bugs4/E0 case
23 from paravistest import datadir
24 from presentations import *
29 my_paravis = paravis.myParavis
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!!!"
41 # TODO: in the original VISU script the timestamp id was equal to 2,
42 # but in PARAVIS it's inly one timestamp accessible
45 # 2. Create Scalar Map
46 field_name = 'vitesse'
48 print "Creating Scalar Map......."
49 scmap1 = ScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
51 raise RuntimeError, "ScalarMap presentation is None!!!"
58 print "WIREFRAME sur scmap1"
59 scmap1.Representation = 'Wireframe'
60 time.sleep(sleep_delay)
62 print "POINT sur scmap1"
63 scmap1.Representation = 'Points'
64 time.sleep(sleep_delay)
66 print "SURFACEFRAME sur scmap1"
67 scmap1.Representation = 'Surface With Edges'
68 time.sleep(sleep_delay)
70 # 3. Create Deformed Shape And Scalar Map
71 print "Creating DeformedShapeAndScalarMap......."
72 scmap2 = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
74 raise RuntimeError, "DeformedShapeAndScalarMapOnField presentation is None!!!"
78 scmap2.Input.ScaleFactor = 1.0
83 print "WIREFRAME sur scmap2"
84 scmap2.Representation = 'Wireframe'
85 time.sleep(sleep_delay)
87 print "POINT sur scmap2"
88 scmap2.Representation = 'Points'
89 time.sleep(sleep_delay)
91 print "SURFACEFRAME sur scmap2"
92 scmap2.Representation = 'Surface With Edges'
93 time.sleep(sleep_delay)
95 # 4.Create Deformed Shape
96 print "Creating DeformedShape........"
97 scmap3 = DeformedShapeOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
99 raise RuntimeError, "DeformedShapeOnField presentation is None!!!"
103 print "WIREFRAME sur scmap3"
104 scmap3.Representation = 'Wireframe'
105 time.sleep(sleep_delay)
107 print "POINT sur scmap3"
108 scmap3.Representation = 'Points'
109 time.sleep(sleep_delay)
111 print "SURFACEFRAME sur scmap3"
112 scmap3.Representation = 'Surface With Edges'
113 time.sleep(sleep_delay)
115 scmap2.Input.ScaleFactor = 1.0
118 scmap3.ColorAttributeType = EntityType.get_pvtype(EntityType.NODE)
119 scmap3.ColorArrayName = field_name