1 # Copyright (C) 2010-2015 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/SWIG_scripts/B5 case
22 from time import sleep
24 from paravistest import datadir, tablesdir
25 from presentations import *
31 print 'Importing "pointe.med"...............',
32 file_path = datadir + "pointe.med"
33 pvsimple.OpenDataFile(file_path)
34 med_reader = pvsimple.GetActiveSource()
36 if med_reader is None:
41 field_name = "fieldnodedouble"
42 entity = EntityType.NODE
47 view1 = pvsimple.GetRenderView()
48 print "view1 = pvsimple.GetRenderView()"
52 pvsimple.Delete(view1)
53 print "pvsimple.Delete(view1)"
57 view2 = pvsimple.CreateRenderView()
58 print "view2 = pvsimple.CreateRenderView()"
60 color = [0.0, 0.3, 1.0]
61 view2.Background = color
62 print "view2.Background =", str(color)
63 pvsimple.Render(view2)
65 scalarmap = ScalarMapOnField(med_reader, entity, field_name, timestamp)
66 print "ScalarMapOnField(...)"
67 scalarmap.Visibility = 1
68 pvsimple.Render(view2)
70 view2.CameraFocalPoint = [0, 0, 0]
71 print "view2.CameraFocalPoint = [0, 0, 0]"
72 view2.CameraParallelScale = 2
73 print "view2.CameraParallelScale = 2"
74 pvsimple.Render(view2)
77 print "view2.ResetCamera()"
78 pvsimple.Render(view2)
84 view3 = pvsimple.CreateRenderView()
85 print "view3 = pvsimple.CreateRenderView()"
87 color = [0.0, 0.7, 0.0]
88 view3.Background = color
89 print "view3.Background = ", str(color)
90 pvsimple.Render(view3)
92 cutplanes = CutPlanesOnField(med_reader, entity, field_name, timestamp,
93 orientation=Orientation.XY)
94 print "CutPlanesOnField(...)"
96 display_only(cutplanes, view3)
97 print "display_only(cutplanes, view3)"
99 point = view3.CameraFocalPoint
100 point[0] = point[0] + 10
101 view3.CameraFocalPoint = point
102 print "view3.CameraFocalPoint = ", str(point)
105 print "view3.ResetCamera()"
106 pvsimple.Render(view3)
107 print "pvsimple.Render(view3)"
113 view4 = pvsimple.CreateRenderView()
114 print "view4 = pvsimple.CreateRenderView()"
116 color = [1.0, 0.7, 0.0]
117 view4.Background = color
118 print "view5.Background = ", str(color)
119 pvsimple.Render(view4)
121 isosurfaces = IsoSurfacesOnField(med_reader, entity, field_name, timestamp)
122 print "isosurfaces = IsoSurfacesOnField(...)"
124 display_only(isosurfaces, view4)
125 print "display_only(isosurfaces, view4)"
127 print "view4.ResetCamera()"
129 pvsimple.Render(view4)
130 print "pvsimple.Render(view4)"
136 view5 = pvsimple.CreateRenderView()
137 print "view5 = pvsimple.CreateRenderView()"
139 color = [0.7, 0.7, 0.7]
140 view5.Background = color
141 print "view5.Background =", str(color)
142 pvsimple.Render(view5)
144 cutlines = CutLinesOnField(med_reader, entity, field_name, timestamp,
145 orientation1=Orientation.ZX,
146 orientation2=Orientation.YZ)
147 print "cutlines = CutLinesOnField(...)"
149 display_only(cutlines, view5)
150 print "display_only(cutlines, view5)"
151 pvsimple.ResetCamera(view5)
152 print "pvsimple.ResetCamera(view5)"
158 file_path = tablesdir + "sinus.csv"
159 sinus_csv = pvsimple.CSVReader(FileName=file_path)
160 sinus_csv.FieldDelimiterCharacters = ' '
162 view6 = pvsimple.CreateXYPlotView()
163 print "view6 = pvsimple.CreateXYPlotView()"
165 xy_rep = pvsimple.Show(sinus_csv)
166 xy_rep.AttributeType = 'Row Data'
167 xy_rep.UseIndexForXAxis = 0
168 xy_rep.XArrayName = 'x'
169 xy_rep.SeriesVisibility = ['x', '0']