1 # Copyright (C) 2010-2016 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, or (at your option) any later version.
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/DeformedShape/B4 case
22 from paravistest import datadir
23 from presentations import DeformedShapeOnField, EntityType
26 #====================Stage1: Import from MED file in ParaVis============
27 print "**** Stage1: Import from MED file in ParaVis"
29 print 'Import "Hexa8.med"....................',
31 file_path = datadir + "Hexa8.med"
32 pvsimple.OpenDataFile(file_path)
33 med_reader = pvsimple.GetActiveSource()
35 if med_reader is None:
40 #====================Stage2: Creating Deformed Shape====================
41 print "**** Stage2: Creating Deformed Shape"
43 print "Creating Deformed Shape...............",
45 cell_entity = EntityType.CELL
46 field_name = 'vectoriel field'
47 defshape = DeformedShapeOnField(med_reader, cell_entity, field_name, 1)
48 pvsimple.ResetCamera()
55 #====================Stage3: Color of Deformed Shape====================
56 print "**** Stage3: Color of Deformed Shape"
59 print "Getting the current color of Deformed Shape in RGB ... ",
60 color = defshape.AmbientColor
64 print "Set the positive color in RGB"
65 color = [0.3, 0.3, 0.3]
66 defshape.AmbientColor = color
69 color = defshape.AmbientColor
70 print "Color: ", color
73 print "Set the negative R and positive GB"
74 color = [-0.3, 0.3, 0.3]
75 defshape.AmbientColor = color
78 color = defshape.AmbientColor
79 print "Color: ", color
82 print "Set the negative R and positive GB"
83 color = [0.3, -0.3, 0.3]
84 defshape.AmbientColor = color
87 color = defshape.AmbientColor
88 print "Color: ", color
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
97 color = defshape.AmbientColor
98 print "Color: ", color