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/united/A2 case
22 from paravistest import datadir
23 from presentations import *
26 from math import radians
28 my_paravis = paravis.myParavis
30 cell_entity = EntityType.CELL
31 node_entity = EntityType.NODE
34 print "**** Step1: Import MED file"
36 print 'Import "fra.med"....................',
37 file_path = datadir + "fra.med"
38 my_paravis.ImportFile(file_path)
39 med_reader = pvsimple.GetActiveSource()
41 if med_reader is None:
46 view = pvsimple.GetRenderView()
48 field_name = 'VITESSE'
49 print "Creating Cut Planes.................",
50 orient = Orientation.YZ
51 cutplanes = CutPlanesOnField(med_reader, node_entity, field_name, 1, orientation=orient)
55 display_only(cutplanes, view)
58 slice_filter = pvsimple.GetActiveSource()
61 print "**** Step2: Changing view"
63 print "Fit All.............................",
67 print "Rotate..............................",
71 nb_planes = len(slice_filter.SliceOffsetValues)
73 for i in xrange(1, 50):
74 y_angle = y_angle + 0.05
75 normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
76 slice_filter.SliceType.Normal = normal
79 for i in xrange(1,50):
80 y_angle = y_angle - 0.05
81 normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
82 slice_filter.SliceType.Normal = normal
87 print "View Point (FRONT)..................",
88 view.CameraViewUp = [0.0, 0.0, 1.0]
89 view.CameraPosition = [2.4453961849843453, 0.03425, 0.541]
93 print "View Point (BACK)...................",
94 view.CameraPosition = [-2.0343961849843457, 0.03425, 0.541]
98 print "View Point (TOP)....................",
99 view.CameraViewUp = [0.0, 1.0, 0.0]
100 view.CameraPosition = [0.2055, 0.03425, 2.7808961849843454]
104 print "View Point (BOTTOM).................",
105 view.CameraPosition = [0.2055, 0.03425, -1.6988961849843456]
109 print "View Point (LEFT)...................",
110 view.CameraViewUp = [0.0, 0.0, 1.0]
111 view.CameraPosition = [0.2055, -2.2056461849843454, 0.541]
115 print "View Point (RIGHT) .................",
116 view.CameraPosition = [0.2055, 2.2741461849843456, 0.541]
120 print "Restore View........................",