Salome HOME
0022071: EDF 2497 PARAVIS : Porting of VISU tests for PARAVIS
[modules/paravis.git] / test / VisuPrs / bugs / A1.py
1 # Copyright (C) 2010-2013  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.
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/bugs/A1 case
21
22 import sys
23 import os
24 import time
25 from paravistest import datadir, pictureext, get_picture_dir
26 from presentations import *
27 import paravis
28 import pvsimple
29
30 my_paravis = paravis.myParavis
31 picturedir = get_picture_dir(sys.argv[1], "bugs/A1")
32
33 med_file_path = datadir + "fra1.med"
34 pic_path = os.path.join(picturedir, "A1." + pictureext)
35
36 # 1. Import MED file
37 my_paravis.ImportFile(med_file_path)
38 med_reader = pvsimple.GetActiveSource()
39
40 # 2. Create mesh
41 mesh = MeshOnEntity(med_reader, "LE_VOLUME", EntityType.CELL)
42 mesh.Representation = 'Surface With Edges'
43
44 # 3. Display mesh and make snapshot
45 view = pvsimple.GetRenderView()
46
47 display_only(mesh, view)
48 reset_view(view)
49
50 view.CameraViewUp = [0,1,0]
51 view.CameraPosition = [0, 42, -200]
52 view.CameraFocalPoint = [25, 0, 5]
53 view.CameraParallelScale = 1
54
55 view.ResetCamera()
56
57 pvsimple.Render(view)
58
59 print "Picure file name is " + pic_path
60 pv.WriteImage(pic_path, view=view, Magnification=1)
61 time.sleep(1)