1 # Copyright (C) 2010-2016 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
20 # This case corresponds to: /visu/dump_study/B0 case
22 from paravistest import datadir
23 from presentations import *
24 from pvsimple import *
26 # 1. TimeStamps.med import
27 file_path = datadir + "TimeStamps.med"
28 OpenDataFile(file_path)
29 med_reader = GetActiveSource()
30 if med_reader is None :
31 raise RuntimeError, "TimeStamps.med wasn't imported..."
33 # 2. Presentations creation
35 prs_names = ["ScalarMap", "IsoSurfaces", "CutPlanes", "CutLines", "DeformedShape", "Vectors", "StreamLines", "Plot3D", "DeformedShapeAndScalarMap", "GaussPoints"]
40 for name in prs_names:
41 print "Creation of ", name, " presentation..."
42 if name == "GaussPoints":
43 prs = GaussPointsOnField(med_reader, EntityType.CELL, "pression", 1)
46 prs = eval(name + "OnField(med_reader, EntityType.NODE, med_field, 1)")
48 print "ERROR!!! ", name," presentation wasn't created..."
49 # StreamLines presentation is empty for "vitesse" field defined in the loaded MED file.
50 # TODO: check why stream lines prs is empty
51 if name == "StreamLines":
52 print "WARNING: Stream lines presentation is empty!"
56 RenameSource(name, prs.Input)
60 path_to_save = os.path.join(os.getenv("HOME"), "AllPresentations.py")
61 SaveTrace( path_to_save )
63 # 4. Delete the created objects, recreate the view
64 source_list = GetSources().values()
65 for source in source_list:
68 Delete(GetActiveView())
69 view = CreateRenderView()
71 # 5. Execution of the created script
72 execfile(path_to_save)
74 # 6. Check the restored objects
75 for name in prs_names:
76 source = FindSource(name)
78 print "There is no ", name, " in the study (must be created by executed python script)!!!"
81 print name + " was found..."
84 raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."