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 ./MedData directory
25 if not ('servermanager' in dir()):
26 from pvsimple import *
33 def medread (path, impth):
34 print '============================================================'
36 if os.path.exists(path):
37 filelist = os.listdir(path)
41 fname = str(filelist[i])
42 if fname.rfind(".med") > -1:
45 v.CameraPosition = [0.0, 0.0, 6.7]
47 v.CameraClippingRange = [4.5, 9.5]
49 v.Background = [0., 0., 0.]
50 v.CameraParallelScale = 1.8
52 file_med = MEDReader( FileName=(path + fname))
55 SetActiveSource(file_med)
57 ##Show (file_med, view=v)
61 WriteImage(filename = (impth + "medFile_" + str(i+1) + ".png"), view=v, Magnification=2)
62 print str(i+1), "Shown file is: ", fname
65 v1 = CreateRenderView()
69 scriptdir = inspect.getframeinfo(inspect.currentframe())[0]
70 testdir = os.path.dirname( os.path.abspath(scriptdir) )
73 if __name__ == "__main__":
74 medread(path=testdir+"/MedData/", impth=testdir+"/Pic/")