Salome HOME
Merge branch 'V7_dev'
[modules/paravis.git] / test / VisuPrs / DeformedShape / B4.py
1 # Copyright (C) 2010-2016  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/DeformedShape/B4 case
21
22 from paravistest import datadir
23 from presentations import DeformedShapeOnField, EntityType
24 import pvsimple
25
26 #====================Stage1: Import from MED file in ParaVis============
27 print "**** Stage1: Import from MED file in ParaVis"
28
29 print 'Import "Hexa8.med"....................',
30
31 file_path = datadir + "Hexa8.med"
32 pvsimple.OpenDataFile(file_path)
33 med_reader = pvsimple.GetActiveSource()
34
35 if med_reader is None:
36     print "FAILED"
37 else:
38     print "OK"
39
40 #====================Stage2: Creating Deformed Shape====================
41 print "**** Stage2: Creating Deformed Shape"
42
43 print "Creating Deformed Shape...............",
44
45 cell_entity = EntityType.CELL
46 field_name = 'vectoriel field'
47 defshape = DeformedShapeOnField(med_reader, cell_entity, field_name, 1)
48 pvsimple.ResetCamera()
49
50 if defshape is None:
51     print "FAILED"
52 else:
53     print "OK"
54
55 #====================Stage3: Color of Deformed Shape====================
56 print "**** Stage3: Color of Deformed Shape"
57
58 # Step1
59 print "Getting the current color of Deformed Shape in RGB ... ",
60 color = defshape.AmbientColor
61 print color
62
63 # Step2
64 print "Set the positive color in RGB"
65 color = [0.3, 0.3, 0.3]
66 defshape.AmbientColor = color
67 pvsimple.Render()
68
69 color = defshape.AmbientColor
70 print "Color: ", color
71
72 # Step3
73 print "Set the negative R and positive GB"
74 color = [-0.3, 0.3, 0.3]
75 defshape.AmbientColor = color
76 pvsimple.Render()
77
78 color = defshape.AmbientColor
79 print "Color: ", color
80
81 # Step4
82 print "Set the negative R and positive GB"
83 color = [0.3, -0.3, 0.3]
84 defshape.AmbientColor = color
85 pvsimple.Render()
86
87 color = defshape.AmbientColor
88 print "Color: ", color
89
90 # Step5
91 print "Set the negative B and positive RG"
92 print "Set the negative R and positive GB"
93 color = [0.3, 0.3, -0.3]
94 defshape.AmbientColor = color
95 pvsimple.Render()
96
97 color = defshape.AmbientColor
98 print "Color: ", color