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/SWIG_scripts/B5 case
22 from time import sleep
24 from paravistest import datadir, tablesdir
25 from presentations import *
32 my_paravis = paravis.myParavis
35 print 'Importing "pointe.med"...............',
36 file_path = datadir + "pointe.med"
37 my_paravis.ImportFile(file_path)
38 med_reader = pvsimple.GetActiveSource()
40 if med_reader is None:
45 field_name = "fieldnodedouble"
46 entity = EntityType.NODE
51 view1 = pvsimple.GetRenderView()
52 print "view1 = pvsimple.GetRenderView()"
56 pvsimple.Delete(view1)
57 print "pvsimple.Delete(view1)"
61 view2 = pvsimple.CreateRenderView()
62 print "view2 = pvsimple.CreateRenderView()"
64 color = [0.0, 0.3, 1.0]
65 view2.Background = color
66 print "view2.Background =", str(color)
67 pvsimple.Render(view2)
69 scalarmap = ScalarMapOnField(med_reader, entity, field_name, timestamp)
70 print "ScalarMapOnField(...)"
71 scalarmap.Visibility = 1
72 pvsimple.Render(view2)
74 view2.CameraFocalPoint = [0, 0, 0]
75 print "view2.CameraFocalPoint = [0, 0, 0]"
76 view2.CameraParallelScale = 2
77 print "view2.CameraParallelScale = 2"
78 pvsimple.Render(view2)
81 print "view2.ResetCamera()"
82 pvsimple.Render(view2)
88 view3 = pvsimple.CreateRenderView()
89 print "view3 = pvsimple.CreateRenderView()"
91 color = [0.0, 0.7, 0.0]
92 view3.Background = color
93 print "view3.Background = ", str(color)
94 pvsimple.Render(view3)
96 cutplanes = CutPlanesOnField(med_reader, entity, field_name, timestamp,
97 orientation=Orientation.XY)
98 print "CutPlanesOnField(...)"
100 display_only(cutplanes, view3)
101 print "display_only(cutplanes, view3)"
103 point = view3.CameraFocalPoint
104 point[0] = point[0] + 10
105 view3.CameraFocalPoint = point
106 print "view3.CameraFocalPoint = ", str(point)
109 print "view3.ResetCamera()"
110 pvsimple.Render(view3)
111 print "pvsimple.Render(view3)"
117 view4 = pvsimple.CreateRenderView()
118 print "view4 = pvsimple.CreateRenderView()"
120 color = [1.0, 0.7, 0.0]
121 view4.Background = color
122 print "view5.Background = ", str(color)
123 pvsimple.Render(view4)
125 isosurfaces = IsoSurfacesOnField(med_reader, entity, field_name, timestamp)
126 print "isosurfaces = IsoSurfacesOnField(...)"
128 display_only(isosurfaces, view4)
129 print "display_only(isosurfaces, view4)"
131 print "view4.ResetCamera()"
133 pvsimple.Render(view4)
134 print "pvsimple.Render(view4)"
140 view5 = pvsimple.CreateRenderView()
141 print "view5 = pvsimple.CreateRenderView()"
143 color = [0.7, 0.7, 0.7]
144 view5.Background = color
145 print "view5.Background =", str(color)
146 pvsimple.Render(view5)
148 cutlines = CutLinesOnField(med_reader, entity, field_name, timestamp,
149 orientation1=Orientation.ZX,
150 orientation2=Orientation.YZ)
151 print "cutlines = CutLinesOnField(...)"
153 display_only(cutlines, view5)
154 print "display_only(cutlines, view5)"
155 pvsimple.ResetCamera(view5)
156 print "pvsimple.ResetCamera(view5)"
162 file_path = tablesdir + "sinus.csv"
163 sinus_csv = pvsimple.CSVReader(FileName=file_path)
164 sinus_csv.FieldDelimiterCharacters = ' '
166 view6 = pvsimple.CreateXYPlotView()
167 print "view6 = pvsimple.CreateXYPlotView()"
169 xy_rep = pvsimple.Show(sinus_csv)
170 xy_rep.AttributeType = 'Row Data'
171 xy_rep.UseIndexForXAxis = 0
172 xy_rep.XArrayName = 'x'
173 xy_rep.SeriesVisibility = ['x', '0']