Point3dList.Z Returns Extra Trailing Zeros

Hi McNeel Devs,

I was getting all the Z values from a Polyline today using the Polyline.Z property and noticed some odd behaviour: I might simply be misunderstanding what it is supposed to return or how to implement it, but it occasionally returns more values (all zero) than there are points. In this example, one point works as expected while the other return two or three additional Z values:


210505_Point3dList_ZAccess_HowToImplement_00.gh (7.1 KB)

Best,

Anders

Hey @AndersDeleuran,

It might be more efficient to use Linq.

test_decompose_points.gh (5.2 KB)

– Dale

Cheers @dale, would one need to use Linq in IronPython as well to implement this property? I ended up using a Python list comprehension as a workaround, but was just wondering if the behaviour I’m seeing with the GHPython implementation I posted is expected (i.e. or a bug)?

Hi @AndersDeleuran,

Using list comprehension is probably the way to go in Python.

Here is the proper syntax when using a Point3dList:

import Rhino as rc

# Make polyline
points = rc.Collections.Point3dList(Pts)

# Get Z values
for z in range(0, points.Count):
    print points.Z[z]

– Dale

Cheers Dale. For future reference, here’s what I went with:

minZ = min(pt.Z for pt in Pts)

That said, I’m still puzzled by the (seemingly random) occurrence of trailing zeros when calling the Point3dList.Z property :man_shrugging: