workshop01G5:Codefarm
From CECO
cell generation
import rhinoscriptsyntax as rs
import random
import scriptcontext
def generation(x,strPt):
#have a line so i can use "escape" key scriptcontext.escape_test() if x==0: return else: for i in range (0,100): #define the direction the starting point will grow point=[(0,1,0),(1,0,0),(-1,0,0),(0,-1,0)] rnd=random.choice(point) vec=rs.VectorCreate(rnd,(0,0,0)) strPt=rs.PointAdd(strPt,vec) strPts.append(strPt) #form a volume based on the point rs.AddCircle(strPt,0.5) print rs.AddPoint(strPt)
strPts=[]
strPt1=rs.AddPoint((0,0,0))
vec1=rs.VectorCreate((1,0,0),(0,0,0))
strPt=rs.PointAdd(strPt1,vec1)
generation(3,strPt)
print strPts[3]