# vtkSelectPolyData - vtkClipPolyData

**URL:** https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315
**Category:** Support
**Created:** [May 15, 2020, 12:43pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315 "2020-05-15T12:43:51Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![hannah](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@hannah](https://discourse.vtk.org/u/hannah)
#### Post date: [May 15, 2020, 12:43pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/1 "2020-05-15T12:43:51Z")

</div>

Hello.  
I am using vtkSelectPolyData and vtkClipPolyData for filling (colour) intersection area, but I am getting an error: “vtkSelectPolyData (0x8920590): Can’t follow edge”, and at the end it could not color the area.  
How can I solve this issue? Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 16, 2020, 9:07pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/2 "2020-05-16T21:07:56Z")

</div>

Hi, Hannah,

Make sure your poly data are well connected. A visually connected structure doesn’t necessarily mean an actually connected one for the algorithm to work. I mean you can have duplicate vertexes, a polyline that is actually a series of two-vertex lines, and so on.  
This class may be used to preprocess your poly data so you can have topology issues fixed: [https://vtk.org/doc/nightly/html/classvtkCleanPolyData.html](https://vtk.org/doc/nightly/html/classvtkCleanPolyData.html) .

kind regards,

Paulo

---

<div class="post-metadata">

### Author: ![hannah](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@hannah](https://discourse.vtk.org/u/hannah)
#### Post date: [May 19, 2020, 1:14pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/3 "2020-05-19T13:14:49Z")

</div>

Hi Paulo,

Thank you for your reply.  
Actually I am using “vtkCleanPolyData” filter before doing any calculation for finding the intersection. However, still have the same issue. I attached the picture of the problem I am trying to solve. the yellow area is the intersection between the polydata and a cube, but I cannot colour the area with clipping, due to the error I got.

 ![intersection](https://discourse.vtk.org/uploads/default/original/2X/a/a1502c2a5c97b339c69957493db6bddb16fcd0b6.png)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 21, 2020, 11:12am UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/4 "2020-05-21T11:12:46Z")

</div>

Hmmm… what options did you enable for cleansing the mesh?

---

<div class="post-metadata">

### Author: ![hannah](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@hannah](https://discourse.vtk.org/u/hannah)
#### Post date: [May 21, 2020, 1:23pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/5 "2020-05-21T13:23:48Z")

</div>

Please find part of my code I am trying to use:

```
cleanedPolydata = vtk.vtkCleanPolyData()
cleanedPolydata.SetInputData(BonePolyData)
cleanedPolydata.Update()

```

Also, I tried to use cleanPolyDataFilter in the intersected area but still got the same issue.  
I guess the problem I have is because of the bone shape, as you could see the intersected are is not on the smooth part of the bone (jagged edge of the bone).

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 28, 2020, 9:28pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/6 "2020-05-28T21:28:11Z")

</div>

Hi, Hannah,

It seems to me that you didn’t enable any options.

I suggest taking a look at the numerous options `vtkCleanPolyData` has: [https://vtk.org/doc/nightly/html/classvtkCleanPolyData.html](https://vtk.org/doc/nightly/html/classvtkCleanPolyData.html) .

regards,

Paulo

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 8, 2022, 8:15pm UTC](https://discourse.vtk.org/t/vtkselectpolydata-vtkclippolydata/3315/7 "2022-03-08T20:15:29Z")

</div>

vtkSelectPolyData filter’s “Can’t follow edge” bug (and a few others) are fixed now. For more information see [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/8964](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8964)
