Hi all,
I’m very new to Python in Rhino and have run into a bit of a snag for a script I’m trying to write. In the lines below, I establish a point matrix based on user input via rs.GetInteger, save those to a list (ptList_1) and then try to create a series of individual curves from rows of x or y points so that I can loft a surface from them. The way it is written now, I can get a curve extending through the entire list, but am not sure how to stop it at each new line so that they’re individual. Sorry if this is poorly explained, but any help would be greatly appreciated!
import rhinoscriptsyntax as rs
import random
# Empty lists
ptList_1 = []
ptList_2 = []
# For curves to loft surface
crvList_1 = []
# For first set of circles
crvList_2 = []
# For second set of circles
crvList_3 = []
# Point dictionary for first matrix set
ptDict_1 = {}
# Point dictionary for second matrix set (moved points)
ptDict_2 = {}
# i, j and k values
imax = rs.GetInteger('Choose an x value', 10)
jmax = rs.GetInteger('Choose a y value', 10)
kmax = rs.GetInteger('Choose a z value', 2)
attPt_1 = rs.AddPoint(random.randrange(1,(imax*5)), random.randrange(1,(jmax*5)), random.randrange(1,30))
#attPt_2 = rs.AddPoint((random.randrange(1,15)*(imax/4)),(random.randrange(1,15)*(imax/4)),(random.randrange(1,15)*(imax/4)))
# Values for first point matrix loop
for i in range(imax):
for j in range(jmax):
x = i * 5
y = j * 5
point = (x,y,0)
# Save points to dictionary for line construction
ptDict_1[(i,j)] = point
ptList_1.append(rs.AddPoint(point))
#print ptList_1
for i in range(imax*jmax):
distance = rs.Distance(ptList_1[i], attPt_1)
move_1 = distance/2
#print move_1
ptList_2.append(rs.MoveObject(ptList_1[i], (0,0,move_1)))
for j in range(jmax):
crvList_1.append(rs.AddCurve((ptList_1), 2))