 What is best way to get the highest point (z-axis) in a polydata?

Is it possible to get the highest point (z-axis) in a polydata.
The GetBound() function in vtkActor is not usefull because it only give the boundary

You mean you want to get the xyz coordinate values of the highest point? I’m afraid you’ll have to iterate over the points to figure that out, but it shouldn’t be hard. Use vtkPolyData::GetPoints() to get the vtkPoints object, then you can iterate over it with:

vtkPoints* points = polydata->GetPoints();
for (vtkIdType i = 0; i < points->GetNumberOfPoints(); ++i)
{
double pt;
points->GetPoint(i, pt);
double z= pt;

// check if z is max, store pt if it is
}

Thanx, it isn’t hard indeed, however it can be inefficient / time consuming Such loop is very fast in C++ (probably takes a few milliseconds on a not too large mesh). In Python, you cannot iterate through mesh points (it would be way too slow), but you can get point coordinates as a numpy array and find the maximum using a single function call.

If you’re looking for an easy way to do this in Python with VTK, check out PyVista which makes using VTK a bit more Pythonic. For example, here I load an existing vtkPolyData object of a large point cloud (3392091 points) and find the vertex with the highest Z value in like no time at all:

import pyvista as pv
from pyvista import examples

# This is vtkPolyData

idx = np.argmax(poly.points[:,2])
print(idx)

And just to prove it found the right one:

p = pv.Plotter()