]> SALOME platform Git repositories - modules/paravis.git/blob - test/VisuPrs/Vectors/B3.py
Salome HOME
Merge Python 3 porting.
[modules/paravis.git] / test / VisuPrs / Vectors / B3.py
1 # Copyright (C) 2010-2016  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/Vectors/B3 case
21
22 import sys
23
24 from paravistest import datadir
25 from presentations import VectorsOnField, EntityType
26 import pvsimple
27
28 #====================Stage1: Importing MED file====================
29
30 print("**** Stage1: Importing MED file")
31
32 print('Import "ResOK_0000.med"...............', end=' ')
33 medFile = datadir + "ResOK_0000.med"
34 pvsimple.OpenDataFile(medFile)
35 med_reader = pvsimple.GetActiveSource()
36
37 if med_reader is None:
38     print("FAILED")
39 else:
40     print("OK")
41
42 cell_entity = EntityType.CELL
43 node_entity = EntityType.NODE
44
45 #====================Stage2: Creation of Vectors====================
46
47 print("Creating Vectors..........", end=' ')
48 vectors = VectorsOnField(med_reader, node_entity, 'vitesse', 1)
49
50 if vectors is None:
51     print("FAILED")
52 else:
53     print("OK")
54
55 #====================Stage3: Change properties======================
56 glyph = vectors.Input
57
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)
62
63 print("Changing value of line width")
64 #width = -10
65 #vectors.LineWidth = width
66 #print "Negative value -10 : ", vectors.LineWidth
67 #pvsimple.Render()
68
69 width = 10
70 vectors.LineWidth = width
71 print("Positive value  10 : ", vectors.LineWidth)
72 pvsimple.Render()
73
74 # width = 0
75 # vectors.LineWidth = width
76 # print "Zero value       0 : ", vectors.LineWidth
77 # pvsimple.Render()
78
79 width = 2
80 vectors.LineWidth = width
81 print("Positive value   2 : ", vectors.LineWidth)
82 pvsimple.Render()
83
84 print("Changing glyph type")
85 gtype = "Arrow"
86 glyph.GlyphType = gtype
87 print("Arrow type     : ", glyph.GlyphType)
88 pvsimple.Render()
89
90 gtype = "Cone"
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))
95 pvsimple.Render()
96
97 glyph.GlyphType.Resolution = 6
98 print("Cone type: " + str(glyph.GlyphType) + ", resolution: " + str(glyph.GlyphType.Resolution))
99 pvsimple.Render()
100
101 gtype = "Line"
102 glyph.GlyphType = gtype
103 print("Line Type      : ", glyph.GlyphType)
104 pvsimple.Render()
105
106 gtype = "2D Glyph"
107 glyph.GlyphType = gtype
108 glyph.GlyphType.GlyphType = "Arrow"
109 pvsimple.Render()
110
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)
115 pvsimple.Render()
116
117 pos = [0.5, 0.0, 0.0]
118 glyph.GlyphType.Center = pos
119 print("Tail position   : ", glyph.GlyphType.Center)
120 pvsimple.Render()
121
122 pos = [-0.5, 0.0, 0.0]
123 glyph.GlyphType.Center = pos
124 print("Head position   : ", glyph.GlyphType.Center)
125 pvsimple.Render()