Back to index

salome-paravis  6.5.0
A3.py
Go to the documentation of this file.
00001 # Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 #
00003 # This library is free software; you can redistribute it and/or
00004 # modify it under the terms of the GNU Lesser General Public
00005 # License as published by the Free Software Foundation; either
00006 # version 2.1 of the License.
00007 #
00008 # This library is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 # Lesser General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU Lesser General Public
00014 # License along with this library; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 #
00017 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 #
00019 
00020 # This case corresponds to: /visu/SWIG_scripts/A3 case
00021 
00022 from paravistest import datadir
00023 from presentations import *
00024 import paravis
00025 import pvsimple
00026 
00027 
00028 my_paravis = paravis.myParavis
00029 
00030 print 'Importing "TimeStamps.med"...............',
00031 file_path = datadir + "TimeStamps.med"
00032 my_paravis.ImportFile(file_path)
00033 med_reader = pvsimple.GetActiveSource()
00034 
00035 if med_reader is None:
00036     print "FAILED"
00037 else:
00038     print "OK"
00039 
00040 print "Creating Cut Lines........................",
00041 med_field = "vitesse"
00042 cutlines = CutLinesOnField(med_reader, EntityType.NODE, med_field, 1,
00043                            nb_lines=20,
00044                            orientation1=Orientation.XY,
00045                            orientation2=Orientation.ZX)
00046 if cutlines is None:
00047     print "FAILED"
00048 else:
00049     print "OK"
00050 
00051 print "Getting a viewer.........................",
00052 view = pvsimple.GetRenderView()
00053 if view is None:
00054     print "FAILED"
00055 else:
00056     reset_view(view)
00057     print "OK"
00058 
00059 cutlines.Visibility = 1
00060 view.ResetCamera()
00061 pvsimple.Render()
00062 
00063 print "Creating an Animation.....................",
00064 scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, med_field, 2)
00065 
00066 scene = pvsimple.AnimateReader(med_reader, view)
00067 if scene is None:
00068     print "FAILED"
00069 else:
00070     print "OK"