Clip interpolated points with stl

Hi,

I’m a new Paraview user and am completely stuck on how to perform the following: I have generated interpolated points for a volume of which I would like to create an isosurface for a specific value. The interpolated points are, however, generated for the full volume, while the original data points do not contain points within the stl’s visible in the attached image. If I do not remove these “extra” internal points from the interpolated point cloud, the generated contour or isosurface extends into the stls - which is incorrect. I thought “Find data” would help, but there was no option to use geometrical data to clip the interpolated point cloud. I then looked at programmable filters and it looks like “vtkImplicitPolyDataDistance” might be the method I’m looking for, but I couldn’t wrap my head around how to use it with the programmable filter. I already had a look at https://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitDataSetClipping and https://www.paraview.org/Wiki/VTK/Examples/Python/Meshes/vtkClipDataSetWithPolydata. Just to clarify: I’d like to only use the points OUTSIDE the stl geometry to generate an isosurface or contour for a selected value. Any help is greatly appreciated

Hello,

I hope the following link is helpful to compute the signed distance field from STL to points in the Programmable filter.

Hey Kyoshimi, thank you for the help - I managed to get it working, although it isn’t perfect. I have to use a scalar clip to generate a contour after using the programmable filter. The below did it, if I first ctrl selected the data set and then the stl:

mesh = self.GetInputDataObject(0, 0)

import paraview.vtk as vtk

pdd = vtk.vtkImplicitPolyDataDistance()
pdd.SetInput(mesh)

dataset = self.GetInputDataObject(0, 1)

output.CopyAttributes(dataset)
numPts = dataset.GetNumberOfPoints()
distArray = vtk.vtkDoubleArray()
distArray.SetName(“Distance”)
distArray.SetNumberOfComponents(1)
distArray.SetNumberOfTuples(numPts)

for i in range(numPts):
pt = dataset.GetPoint(i)
print(pt)
distArray.SetValue(i, pdd.EvaluateFunction(pt))

output.GetPointData().AddArray(distArray)