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/Vectors/B3 case
24 from paravistest import datadir
25 from presentations import VectorsOnField, EntityType
26 import pvserver as paravis
29 my_paravis = paravis.myParavis
31 #====================Stage1: Importing MED file====================
33 print "**** Stage1: Importing MED file"
35 print 'Import "ResOK_0000.med"...............',
36 medFile = datadir + "ResOK_0000.med"
38 med_reader = pvsimple.GetActiveSource()
40 if med_reader is None:
45 cell_entity = EntityType.CELL
46 node_entity = EntityType.NODE
48 #====================Stage2: Creation of Vectors====================
50 print "Creating Vectors..........",
51 vectors = VectorsOnField(med_reader, node_entity, 'vitesse', 1)
58 #====================Stage3: Change properties======================
61 print "Default LineWidth : ", vectors.LineWidth
62 print "Default GlyphType : ", glyph.GlyphType
63 print "Default subtype : ", glyph.GlyphType.GlyphType
64 print "Default GlyphPos : ", glyph.GlyphType.Center
66 print "Changing value of line width"
68 vectors.LineWidth = width
69 print "Negative value -10 : ", vectors.LineWidth
73 vectors.LineWidth = width
74 print "Positive value 10 : ", vectors.LineWidth
78 vectors.LineWidth = width
79 print "Zero value 0 : ", vectors.LineWidth
83 vectors.LineWidth = width
84 print "Positive value 2 : ", vectors.LineWidth
87 print "Changing glyph type"
89 glyph.GlyphType = gtype
90 print "Arrow type : ", glyph.GlyphType
94 glyph.GlyphType = gtype
95 glyph.GlyphType.Resolution = 3
96 glyph.GlyphType.Height = 4
97 print "Cone type: " + str(glyph.GlyphType) + ", resolution: " + str(glyph.GlyphType.Resolution)
100 glyph.GlyphType.Resolution = 6
101 print "Cone type: " + str(glyph.GlyphType) + ", resolution: " + str(glyph.GlyphType.Resolution)
105 glyph.GlyphType = gtype
106 print "Line Type : ", glyph.GlyphType
110 glyph.GlyphType = gtype
111 glyph.GlyphType.GlyphType = "Arrow"
114 print "Changing glyph position"
115 pos = [0.0, 0.0, 0.0]
116 glyph.GlyphType.Center = pos
117 print "Center position : ", glyph.GlyphType.Center
120 pos = [0.5, 0.0, 0.0]
121 glyph.GlyphType.Center = pos
122 print "Tail position : ", glyph.GlyphType.Center
125 pos = [-0.5, 0.0, 0.0]
126 glyph.GlyphType.Center = pos
127 print "Head position : ", glyph.GlyphType.Center