Back to index

salome-paravis  6.5.0
A6.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/A6 case
00021 # Import a table from file and show it in 2D viewer
00022 
00023 from paravistest import tablesdir
00024 from presentations import *
00025 import paravis
00026 import pvsimple
00027 
00028 
00029 # Import table from CSV file
00030 file_path = tablesdir + "sinus.csv"
00031 sinus_csv = pvsimple.CSVReader(FileName=file_path)
00032 
00033 # Import settings
00034 sinus_csv.DetectNumericColumns = 1
00035 sinus_csv.UseStringDelimiter = 1
00036 sinus_csv.FieldDelimiterCharacters = ' '
00037 sinus_csv.HaveHeaders = 1
00038 
00039 # Display curve
00040 cur_view = pvsimple.GetRenderView()
00041 if cur_view:
00042     pvsimple.Delete(cur_view)
00043 xy_view = pvsimple.CreateXYPlotView()
00044 
00045 xy_rep = pvsimple.Show(sinus_csv)
00046 xy_rep.AttributeType = 'Row Data'
00047 xy_rep.UseIndexForXAxis = 0
00048 xy_rep.XArrayName = 'x'
00049 xy_rep.SeriesVisibility = ['x', '0']
00050 
00051 pvsimple.Render()