Class Exercise – Kalil

2.19

import rhinoscriptsyntax as rs
import math as mt


mylist=range(10) #[0,1,2.....,9] start at 0, end at 9
print mylist
mylist = range (1,10)
print mylist
mylist = range (1,5) # 5 is the ending number excluding itself
print mylist
mylist = range(1,20,2) #starts at 1, ending at 20, increase with a step-2
print mylist
mylist = range(40,-1,-2)
print mylist
mylist = rs.frange(0,10,0.5)
print mylist
mylist= range(100)
print mylist
def makeInitialShape():
id=rs.GetObject()
return id
def ex1():
mylist=range(10) #[0,1,2.....,9] start at 0, end at 9
print mylist
mylist = range (1,10)
print mylist
mylist = range (1,5) # 5 is the ending number excluding itself
print mylist
mylist = range(1,20,2) #starts at 1, ending at 20, increase with a step-2
print mylist
mylist = range(40,-1,-2)
print mylist
mylist = rs.frange(0,10,0.5)
print mylist
mylist= range(100)
print mylist
def makeTriangles(item):
p0=0,0,0
p1=1,0,0
p2=0.5,1,0
points=p0,p1,p2,p0
rs.AddPolyline(points)
def makeTriangles2(item, id):
p0=0,0,0
p1=1,0,0
p2=0.5,1,0
points=p0,p1,p2,p0

origin=0,0,0
scale=item+.2,item+.2,1
id=rs.ScaleObject(id,origin,scale,True)
center=origin
rad=3
angle=item*mt.sin(rad)
id=rs.RotateObject(id,center,angle)
translation=item,item,0
id=rs.MoveObject(id,translation)
def ex2():
mylist=range(200)
id=makeInitialShape()
for item in mylist:
makeTriangles2(item, id)
def ex3():
pass
def ex4():
pass
def ex5():
pass
def main():
ex1()
ex2()
ex3()
ex4()
ex5()
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