1 # Copyright (C) 2010-2014 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
24 import pvserver as paravis
28 my_paravis = paravis.myParavis
30 #====================Stage1: Import from MED file in ParaVis============
31 print "**** Stage1: Import from MED file in ParaVis"
33 print 'Import "Hexa8.med"....................',
35 file_path = datadir + "Hexa8.med"
36 my_paravis.ImportFile(file_path)
37 med_reader = pvsimple.GetActiveSource()
39 if med_reader is None:
44 #====================Stage2: Creating Deformed Shape====================
45 print "**** Stage2: Creating Deformed Shape"
47 print "Creating Deformed Shape...............",
49 cell_entity = EntityType.CELL
50 field_name = 'vectoriel field'
51 defshape = DeformedShapeOnField(med_reader, cell_entity, field_name, 1)
52 pvsimple.ResetCamera()
59 #====================Stage3: Color of Deformed Shape====================
60 print "**** Stage3: Color of Deformed Shape"
63 print "Getting the current color of Deformed Shape in RGB ... ",
64 color = defshape.AmbientColor
68 print "Set the positive color in RGB"
69 color = [0.3, 0.3, 0.3]
70 defshape.AmbientColor = color
73 color = defshape.AmbientColor
74 print "Color: ", color
77 print "Set the negative R and positive GB"
78 color = [-0.3, 0.3, 0.3]
79 defshape.AmbientColor = color
82 color = defshape.AmbientColor
83 print "Color: ", color
86 print "Set the negative R and positive GB"
87 color = [0.3, -0.3, 0.3]
88 defshape.AmbientColor = color
91 color = defshape.AmbientColor
92 print "Color: ", color
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
101 color = defshape.AmbientColor
102 print "Color: ", color