Melodie Week 10 – 1

 

attractor square.PNG

 

 

 

</pre>
<pre></pre>
import rhinoscriptsyntax as rs

class rectangularattractor():
def __init__(self):
self.rectangles()

def rectangles(self):
attractor = rs.GetPoint()
xlist = range(10)
ylist = range(10)
for x in xlist:
for y in ylist:
#calculate distance
pt1 = attractor
pt2 = x,y,0


distance = rs.Distance(pt1,pt2)
self.rectangle(x,y,distance)

def rectangle (self,x,y,distance):
plane = rs.WorldXYPlane()
height = distance/100
width = distance/150

rs.AddRectangle(plane,height, width)
def main():
rectangularattractor()

main()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s