# Interactive selection of cells based on ParaView generated parameters

**URL:** <https://discourse.paraview.org/t/interactive-selection-of-cells-based-on-paraview-generated-parameters/13059>\
**Category:** ParaView Support\
**Created:** [October 18, 2023, 1:02pm UTC](https://discourse.paraview.org/t/interactive-selection-of-cells-based-on-paraview-generated-parameters/13059 "2023-10-18T13:02:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)\
**Post date:** [October 18, 2023, 2:07pm UTC](https://discourse.paraview.org/t/interactive-selection-of-cells-based-on-paraview-generated-parameters/13059/2 "2023-10-18T14:07:43Z")

</div>

You cannot do it directly. But what you can do is convert the single mesh with `RegionID` into a partitioned structure that the ParaView GUI will understand.

There is no direct filter to do it, but it has been discussed before: [How to create a collection of blocks (multi block) based on connectivity](https://discourse.paraview.org/t/how-to-create-a-collection-of-blocks-multi-block-based-on-connectivity/9124). The instructions there are a bit out of date, so here is an update.

Create a `Programmable Filter`. Set the output data type to `vtkPartitionedDataSet`. Set the script to the following:

```py
import vtk
inp = self.GetInputDataObject(0, 0)
out = self.GetOutput()

outData = vtk.vtkPartitionedDataSet()

rangeID = inputs[0].CellData.GetArray('RegionId').GetRange()
outData.SetNumberOfPartitions(int(rangeID[1]) + 1)

for ic in range(int(rangeID[0]), int(rangeID[1]) + 1):
    thresh = vtk.vtkThreshold()
    thresh.SetInputData(inp)
    thresh.SetInputArrayToProcess(0,0,0,
        vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS,'RegionId')
    
    thresh.SetLowerThreshold(ic-0.5)
    thresh.SetUpperThreshold(ic+0.5)
    thresh.Update()
    tooutData = thresh.GetOutputDataObject(0)
    outData.SetPartition(ic, tooutData)

out.DeepCopy(outData)

```

This will run internally run the threshold filter on all region ids and then collect them into a `vtkPartitionedDataSet`.

Once you have a `vtkPartitionedDataSet`, you can use select block ![image](https://discourse.paraview.org/uploads/default/original/2X/a/ad1731bd245885164a586cfc7b0a79bbc8762e55.png) (or just hit `b`) in the view and click on a face to select it.

[star-blocks.pvsm](https://discourse.paraview.org/uploads/short-url/1hfusyeMDs7ror8uXh3qR6HPsaH.pvsm) (670.2 KB)

---

_[View the full topic](https://discourse.paraview.org/t/interactive-selection-of-cells-based-on-paraview-generated-parameters/13059)._
