# VTK 9.6: How to use GetCellTypes to replace GetCellTypesArray in Python?

**URL:** https://discourse.vtk.org/t/vtk-9-6-how-to-use-getcelltypes-to-replace-getcelltypesarray-in-python/16396
**Category:** Support
**Created:** [April 23, 2026, 9:36pm UTC](https://discourse.vtk.org/t/vtk-9-6-how-to-use-getcelltypes-to-replace-getcelltypesarray-in-python/16396 "2026-04-23T21:36:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![raungst](https://discourse.vtk.org/user_avatar/discourse.vtk.org/raungst/32/1965_2.png) [@raungst](https://discourse.vtk.org/u/raungst)
#### Post date: [April 23, 2026, 9:36pm UTC](https://discourse.vtk.org/t/vtk-9-6-how-to-use-getcelltypes-to-replace-getcelltypesarray-in-python/16396/1 "2026-04-23T21:36:45Z")

</div>

I’m trying to upgrade my code to use 9.6 instead of 9.4. I used to use GetCellTypesArray to get the cell type for every cell in my unstructured grid. The deprecation warning says to use GetCellTypes instead. However, this function wants an argument and won’t be called without one. If I try passing in an empty vtkCellTypes variable, it populates it, but I can’t get that to run through vtk\_to\_numpy.

I’m just looking for a replacement for: cellTypes = vtk\_to\_numpy(ug.GetCellTypesArray())

The help shows that it should be able to be called without an argument and do what I need, so I’m not sure what I’m missing.

Thanks!

> **[VTK: vtkUnstructuredGrid Class Reference](https://vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html)**

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [April 24, 2026, 12:23pm UTC](https://discourse.vtk.org/t/vtk-9-6-how-to-use-getcelltypes-to-replace-getcelltypesarray-in-python/16396/2 "2026-04-24T12:23:42Z")

</div>

You should be able to call `GetCellTypes()` with no arguments. Please double-check the version of vtk that you are using.

```python
>>> import vtkmodules
>>> vtkmodules. __version__'9.6.1'
>>> from vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid
>>> ug = vtkUnstructuredGrid()
>>> ug.GetCellTypes()
<vtkmodules.vtkCommonCore.vtkUnsignedCharArray(0x562161ce43b0) at 0x7fa56b868ca0>

```

---

<div class="post-metadata">

### Author: ![raungst](https://discourse.vtk.org/user_avatar/discourse.vtk.org/raungst/32/1965_2.png) [@raungst](https://discourse.vtk.org/u/raungst)
#### Post date: [April 24, 2026, 1:36pm UTC](https://discourse.vtk.org/t/vtk-9-6-how-to-use-getcelltypes-to-replace-getcelltypesarray-in-python/16396/3 "2026-04-24T13:36:45Z")

</div>

> [@dgobbi](#):
>
> `vtkmodules. __version__ `

Sorry. This is completely my fault. I was back on 9.4.1 somehow.
