Extract surfaces with Programmable Filter


I have a tetrahedral mesh in vtk unstructured grid format, with different regions defined by cell scalars. I want to apply a threshold filter to isolate an individual component and then apply the extract surface filter. I want to just loop through all the scalars in the mesh to get separate surfaces for each region in the original mesh.

My script looks something like this, but I can’t get it to work:

import paraview.simple

pdi = self.GetInput()
pdo = self.GetOutput()


while N < 16:
component = paraview.simple.Threshold(pdi)
component.ThresholdRange = [N,N]
surface = paraview.simple.ExtractSurface(component)

N += 1

Any help would be appreciated!