# Beginners question regarding vtkPointDataToCellData

**URL:** https://discourse.vtk.org/t/beginners-question-regarding-vtkpointdatatocelldata/3889
**Category:** Support
**Created:** [July 31, 2020, 7:14am UTC](https://discourse.vtk.org/t/beginners-question-regarding-vtkpointdatatocelldata/3889 "2020-07-31T07:14:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![uwsan](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/u/90db22/32.png) [@uwsan](https://discourse.vtk.org/u/uwsan)
#### Post date: [July 31, 2020, 7:14am UTC](https://discourse.vtk.org/t/beginners-question-regarding-vtkpointdatatocelldata/3889/1 "2020-07-31T07:14:04Z")

</div>

Hello, everyone,

for me the topic VTK is very new, so I hope that the question is not too stupid.

I’m trying to create a simple program that allows me to select a contiguous area on an STL. For this I want to use the vtkPolyDataConnectivityFilter, and simply select all areas with the same RegionId.

Using a CellPicker I get the CellId, that all works too. Now I would like to have the RegionIds as CellData. In Paraview it works. In my example code (vtk 9.0.1, python 3.7) I only get the normals as CellData. What am I doing wrong?

```
stl_reader = vtkSTLReader()
stl_reader.SetFileName(stl_file)
stl_reader.Update()
normals = vtkPolyDataNormals()
normals.SetInputConnection(stl_reader.GetOutputPort())
normals.SplittingOn()
normals.Update()
connectivity = vtkPolyDataConnectivityFilter()
connectivity.SetInputConnection(normals.GetOutputPort())
connectivity.SetExtractionModeToAllRegions()
connectivity.ColorRegionsOn()
connectivity.Update()
print(connectivity.GetOutput().GetPointData().GetNumberOfArrays())
    # ==> 2, Normals & RegionId
print(connectivity.GetOutput().GetCellData().GetNumberOfArrays())
    # ==> 0
point_to_cell = vtkPointDataToCellData()
point_to_cell.SetInputConnection(connectivity.GetOutputPort())
point_to_cell.ProcessAllArraysOn()
point_to_cell.PassPointDataOff()
point_to_cell.Update()
print(point_to_cell.GetOutput().GetPointData().GetNumberOfArrays())
    # ==> 0
print(point_to_cell.GetOutput().GetCellData().GetNumberOfArrays())
    # ==> 1, Normals
print(point_to_cell.GetOutput().GetCellData().GetArray(0).GetName())
```

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.vtk.org/u/Kenichiro-Yoshimi)
#### Post date: [July 31, 2020, 8:24am UTC](https://discourse.vtk.org/t/beginners-question-regarding-vtkpointdatatocelldata/3889/2 "2020-07-31T08:24:03Z")

</div>

Hi,

Could you try to use a vtkConnectivityFilter instead of vtkPolyDataConnectivityFilter? This will generate the RegionIds array in both PointData and CellData.

---

<div class="post-metadata">

### Author: ![uwsan](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/u/90db22/32.png) [@uwsan](https://discourse.vtk.org/u/uwsan)
#### Post date: [July 31, 2020, 9:25am UTC](https://discourse.vtk.org/t/beginners-question-regarding-vtkpointdatatocelldata/3889/3 "2020-07-31T09:25:36Z")

</div>

Hi,

Thanks a lot! Works like a charm!
