1 # Copyright (C) 2010-2014 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
21 MEDReader test script.
22 Before launching the script necessary MED files has to be placed into ${TESTDIR}/MedData directory
25 if not ('servermanager' in dir()):
26 from pvsimple import *
32 def medread (path, impth):
33 print '============================================================'
35 if os.path.exists(path):
36 filelist = os.listdir(path)
40 fname = str(filelist[i])
41 if fname.rfind(".med") > -1:
44 v.CameraPosition = [0.0, 0.0, 6.7]
46 v.CameraClippingRange = [4.5, 9.5]
48 v.Background = [0., 0., 0.]
49 v.CameraParallelScale = 1.8
51 file_med = MEDReader( FileName=(path + fname))
54 SetActiveSource(file_med)
56 ##Show (file_med, view=v)
60 WriteImage(filename = (impth + "medFile_" + str(i+1) + ".png"), view=v, Magnification=2)
61 print str(i+1), "Shown file is: ", fname
64 v1 = CreateRenderView()
68 testdir = os.getenv("TESTDIR")
69 pvdata = os.getenv("PVDATA")
71 if __name__ == "__main__":
72 medread(path=testdir+"/MedData/", impth=testdir+"/Pic/")