Salome HOME
Update copyrights 2014.
[modules/paravis.git] / test / VisuPrs / dump_study / B5.py
1 # Copyright (C) 2010-2014  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, or (at your option) any later version.
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/dump_study/B5 case
21
22 import os
23 import sys
24 import salome
25
26 class SalomeSession(object):
27     def __init__(self):
28         import runSalome
29         import sys
30         sys.argv += ["--show-desktop=1"]
31         sys.argv += ["--splash=0"]
32         sys.argv += ["--modules=MED,VISU,PARAVIS"]
33         clt, d = runSalome.main()
34         port = d['port']
35         self.port = port
36         return
37     pass
38
39
40 # 1. Opening saved study
41
42 # run Salome
43 salome_session = SalomeSession()
44 salome.salome_init()
45
46 file_name = os.path.join(os.path.dirname(sys.argv[0]), "test1.hdf")
47 opened_study = salome.myStudyManager.Open(file_name)
48 salome.myStudy = opened_study
49
50 # 2. Load PARAVIS module
51 import paravis
52
53 # 3. Find IsoSurfaces
54 from pvsimple import *
55 obj = FindSource('IsoSurfaces')
56 if obj is None:
57     print "FAILED: can't find IsoSurfaces!!!"
58
59 # 4. Remove med reader object and all other sources
60 for obj in GetSources().values():
61     Delete(obj)
62     
63 # 5. Check results
64 obj = FindSource('ScalarMap')
65 if obj is not None:
66     print "FAILED: ScalarMap was not deleted!!!"