# Is GetConnectivityArray missing from vtkCellArray class in Python package?

**URL:** <https://discourse.vtk.org/t/is-getconnectivityarray-missing-from-vtkcellarray-class-in-python-package/2250>\
**Category:** Development\
**Created:** [December 10, 2019, 5:03pm UTC](https://discourse.vtk.org/t/is-getconnectivityarray-missing-from-vtkcellarray-class-in-python-package/2250 "2019-12-10T17:03:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcs](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@pcs](https://discourse.vtk.org/u/pcs)\
**Post date:** [December 10, 2019, 5:03pm UTC](https://discourse.vtk.org/t/is-getconnectivityarray-missing-from-vtkcellarray-class-in-python-package/2250/1 "2019-12-10T17:03:30Z")

</div>

I have an XML unstructured grid with polyhedral elements and would like to read it using Python for post-processing analysis of a simulation. I am using Python 3.7.4 and vtk 8.1.2.

I can read the file with `vtkXMLUnstructuredGridReader` and successfully read some arrays from `CellData` and `Points`. But, when I try to use the function `GetConnectivityArray` from `vtkCellArray` class, it seems that it’s missing from the vtk Python package:

```
import vtk 
import numpy

# open *.vtu file
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName("cells_0.0000.vtu")
reader.Update()
output = reader.GetOutput()

cellEnergy = output.GetCellData().GetArray("cellEnergy")
points = output.GetPoints().GetData()
vtkCells = output.GetCells()
cellConn = output.GetCells().GetConnectivityArray()                                                                                                          

```

Output

```
AttributeError: 'vtkCommonDataModelPython.vtkCellArray' object has no attribute 'GetConnectivityArray'

```

I tried to see if I could find it where vtk is installed with `grep` below, but it didn’t output anything.

```
grep -rnwi . -e 'GetConnectivityArray'

```

Is the function really missing? Or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![allison.vacanti](https://discourse.vtk.org/user_avatar/discourse.vtk.org/allison.vacanti/32/679_2.png) [@allison.vacanti](https://discourse.vtk.org/u/allison.vacanti)\
**Post date:** [December 11, 2019, 10:55pm UTC](https://discourse.vtk.org/t/is-getconnectivityarray-missing-from-vtkcellarray-class-in-python-package/2250/2 "2019-12-11T22:55:40Z")

</div>

`vtkCellArray` underwent a major refactor recently, and the `GetConnectivityArray` method was added after 8.1.2. It is currently available in the development branch and will be in the next release.

If you need to support v8.1.2, see the discussion about the older legacy API [here](https://vtk.org/doc/nightly/html/classvtkCellArray.html#details).

---

<div class="post-metadata">

**Author:** ![pcs](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@pcs](https://discourse.vtk.org/u/pcs)\
**Post date:** [December 12, 2019, 2:50pm UTC](https://discourse.vtk.org/t/is-getconnectivityarray-missing-from-vtkcellarray-class-in-python-package/2250/3 "2019-12-12T14:50:25Z")

</div>

Thank you for clarifying that `GetConnectivityArray` is not in 8.1.2 release version.

A solution to this problem was found by using PyVista: [https://github.com/pyvista/pyvista-support/issues/82](https://github.com/pyvista/pyvista-support/issues/82)
