[Paraview] Generating and displaying vtk data directly from the GUI shell tool

Louis Le Grange llg at mtechindustrial.com
Thu Nov 27 04:12:57 EST 2008


Hi

I want to generate and display data in the paraview GUI, all from the python shell tool. The vtk data is not generated from a reader or from inside a programmable source, but directly inside the paraview GUI shell environment. I now want to connect the input of a filter to this polyData. Are there any interfacing functions to do this: Here is my example script in which the comments describe what I am trying to do.

Thanks in advance,
Louis


# Here is the vtk data generated directly in the GUI python shell:

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)



pdata=vtk.vtkPolyData()

pdata.SetPoints(pts)

pdata.SetPolys(cel)



# Here I am setting up a pipline and registering the proxies

pxm=servermanager.ProxyManager()



# Create our programmable filter and set its program ...

#========================================================

filter = servermanager.filters.ProgrammableFilter()

filter.GetProperty("Script").SetElement(0, """

input = self.GetInputDataObject(0, 0)

output = self.GetOutputDataObject(0)

output.DeepCopy(input)

""")



# Connect the polyData output to

# the programmable filter input ...



# Here is where I need a link between the filter and my polyData

# The following obviously does not work...



filter.Input = pData

#filter.Input.SetData(polyData)



pxm.RegisterProxy("sources", "my programmable filter", filter)



view = pxm.GetProxy("views", "RenderView1")

rep = servermanager.CreateRepresentation(filter, view)

pxm.RegisterProxy("representations", "myrep1", rep)








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20081127/2f172541/attachment.htm>


More information about the ParaView mailing list