Import tables from file:
import os import salome import visu_gui # The directory containing data table files datadir = os.getenv("DATA_DIR") # Get VISU engine myVisu = visu_gui.myVisu # Import tables from file tableFile = os.path.join(datadir,"Tables","tables_test.xls") myTablesSO = myVisu.ImportTables(tableFile, False) # Print table names print "\nNames of the imported tables:" iter = salome.myStudy.NewChildIterator(myTablesSO) while iter.More(): aTableSO = iter.Value() if aTableSO: aTable = aTableSO.GetObject() print "\n", aTable.GetTitle() iter.Next() # Update the object browser salome.sg.updateObjBrowser(1)
Export table to the file:
import os import salome import visu_gui # The directory containing data table files datadir = os.getenv("DATA_DIR") # Get VISU engine myVisu = visu_gui.myVisu # Import tables from file tableFile = os.path.join(datadir,"Tables","tables_test.xls") myTablesSO = myVisu.ImportTables(tableFile, False) # Export the first imported table to a new file expTableFile = os.path.join(datadir,"Tables","sinus_table.txt") sinusTableSO = salome.myStudy.FindObject("sinus") myVisu.ExportTableToFile(sinusTableSO, expTableFile) # Update the object browser salome.sg.updateObjBrowser(1)