code: def cutWithMesh(self, mesh, invert=False):
          
          if isinstance(mesh, vtk.vtkPolyData):
              polymesh = mesh
          if isinstance(mesh, Actor):
              polymesh = mesh.polydata()
          else:
              polymesh = mesh.GetMapper().GetInput()
          poly = self.polydata()
  
          # Create an array to hold distance information
          signedDistances = vtk.vtkFloatArray()
          signedDistances.SetNumberOfComponents(1)
          signedDistances.SetName("SignedDistances")
  
          # implicit function that will be used to slice the mesh
          ippd = vtk.vtkImplicitPolyDataDistance()
          ippd.SetInput(polymesh)
  
          # Evaluate the signed distance function at all of the grid points
          for pointId in range(poly.GetNumberOfPoints()):
              p = poly.GetPoint(pointId)
              signedDistance = ippd.EvaluateFunction(p)
              signedDistances.InsertNextValue(signedDistance)
  
          # add the SignedDistances to the grid
          poly.GetPointData().SetScalars(signedDistances)
  
          # use vtkClipDataSet to slice the grid with the polydata
          clipper = vtk.vtkClipPolyData()
          clipper.SetInputData(poly)
          if invert:
              clipper.InsideOutOff()
          else:
              clipper.InsideOutOn()
          clipper.SetValue(0.0)
          clipper.Update()
          return self.updateMesh(clipper.GetOutput())
docs: Cut an ``Actor`` mesh with another ``vtkPolyData`` or ``Actor``.
  
          :param bool invert: if True return cut off part of actor.
  
          .. hint:: |cutWithMesh| |cutWithMesh.py|_
  
              |cutAndCap| |cutAndCap.py|_