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/Vectors/B3 case
24 from paravistest import datadir
25 from presentations import VectorsOnField, EntityType
28 #====================Stage1: Importing MED file====================
30 print "**** Stage1: Importing MED file"
32 print 'Import "ResOK_0000.med"...............',
33 medFile = datadir + "ResOK_0000.med"
34 pvsimple.OpenDataFile(medFile)
35 med_reader = pvsimple.GetActiveSource()
37 if med_reader is None:
42 cell_entity = EntityType.CELL
43 node_entity = EntityType.NODE
45 #====================Stage2: Creation of Vectors====================
47 print "Creating Vectors..........",
48 vectors = VectorsOnField(med_reader, node_entity, 'vitesse', 1)
55 #====================Stage3: Change properties======================
58 print "Default LineWidth : ", vectors.LineWidth
59 print "Default GlyphType : ", glyph.GlyphType
60 print "Default subtype : ", glyph.GlyphType.GlyphType
61 print "Default GlyphPos : ", glyph.GlyphType.Center
63 print "Changing value of line width"
65 #vectors.LineWidth = width
66 #print "Negative value -10 : ", vectors.LineWidth
70 vectors.LineWidth = width
71 print "Positive value 10 : ", vectors.LineWidth
75 # vectors.LineWidth = width
76 # print "Zero value 0 : ", vectors.LineWidth
80 vectors.LineWidth = width
81 print "Positive value 2 : ", vectors.LineWidth
84 print "Changing glyph type"
86 glyph.GlyphType = gtype
87 print "Arrow type : ", glyph.GlyphType
91 glyph.GlyphType = gtype
92 glyph.GlyphType.Resolution = 3
93 glyph.GlyphType.Height = 4
94 print "Cone type: " + str(glyph.GlyphType) + ", resolution: " + str(glyph.GlyphType.Resolution)
97 glyph.GlyphType.Resolution = 6
98 print "Cone type: " + str(glyph.GlyphType) + ", resolution: " + str(glyph.GlyphType.Resolution)
102 glyph.GlyphType = gtype
103 print "Line Type : ", glyph.GlyphType
107 glyph.GlyphType = gtype
108 glyph.GlyphType.GlyphType = "Arrow"
111 print "Changing glyph position"
112 pos = [0.0, 0.0, 0.0]
113 glyph.GlyphType.Center = pos
114 print "Center position : ", glyph.GlyphType.Center
117 pos = [0.5, 0.0, 0.0]
118 glyph.GlyphType.Center = pos
119 print "Tail position : ", glyph.GlyphType.Center
122 pos = [-0.5, 0.0, 0.0]
123 glyph.GlyphType.Center = pos
124 print "Head position : ", glyph.GlyphType.Center