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/Vectors/F9 case
21 # Create Vectors for field of the the given MED file for 10 timestamps%
24 from paravistest import datadir, pictureext, get_picture_dir
26 from pvsimple import GetActiveSource, GetRenderView, Render
27 from presentations import VectorsOnField, hide_all,EntityType,PrsTypeEnum,reset_view,process_prs_for_test
29 # Create presentations
30 myParavis = paravis.myParavis
32 picturedir = get_picture_dir("Vectors/F9")
34 theFileName = datadir + "Bug829_resu_mode.med"
35 print " --------------------------------- "
36 print "file ", theFileName
37 print " --------------------------------- "
39 """Build presentations of the given types for all fields of the given file."""
40 #print "Import %s..." % theFileName.split('/')[-1],
41 result = myParavis.ImportFile(theFileName)
42 aProxy = GetActiveSource()
44 raise RuntimeError, "Error: can't import file."
47 aView = GetRenderView()
49 # Create required presentations for the proxy
50 # CreatePrsForProxy(aProxy, aView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete)
51 aFieldNames = aProxy.PointArrays.GetData()
52 aNbOnNodes = len(aFieldNames)
53 aFieldNames.extend(aProxy.CellArrays.GetData())
54 aTimeStamps = aProxy.TimestepValues.GetData()
55 aFieldEntity = EntityType.NODE
56 aFieldName = "MODES_DEPL"
58 #Creation of a set of non-colored and then colored Vectors presentations, based on time stamps of MODES_DEP field
59 for colored in [False,True]:
60 colored_str = "_non-colored"
62 colored_str = "_colored"
65 aPrs = VectorsOnField(aProxy, aFieldEntity, aFieldName, i, is_colored=colored)
67 raise RuntimeError, "Presentation is None!!!"
68 # display only current deformed shape
69 #display_only(aView,aPrs)
73 # Add path separator to the end of picture path if necessery
74 if not picturedir.endswith(os.sep):
76 prs_type = PrsTypeEnum.VECTORS
78 # Get name of presentation type
79 prs_name = PrsTypeEnum.get_name(prs_type)
80 f_prs_type = prs_name.replace(' ', '').upper()
81 # Construct image file name
82 pic_name = picturedir + aFieldName+colored_str + "_" + str(i) + "_" + f_prs_type + "." + pictureext
83 # Show and record the presentation
84 process_prs_for_test(aPrs, aView, pic_name)