[Paraview] Why does this programmable source not work outside the paraview GUI
Louis at M-Tech
llg at mtechindustrial.com
Thu Nov 20 08:29:58 EST 2008
Hi All,
Why does this piece of code containing a programmable source not work
OUTSIDE the paraview GUI?
a) When the source is changed to ConeSource() it works (see Label 1 in the
code below).
b) Also when the Script content is pasted inside the paraview GUI scripting
editor, it does work - so the script contents itself is ok.
When the code is run directly from a python command line only an empty
graphis window is displayed - as if the script part is faulty.
Thanks in advance,
Louis
HERE IS THE EXAMPLE:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
from paraview import servermanager
connection = servermanager.Connect()
pgsrc=servermanager.sources.ProgrammableSource()
pgsrc.GetProperty("Script").SetElement(0, """
import vtk
pts=vtk.vtkPoints()
pts.Initialize()
pts.InsertNextPoint(0,0,0)
pts.InsertNextPoint(1,0,.0)
pts.InsertNextPoint(2,1,0)
pts.InsertNextPoint(3,3,0.)
cel=vtk.vtkCellArray()
cel.Initialize()
cel.InsertNextCell(4) # number of points
cel.InsertCellPoint(0)
cel.InsertCellPoint(1)
cel.InsertCellPoint(2)
cel.InsertCellPoint(3)
output = self.GetOutput()
output.SetPoints(pts)
output.SetStrips(cel)
""")
view = servermanager.CreateRenderView()
# This programmable source pgsrc does not display
rep = servermanager.CreateRepresentation(pgsrc,view)
# Label 1: This source do display
#coneSource = servermanager.sources.ConeSource()
#rep = servermanager.CreateRepresentation(coneSource,view)
view.StillRender()
view.ResetCamera()
view.StillRender()
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20081120/43f42763/attachment.htm>
More information about the ParaView
mailing list