import rhinoscriptsyntax as rs
import random
def ImportPoints():
sampling = 50
filename = rs.OpenFileName("Open File")
if not filename: return
file = open(filename, "r")
lines = file.readlines()
file.close()
image = []
for line in lines:
image.append(line.strip("/n").split(","))
for j in range(0,len(image),sampling):
for i in range(0, len(image[j]), 3*sampling):
red = int(float(image[j][i]))
green = int(float(image[j][i+1]))
blue = int(float(image[j][i+2]))
if red < 40 and green < 40 and blue < 100:
width = 6000
depth = 6000
height = 3000
p1 = [i/3,j,0]
p2 = rs.VectorAdd (p1, [width,0,0])
p3 = rs.VectorAdd (p2, [0,depth,0])
p4 = rs.VectorAdd (p3, [-width,0,0])
p5 = rs.VectorAdd (p1, [0,0,height])
p6 = rs.VectorAdd (p2, [0,0,height])
p7 = rs.VectorAdd (p3, [0,0,height])
p8 = rs.VectorAdd (p4, [0,0,height])
boxGarage = rs.AddBox ([p1, p2, p3, p4, p5, p6, p7, p8])
rs.ObjectColor(boxGarage, (red, green, blue))
for l in range(height):
rs.MoveObject(boxGarage, (0, 0, random.randint(0,l)))
I only want move the z-axis in random without move x,y axis. But (0,0,random.randint(0,l)) move my boxes in same x,y axis.How can I do that?