It is possible to slice and clip a volume with a surface by using a Phyton Programmable Filter.
This relies on the vtkImplicitPolyDataDistance, so the result is an approximation, not an actual boolean operation.
Steps for clip:
- Open a volume, apply
- Open a surface, apply
- In the pipeline browser, click on the volume, then press Ctrl, then click on the surface
- Add a Programmable Filter
- Set the output type to vtkUnstructuredGrid
- Set the script to
import paraview.modules.vtkPVVTKExtensionsFiltersGeneral as ext
inpMain = self.GetInputDataObject( 0, 0 )
inp = self.GetInputDataObject( 0, 1 )
out = self.GetOutput()
clipper = ext.vtkPVMetaClipDataSet()
clipper.SetInputDataObject(inpMain)
clipper.SetInsideOut(True)
function = vtk.vtkImplicitPolyDataDistance()
function.SetInput(inp)
clipper.SetDataSetClipFunction(function)
clipper.Update()
outData = clipper.GetOutputDataObject(0)
out.DeepCopy(outData)
- Press Apply
Steps for slice:
- Open a volume, apply
- Open a surface, apply
- In the pipeline browser, click on the volume, then press Ctrl, then click on the surface
- Add a Programmable Filter
- Set the output type to vtkPolyData
- Set the script to
import paraview.modules.vtkPVVTKExtensionsFiltersGeneral as ext
inpMain = self.GetInputDataObject( 0, 0 )
inp = self.GetInputDataObject( 0, 1 )
out = self.GetOutput()
slicer = ext.vtkPVMetaSliceDataSet()
slicer.SetInputDataObject(inpMain)
function = vtk.vtkImplicitPolyDataDistance()
function.SetInput(inp)
slicer.SetDataSetCutFunction(function)
slicer.Update()
outData = slicer.GetOutputDataObject(0)
out.DeepCopy(outData)
- Press Apply
There is an issue to add that in ParaView proper: https://gitlab.kitware.com/paraview/paraview/-/issues/18138