Select cells based on ID in python shell


I would like to select every 10th cell in my domain based on the ID.

How can I do this?

Would the python shell be useful?

Is this the best way to achieve this?

import paraview.simple as pv
mesh = pv.GetActiveSource()
data_info = mesh.GetDataInformation()
nCells = data_info.GetNumberOfCells()

nIthCell = 100
cellIDs = list(range(0, nCells, nIthCell))
cellsIDs = [val for num in cellIDs for val in (0, num)]
SelectIDs(IDs=cellsIDs, FieldType='CELL')

Best Regards

I think you are right: it is not really doable from the interface, and your python script looks fine.

1 Like