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

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?


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)