[Paraview] Re: Programmable Filter: UpdateProgress and input for
Threshold
Jerome Robert
jeromerobert at users.sf.net
Fri Nov 16 03:13:25 EST 2007
ok my first question was so stupid (i and numCells are integer not float). Any idea for the second one ?
On Thu, 15 Nov 2007 09:51:42 +0100, Jerome Robert <jeromerobert at users.sf.net> wrote:
> 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