# vtkImplicitSelectionLoop does not work as expected

**URL:** https://discourse.vtk.org/t/vtkimplicitselectionloop-does-not-work-as-expected/3342
**Category:** Support
**Created:** [May 19, 2020, 5:06pm UTC](https://discourse.vtk.org/t/vtkimplicitselectionloop-does-not-work-as-expected/3342 "2020-05-19T17:06:49Z")
**Posts on this page:** 1
**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: [May 19, 2020, 5:06pm UTC](https://discourse.vtk.org/t/vtkimplicitselectionloop-does-not-work-as-expected/3342/1 "2020-05-19T17:06:49Z")

</div>

I implemented a function that clips a polydata from another polydata. The clip operation is fine for polys that don’t have sharp corners, but it gives weird results for those with sharp corners. How do I get about this?  
def clip(pd1: vtk.vtkPolyData, pd2: vtk.vtkPolyData, inside\_out=False) -\> vtk.vtkPolyData:  
“”"  
Clips out regions of pd1 from pd2. The result is a difference pd1 - pd2  
Set inside\_out = True; if the end result is required to be an intersection of pd1, pd2  
:param pd1: a polydata object. This is the one you want to clip.  
:type pd1: vtk.vtkPolyData  
:param pd2: a polydata object. This is the one you want to use to clip pd1.  
:type pd2: vtk.vtkPolyData  
:return: a clipped polydata pd1 - pd2 or pd1 \cap pd2  
:rtype: None  
“”"  
inout = vtk.vtkImplicitSelectionLoop()  
inout.SetLoop(pd2.GetPoints())  
clip = vtk.vtkClipPolyData()  
clip.SetInsideOut(inside\_out)  
clip.SetClipFunction(inout)  
clip.SetInputData(pd1)  
clip.Update()  
return clip.GetOutput()

![t-polygon](https://discourse.vtk.org/uploads/default/original/2X/c/c7ec468808afa5186a64c916799d5640467c6180.png)

 ![polydata_clipped](https://discourse.vtk.org/uploads/default/original/2X/a/a8fffc8339430702367c6f8ab6456c86fd815855.png)  
 ![point-rep](https://discourse.vtk.org/uploads/default/original/2X/6/6bbf129b32526e56f418dcca12fe88935208597f.png)
