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