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/B3 case
23 from presentations import *
24 from pvsimple import *
25 from paravistest import save_trace
26 from paraview import smtrace
28 config = smtrace.start_trace()
29 config.SetFullyTraceSupplementalProxies(True)
30 config.SetPropertiesToTraceOnCreate(config.RECORD_ALL_PROPERTIES)
36 table_title = "My Table"
38 # define script for table creation
44 table = self.GetTableOutput()
47 col1 = vtk.vtkDoubleArray()
48 col1.SetName('First Column')
49 col1.InsertNextValue(1.11)
50 col1.InsertNextValue(4.44)
53 # Create second column
54 col2 = vtk.vtkDoubleArray()
55 col2.SetName('Second Column')
56 col2.InsertNextValue(2.22)
57 col2.InsertNextValue(5.55)
61 col3 = vtk.vtkDoubleArray()
62 col3.SetName('Third Column')
63 col3.InsertNextValue(3.33)
64 col3.InsertNextValue(6.66)
68 # creating programmable source for the table
69 table = ProgrammableSource()
70 table.OutputDataSetType = 'vtkTable'
71 table.Script = table_script
72 RenameSource(title, table)
73 table.UpdatePipeline()
75 orig_script = table.Script
78 text = smtrace.stop_trace()
79 path_to_save = os.path.join(os.getenv("HOME"), "table.py")
80 save_trace( path_to_save, text )
85 # 4. Execution of the created script
86 execfile(path_to_save)
88 # 5. Check the restored table
89 table = FindSource(title)
91 raise RuntimeError, "There is no table in the study (must be created by executed python script)!!!"
93 if table.Script != orig_script:
94 print "ERROR!!! The script value is incorrect:"
99 raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."