Polyline in python

That all looks a bit odd. For instance assigning to a tuple like that. It helps tremendously to provide a full minimal working example when asking coding questions (also formatting the code helps). Anywho, here’s two different minimal examples using RhinoCommon:

A) Making the polyline vertices first, then the polyline:

import Rhino as rc

# Make vertices
vts = []
for i in range(10):
    pt = rc.Geometry.Point3d(i,i,i)
    vts.append(pt)

# Make polyline
pl = rc.Geometry.Polyline(vts)

B) Making the polyline directly within a loop:

import Rhino as rc

# Make polyline
pl = rc.Geometry.Polyline()
for i in range(10):
    pt = rc.Geometry.Point3d(i,i,i)
    pl.Add(pt)
5 Likes