[Paraview] Got programmable filter to work outside PV GUI - but still not programmable source

Louis at M-Tech llg at mtechindustrial.com
Fri Nov 21 05:58:28 EST 2008


Hi 

 

I got programmable filter to work outside the paraview GUI - but still not
the programmable source; See the example below - if you want to try out the
programmable source, just set ptr = pgsrc instead of ptr = pgflt - see
below.

 

I am still puzzled why the programmable source does not work. It works
within the paraview GUI - but not outside. To see how it works within the
paraview GUI do the following:

Open paraview

Create a programmable source

Copy the script part below into the GUI editor

Click apply

.

 

 

Regards,

Louis

 

 

$$$$$$$$$$$$$$$$$$$$$$

 

from paraview import servermanager

connection = servermanager.Connect()

#

pgsrc = servermanager.sources.ProgrammableSource()

pgflt = servermanager.filters.ProgrammableFilter()

#

#ptr = pgsrc

ptr = pgflt

#

ptr.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)

""")

 

pgflt.Input = pgsrc

 

view = servermanager.CreateRenderView()

rep = servermanager.CreateRepresentation(ptr,view)

 

view.StillRender()

view.ResetCamera()

view.StillRender()

 

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20081121/0e4bac0f/attachment-0001.htm>


More information about the ParaView mailing list