Extracting x coordinates from a list of points, through Python script

Hi! I’m new here. I am trying to get x coordinates from a list of points, using Python script, but it’s not working. I know that’s a simple problem, but I can’t identify the error.

The code:

"
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

pts = IN[0]

coordx =

for xyz in pts
coordx.append (xyz.X)

OUT = coordx;
";

Thanks in advance.

Hi @Olivia

pts = IN[0]

OUT = map(lambda p: [p.X, p.Y, p.Z, p], pts)
1 Like

You rocked @Kulkul :slight_smile: