Two Dimensional Growth

Start to generate growth based on a two-dimensional grid system. The program generates the grid by drawing lines recursively in x, y directions, and draw cubes based on the grid through customizing the pattern.



import rhinoscriptsyntax as rs
import math as m

#erase the objects
rs.Command("SelAll delete")

#draw a grid
x=0
y=51
for i in range(x,y):
rs.AddPolyline(([x,i,x],[y-1,i,x]))
rs.AddPolyline(([i,x,x],[i,y-1,x]))

#defining space between cubes
cubeSpace=rs.GetInteger("Please insert cube space: ", 4.0)
if cubeSpace % 2 == 0:
print "even"
a=cubeSpace+3
print (a)
else:
print "odd"
a=cubeSpace+2
print (a)

#introducing basic grid cube based on input spacing
for i in range (x,y-1,cubeSpace+1):
for j in range (x,y-1,cubeSpace+1):
rs.AddPlaneSurface([i,j,0], 1.0, 1.0)

#introducing pattern with randomization
for i in range (x,y-1,int (a)):
for j in range (x,y-1,int(a)):
rs.AddPlaneSurface([i,j,0], 1.0, 1.0)

One thought on “Two Dimensional Growth”

Leave a Reply

Your email address will not be published. Required fields are marked *