Please avoid changing the subject line for a continuing thread. It makes it easier to track the message thread.

Thanks
Utkarsh

Louis at M-Tech wrote:
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()

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


------------------------------------------------------------------------

_______________________________________________
ParaView mailing list
[email protected]
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
ParaView mailing list
[email protected]
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to