'Guid' object has no attribute 'Z'

Hi all.

I’m very new to scripting in Grasshopper, and am hoping someone could give me a quick solution to why this isn’t working. I have a list of points, and am trying to write a python script to select the point with the highest Z value. I’ve added the script in the uploads:

import Rhino.Geometry as rg

# #Input points
points = [x] 

# Initialize variables
max_z = None
max_z_point = None

# Find point with the greatest Z value
for point in points:
    if max_z is None or point.Z > max_z:
        max_z = point.Z
        max_z_point = point

# Output the point with the greatest Z value
a = max_z_point



I’m getting an error: '1. Solution exception:‘Guid’ object has no attribute ‘Z’

How can an object not have an attribute Z?

Thanks in advance.

You probably want to right click on the x input of the component and set the ‘type hint’ to ‘Point3D’.

Thanks a lot for the response. Although that did get rid of the compiling error, my script doesn’t provide me with a final output point, and I’m not sure why or where I’m going wrong. Any suggestions.

Thanks again.

Is input x set to list access? Then remove the brackets around x or simply remove the first line and rename x to points.

Maybe something like this?

MaxPtZ.gh (7.0 KB)

(set x to list access and type hint to Point3d)

Thank you so much, that works perfectly.

I have a lot to learn. Cheers.