1 # Copyright (C) 2010-2016 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 *
25 from math import radians
27 cell_entity = EntityType.CELL
28 node_entity = EntityType.NODE
31 print "**** Step1: Import MED file"
33 print 'Import "fra.med"....................',
34 file_path = datadir + "fra.med"
35 pvsimple.OpenDataFile(file_path)
36 med_reader = pvsimple.GetActiveSource()
38 if med_reader is None:
43 view = pvsimple.GetRenderView()
45 field_name = 'VITESSE'
46 print "Creating Cut Planes.................",
47 orient = Orientation.YZ
48 cutplanes = CutPlanesOnField(med_reader, node_entity, field_name, 1, orientation=orient)
52 display_only(cutplanes, view)
55 slice_filter = pvsimple.GetActiveSource()
58 print "**** Step2: Changing view"
60 print "Fit All.............................",
64 print "Rotate..............................",
68 nb_planes = len(slice_filter.SliceOffsetValues)
70 for i in xrange(1, 50):
71 y_angle = y_angle + 0.05
72 normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
73 slice_filter.SliceType.Normal = normal
76 for i in xrange(1,50):
77 y_angle = y_angle - 0.05
78 normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
79 slice_filter.SliceType.Normal = normal
84 print "View Point (FRONT)..................",
85 view.CameraViewUp = [0.0, 0.0, 1.0]
86 view.CameraPosition = [2.4453961849843453, 0.03425, 0.541]
90 print "View Point (BACK)...................",
91 view.CameraPosition = [-2.0343961849843457, 0.03425, 0.541]
95 print "View Point (TOP)....................",
96 view.CameraViewUp = [0.0, 1.0, 0.0]
97 view.CameraPosition = [0.2055, 0.03425, 2.7808961849843454]
101 print "View Point (BOTTOM).................",
102 view.CameraPosition = [0.2055, 0.03425, -1.6988961849843456]
106 print "View Point (LEFT)...................",
107 view.CameraViewUp = [0.0, 0.0, 1.0]
108 view.CameraPosition = [0.2055, -2.2056461849843454, 0.541]
112 print "View Point (RIGHT) .................",
113 view.CameraPosition = [0.2055, 2.2741461849843456, 0.541]
117 print "Restore View........................",