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/DeformedShape/B3 case
22 from paravistest import datadir
23 from presentations import DeformedShapeOnField, EntityType
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 "Tria3.med"....................',
35 file_path = datadir + "Tria3.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: Scale of Deformed Shape====================
60 print "**** Stage3: Scale of Deformed Shape"
62 warp_vector = pvsimple.GetActiveSource()
63 print "Default scale: ", warp_vector.ScaleFactor
65 print "Set positive scale of Deformed Shape"
67 warp_vector.ScaleFactor = scale
70 print "Scale: ", warp_vector.ScaleFactor
72 print "Set negative scale of Deformed Shape"
74 warp_vector.ScaleFactor = scale
77 print "Scale: ", warp_vector.ScaleFactor
79 print "Set zero scale of Deformed Shape"
81 warp_vector.ScaleFactor = scale
84 print "Scale: ", warp_vector.ScaleFactor
86 #====================Stage4: Coloring method of Deformed Shape===========
87 print "**** Stage4: Coloring of Deformed Shape"
89 color_array = defshape.ColorArrayName
91 print "Default shape is colored by array: ", color_array
93 print "Default shape is colored by solid color: ", defshape.AmbientColor
95 print "Set colored by array mode .... ",
96 defshape.ColorArrayName = field_name
99 if defshape.ColorArrayName == field_name:
104 print "Set colored by solid color mode .... ",
105 defshape.ColorArrayName = ''
108 if defshape.ColorArrayName: