# How to create a collection of blocks (multi block) based on connectivity

**URL:** https://discourse.paraview.org/t/how-to-create-a-collection-of-blocks-multi-block-based-on-connectivity/9124
**Category:** ParaView Support
**Created:** [March 5, 2022, 3:49pm UTC](https://discourse.paraview.org/t/how-to-create-a-collection-of-blocks-multi-block-based-on-connectivity/9124 "2022-03-05T15:49:19Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Fotos\_Stylianou](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fotos_stylianou/32/7759_2.png) [@Fotos\_Stylianou](https://discourse.paraview.org/u/Fotos_Stylianou)
#### Post date: [March 8, 2022, 10:51am UTC](https://discourse.paraview.org/t/how-to-create-a-collection-of-blocks-multi-block-based-on-connectivity/9124/4 "2022-03-08T10:51:28Z")

</div>

Hi Mathieu,

I made the following script but the result is not what I expected. I get a Multi-Block but all the blocks have the same data. All blocks are the same with the last value of “ic”.  
Do you see the problem?

```auto

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

outData = vtk.vtkMultiBlockDataSet()

thresh = vtk.vtkThreshold()
thresh.SetInputData(inp)
thresh.SetInputArrayToProcess(0,0,0,vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS,'RegionId')
rangeID = inputs[0].CellData.GetArray('RegionId').GetRange()

for ic in range(int(rangeID[0]), int(rangeID[1])):
    thresh.ThresholdBetween(ic-0.5,ic+0.5)
    thresh.Update()
    tooutData = thresh.GetOutputDataObject(0)
    outData.SetBlock(ic,tooutData)

out.DeepCopy(outData)

```

---

_[View the full topic](https://discourse.paraview.org/t/how-to-create-a-collection-of-blocks-multi-block-based-on-connectivity/9124)._
