Back to index

salome-paravis  6.5.0
A2.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/tables/A2 case
00021 # Import table in Post-Pro specific format from the file;
00022 # create curves.
00023 
00024 import sys
00025 
00026 from paravistest import tablesdir, get_picture_dir, pictureext
00027 from presentations import *
00028 import paravis
00029 import pvsimple
00030 
00031 # Import table from file
00032 print 'Import flux.tab.txt ....',
00033 file_path = tablesdir + "flux.tab.txt"
00034 table_reader = pvsimple.TableReader(FileName=file_path)
00035 if table_reader is None:
00036     print "FAILED"
00037 else:
00038     print "OK"
00039 
00040 # Get available tables
00041 print 'Get available tables .....'
00042 available_tables = table_reader.GetPropertyValue("AvailableTables")
00043 if (available_tables is None) or (len(available_tables) == 0):
00044     print "FAILED"
00045 else:
00046     print available_tables
00047 
00048 # Create curves
00049 cur_view = pvsimple.GetRenderView()
00050 if cur_view:
00051     pvsimple.Delete(cur_view)
00052 xy_view = pvsimple.CreateXYPlotView()
00053 
00054 xy_rep = pvsimple.Show(table_reader)
00055 xy_rep.AttributeType = 'Row Data'
00056 xy_rep.UseIndexForXAxis = 0
00057 x_array = xy_rep.GetPropertyValue("SeriesNamesInfo")[0]
00058 xy_rep.XArrayName = x_array
00059 xy_rep.SeriesVisibility = [x_array, '0']
00060 
00061 xy_rep.Visibility = 0
00062 pvsimple.Render(xy_view)
00063 xy_rep.Visibility = 1
00064 pvsimple.Render(xy_view)
00065 
00066 # Write image
00067 
00068 # Directory for saving snapshots
00069 picturedir = get_picture_dir(sys.argv[1], "Tables/A2")
00070 if not picturedir.endswith(os.sep):
00071     picturedir += os.sep
00072 
00073 file_name = picturedir + "flux_tab." + pictureext
00074 pvsimple.WriteImage(file_name, view=xy_view, Magnification=1)
00075 
00076 
00077