List of Points in Python

This guide provides an overview of a rhinoscriptsyntax list of Point Geometry in Python.

Lists of Points

Many rhinoscriptsyntax methods either require as an argument or return as a result an list of 3-D points. Lists of 3-D points are zero-based, one-dimensional lists of 3-D points (which in turn are zero-based, one-dimensional lists of X, Y, and Z coordinate values). Lists of 3-D points can be constructed in a number of ways. For example,

pointcloud = []
pointcloud.append([1.0, 2.0, 3.0])
pointcloud.append([5.0, 8.0, 9.0])
pointcloud.append([4.0, 7.0, 2.0])
pointcloud.append([8.0, 5.0, 6.0])

print pointcloud

Also, representing list of 3-D points as a one-dimensional array instead of a multi-dimensional list, makes it easy to repeat a group of statements for each element in the array . For example along with the example above, use the for loop to walk through each point in the list,

for i in pointcloud:
    print i