code: def cap(self, returnCap=False):
          
          poly = self.polydata(True)
  
          fe = vtk.vtkFeatureEdges()
          fe.SetInputData(poly)
          fe.BoundaryEdgesOn()
          fe.FeatureEdgesOff()
          fe.NonManifoldEdgesOff()
          fe.ManifoldEdgesOff()
          fe.Update()
  
          stripper = vtk.vtkStripper()
          stripper.SetInputData(fe.GetOutput())
          stripper.Update()
  
          boundaryPoly = vtk.vtkPolyData()
          boundaryPoly.SetPoints(stripper.GetOutput().GetPoints())
          boundaryPoly.SetPolys(stripper.GetOutput().GetLines())
  
          tf = vtk.vtkTriangleFilter()
          tf.SetInputData(boundaryPoly)
          tf.Update()
  
          if returnCap:
              return Actor(tf.GetOutput())
          else:
              polyapp = vtk.vtkAppendPolyData()
              polyapp.AddInputData(poly)
              polyapp.AddInputData(tf.GetOutput())
              polyapp.Update()
              return self.updateMesh(polyapp.GetOutput()).clean()
docs: Generate a "cap" on a clipped actor, or caps sharp edges.
  
          .. hint:: |cutAndCap| |cutAndCap.py|_