Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5896

Connecting Curves to Random Points Loop

$
0
0

@bseckler wrote:

Hey, so I’m very much a beginner when it comes to python scripting, and I’m trying to create a loop for a grid of points where I can created curves that will be randomly generated between these points. I got the grid to work, but I’m currently testing with just lines and I can’t seem to get the lines to connect to these points randomly, here’s the current script:

import rhinoscriptsyntax as rs
import random

xvalues = range(40)
yvalues = range(5,30,1)
points =
for i in xvalues:
for j in yvalues:
point = rs.AddPoint(i,j,0)
points.append(point)

newPointsx =
for i in range(20):
newPointx = random.choice(points)
newPointsx.append(newPointx)
newPointsy =
for j in range(20):
newPointy = random.choice(points)
newPointsy.append(newPointy)

rs.AddLine(newPointsx,newPointsy)

I could be writing this completely wrong, so any help and guidance would be appreciated.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5896

Trending Articles