[Paraview] Programmable Filter: UpdateProgress and input for Threshold

Jerome Robert jeromerobert at users.sf.net
Thu Nov 15 03:51:42 EST 2007


Hi all,

I wrote the following programmable filter in Paraview 3.2:

from math import sqrt
pdi = self.GetInput()
pdo = self.GetOutput()
newData = paraview.vtkDoubleArray()
newData.SetName("Max length edge")
numCells = pdi.GetNumberOfCells()
self.SetProgressText("Max length edge")

for i in range(0, numCells):
       cell = pdi.GetCell(i)
       value = max([ cell.GetEdge(i).GetLength2() for i in [0, 1, 2]])
       newData.InsertNextValue(sqrt(value))
       self.UpdateProgress(i/numCells)

pdo.GetCellData().AddArray(newData)

So I have 2 problems and questions:

- SetProgressText and UpdateProgress calls seems to be not taken into account (i.e. the progress bar stay grey). Is it because it's not yet supported or because my script is wrong ?
- If I use this script in a Programmable filter, I can use its output as input for Threshold or Histogram filters. If I create a Custom Filter from this Programmable filter, it CANNOT be used as input for Threshold or Histogram. Why ?

Regards,

Jerome



More information about the ParaView mailing list