Salome HOME
Merge branch 'origin/abn/newpy_pv4-1'
[modules/paravis.git] / test / VisuPrs / bugs / A2.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/A2 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/A2")
32
33 med_file_path = datadir + "carre_MIXTE_0000_v3.0.6.med"
34 pic_path = os.path.join(picturedir, "A2." + pictureext)
35
36 print "BREAKPOINT_1"
37 # 1. Import MED file
38 print 'Importing "carre_MIXTE_0000.med"...',
39 my_paravis.ImportFile(med_file_path)
40 med_reader = pvsimple.GetActiveSource()
41
42 if med_reader is None:
43     print "FAILED"
44 else:
45     print "OK"
46
47 # 2. Create mesh
48 print "Creating MeshOnEntity..............",
49 mesh = MeshOnEntity(med_reader, "dom", EntityType.CELL)
50
51 if mesh is None:
52     print "FAILED"
53 else:
54     mesh.Representation = 'Surface With Edges'
55     print "OK"
56
57 # 3. Display mesh and make snapshot
58 view = pvsimple.GetRenderView()
59
60 display_only(mesh, view)
61 reset_view(view)
62
63 view.CameraViewUp = [0, 0, 1]
64 view.CameraPosition = [50,  180, 0]
65 view.CameraFocalPoint = [0.2, 0, 0.5]
66 view.CameraParallelScale = 0.1
67
68 #view.ResetCamera()
69
70 pvsimple.Render(view)
71
72 print "Picure file name is " + pic_path
73 pv.WriteImage(pic_path, view=view, Magnification=1)
74 time.sleep(1)