# vtkStripper does not join contiguous segments

**URL:** https://discourse.vtk.org/t/vtkstripper-does-not-join-contiguous-segments/4552
**Category:** Support
**Created:** [November 3, 2020, 11:53am UTC](https://discourse.vtk.org/t/vtkstripper-does-not-join-contiguous-segments/4552 "2020-11-03T11:53:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 3, 2020, 11:53am UTC](https://discourse.vtk.org/t/vtkstripper-does-not-join-contiguous-segments/4552/1 "2020-11-03T11:53:59Z")

</div>

Not to confuse with [this](https://discourse.vtk.org/t/vtkstripper-not-joining-contiguous-lines-to-form-a-single-vtkpolyline/2402) (This is not an issue of duplicate points.)

vtkStripper does not join contiguous segments when more than 2 polylines are chained.  
Most of the polylines can be joined, but they’re not.  
_Reality_:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e538443ab4f9e48c685adfb20a110b9b19b38c36.png)  
_Expectation_:  
`Cell8`—\>`Cell6`—\>`Cell 4`—\>`Cell 2`—\>`Cell 0`  
`Cell7`—\>`Cell5`—\>`Cell3`—\>`Cell1`  
`Cell 9`  
`Cell 10`

```auto
    pdi = self.GetInputDataObject(0, 0)
    pdo = self.GetOutputDataObject(0)
    stripIt = vtk.vtkStripper()
    stripIt.SetMaximumLength(vtk.VTK_INT_MAX)
    stripIt.JoinContiguousSegmentsOn();
    stripIt.SetInputData(pdi)
    stripIt.Update()
    pdo.ShallowCopy(stripIt.GetOutput())

```

In the attached state file, see vtkConnectivity filter’s output which has 4 regions, but a programmable filter with that script has 11 polylines in the output instead of 4.

[stripperIssue.zip](https://discourse.vtk.org/uploads/short-url/t4w5OYX8Kq8VlQgS0LTo40Mssj7.zip) (57.3 KB)

Edit: Expected output

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 4, 2020, 11:17am UTC](https://discourse.vtk.org/t/vtkstripper-does-not-join-contiguous-segments/4552/2 "2020-11-04T11:17:18Z")

</div>

[MR](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7387) that fixes this bug.
