Intro to Python Scripting: 04 Lists and Curve Types

Video Duration: 
15 minutes
Zach Downey

This tutorial covers a few Curve creation methods that use a list of points as input. First we ask the user to pick points, then we use those points to create a polyline, nurbs curve, and interpreted curve. We then use the ObjectColor method to change the colors of the curves we just created. Finally, we introduce a simple for loop (equivalent to a C# foreach loop) to iterate over our list of points and add them to the document. We will cover loops in more depth soon.

#Lists of Points + Curve Types
#Bonus simple for loop
import rhinoscriptsyntax as rs
listPoints = []
listPoints = rs.GetPoints(True,True,"Pick a starting point", "Keep picking points until you get tired")
#Curve Types
myPolyline = rs.AddPolyline(listPoints)
myCurve = rs.AddCurve(listPoints)
myIntpCurve = rs.AddInterpCurve(listPoints)
#Curve Colors
#Colors are Arrays of [r,g,b]
color01 = [0,255,255] #cyan
color02 = [255,0,255] #magenta
color03 = [255,255,0] #yellow
#Change Color of Curves
rs.ObjectColor(myPolyline, color01)
rs.ObjectColor(myCurve, color02)
rs.ObjectColor(myIntpCurve, color03)
#Bonus For Loop
for point in listPoints:


Please rate this tutorial below. Thanks.

Average: 5 (9 votes)

Want to Contribute?

Want to be an author? Drop us a line here we'd love to have you.

Already have a video you'd like to post? Send us a link and we'll get you going.