Intro to Python Scripting: 10 Random Numbers 02

Software: 
Tag: 
Video Duration: 
6 minutes
Author: 
Zach Downey

We continue to explore the Random number class by creating a list out of out points and then creating curves through them. This creates a lot of lines, so we change each line's color based on the type of line. 

#Random Numbers
#Random Lines
 
import rhinoscriptsyntax as rs
import random
 
pts = []
for i in range(0,100):
    x = random.uniform(0,100)
    y = random.uniform(0,100)
    z = random.uniform(0,100)
    pt = [x,y,z]
 
    pts.append(pt)
 
pl = rs.AddPolyline(pts)
crv = rs.AddCurve(pts)
intpcrv = rs.AddInterpCurve(pts)
 
color01 = [0,255,255]
color02 = [255,0,255]
color03 = [255,255,0]
 
rs.ObjectColor(pl, color01)
rs.ObjectColor(crv, color02)
rs.ObjectColor(intpcrv, color03)

Rating

Please rate this tutorial below. Thanks.

5
Average: 4.9 (10 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.

:)