# Access point and cell data of surface mesh

**URL:** https://discourse.slicer.org/t/access-point-and-cell-data-of-surface-mesh/2426
**Category:** Development
**Created:** [March 26, 2018, 2:59pm UTC](https://discourse.slicer.org/t/access-point-and-cell-data-of-surface-mesh/2426 "2018-03-26T14:59:31Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)
#### Post date: [March 26, 2018, 3:36pm UTC](https://discourse.slicer.org/t/access-point-and-cell-data-of-surface-mesh/2426/2 "2018-03-26T15:36:26Z")

</div>

The point set within a model’s poly data is accessible. The output of the vtkMarchingCubes algorithm is a vtkPolyData. I’m doing something similar. Here is how I loop over the point indices and get the position of each point via Python script:

```
modelNode = slicer.util.getNode(modelNodeID)
modelPolyData = modelNode.GetPolyData()
numPoints = modelPolyData.GetNumberOfPoints()
for ptId in range(numPoints):
    pointPos = [0,0,0]
    modelPolyData.GetPoint(ptId, pointPos)

```

GetPoint fills the three-element list with the position of the point corresponding to index ptId. You can then write these values to files.

---

_[View the full topic](https://discourse.slicer.org/t/access-point-and-cell-data-of-surface-mesh/2426)._
