1 # Copyright (C) 2010-2013 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.
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
20 # This case corresponds to: /visu/dump_study/B0 case
22 from paravistest import datadir
23 from presentations import *
25 from pvsimple import *
27 my_paravis = paravis.myParavis
29 # 1. TimeStamps.med import
30 file_path = datadir + "TimeStamps.med"
31 my_paravis.ImportFile(file_path)
32 med_reader = GetActiveSource()
33 if med_reader is None :
34 raise RuntimeError, "TimeStamps.med wasn't imported..."
36 # 2. Presentations creation
38 prs_names = ["ScalarMap", "IsoSurfaces", "CutPlanes", "CutLines", "DeformedShape", "Vectors", "StreamLines", "Plot3D", "DeformedShapeAndScalarMap", "GaussPoints"]
43 for name in prs_names:
44 print "Creation of ", name, " presentation..."
45 if name == "GaussPoints":
46 prs = GaussPointsOnField(med_reader, EntityType.CELL, "pression", 1)
49 prs = eval(name + "OnField(med_reader, EntityType.NODE, med_field, 1)")
51 print "ERROR!!! ", name," presentation wasn't created..."
54 RenameSource(name, prs.Input)
58 path_to_save = os.path.join(os.getenv("HOME"), "AllPresentations.py")
59 SaveTrace( path_to_save )
61 # 4. Delete the created objects, recreate the view
62 source_list = GetSources().values()
63 for source in source_list:
66 Delete(GetActiveView())
67 view = CreateRenderView()
69 # 5. Execution of the created script
70 execfile(path_to_save)
72 # 6. Check the restored objects
73 for name in prs_names:
74 source = FindSource(name)
76 print "There is no ", name, " in the study (must be created by executed python script)!!!"
79 print name + " was found..."
82 raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."