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