# Select cells based on ID in python shell

**URL:** https://discourse.paraview.org/t/select-cells-based-on-id-in-python-shell/12289
**Category:** ParaView Support
**Created:** [June 12, 2023, 10:07am UTC](https://discourse.paraview.org/t/select-cells-based-on-id-in-python-shell/12289 "2023-06-12T10:07:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Trailer1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/trailer1/32/5143_2.png) [@Trailer1](https://discourse.paraview.org/u/Trailer1)
#### Post date: [June 12, 2023, 10:07am UTC](https://discourse.paraview.org/t/select-cells-based-on-id-in-python-shell/12289/1 "2023-06-12T10:07:30Z")

</div>

Hello,

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?

Edit:  
Is this the best way to achieve this?

```auto
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')
ExtractSelection()
Show()

```

Best Regards

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [June 13, 2023, 8:44am UTC](https://discourse.paraview.org/t/select-cells-based-on-id-in-python-shell/12289/2 "2023-06-13T08:44:32Z")

</div>

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