Version: 6.3.1

Curves

Create and display curves using the imported table:

import os
from time import sleep

import salome

import VISU
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","table_test.xls")
myTablesSO = myVisu.ImportTables(tableFile, False)

# Get the table
anIsFound, myTableSO = myTablesSO.FindSubObject(1)
anID = myTableSO.GetID()
myTable = myVisu.CreateTable(anID)

# Create a table view
myViewManager = myVisu.GetViewManager()
myTableView = myViewManager.CreateTableView(myTable)
myTableView.SetTitle('My Curves')

# Create a container for a set of curves
myContainer = myVisu.CreateContainer()

# Create curves
aNbCurves = myTable.GetNbRows()
aCurve = None
for i in range(1, aNbCurves):
   aCurve = myVisu.CreateCurve( myTable, 1, i )
   myContainer.AddCurve(aCurve)

# Update the object browser
salome.sg.updateObjBrowser(1)

# Create a Plot 2D view
myView = myViewManager.CreateXYPlot();
myView.SetTitle("The viewer for My Curves")

# Display all curves (i.e. container)
myView.Display(myContainer)
sleep(5)

# Set the curves displaying mode
myView.SetCurveType(VISU.XYPlot.SPLINE)
# Set the marker size
myView.SetMarkerSize(15)

# Change the display parameters of the last created curve
# Set the marker type
aCurve.SetMarker(VISU.Curve.CIRCLE)
# Set the line type and width
aCurve.SetLine(VISU.Curve.SOLIDLINE, 4)

# Display only the last created curve
myView.DisplayOnly(aCurve)


Please, see Curve interface reference documentation and XYPlot interface reference documentation for more details.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS