Get points Z coordinate from Python

Hello, can anyone help me to solve this code?

I want to get the X coordinate of the points with some Python code but I get lost.
Python gives an error, and I don’t know how to solve it.

Thanks in advance :wink:

The error is because you are asking a list for its Z coordinate, rather than an individual point. One method is to loop over the list of points and query their individual Z positions and appending that to the out list:

import clr
from Autodesk.DesignScript.Geometry import *

points = IN[0]

out = []
for point in points:

OUT = out

or, in one line

OUT = [point.Z for point in IN[0]]

1 Like

Thank you very much!

1 Like