# Extract surfaces with Programmable Filter

**URL:** https://discourse.paraview.org/t/extract-surfaces-with-programmable-filter/998
**Category:** ParaView Support
**Created:** [December 4, 2018, 4:20pm UTC](https://discourse.paraview.org/t/extract-surfaces-with-programmable-filter/998 "2018-12-04T16:20:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Hamburgerfinger](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/h/eb9ed0/32.png) [@Hamburgerfinger](https://discourse.paraview.org/u/Hamburgerfinger)
#### Post date: [December 4, 2018, 4:20pm UTC](https://discourse.paraview.org/t/extract-surfaces-with-programmable-filter/998/1 "2018-12-04T16:20:01Z")

</div>

Hi,

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()

N=1

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

```
N += 1

```

Any help would be appreciated!
