YIN XU – JAN 30-31

import rhinoscriptsyntax as rs
# Author: Yin Xu
# Date: Jan 31, 2016
# Purpose: snow code

def lsnow1(line):
points = rs.DivideCurve(line,3,False,True)
point3=rs.AddPoint(points[2])
ptm=rs.RotateObject(point3,points[1],-60.0,None,copy=True)
points.insert(2,ptm)
pl=rs.AddPolyline(points)
rs.DeleteObjects([line,point3,ptm])
linesID=rs.ExplodeCurves(pl,True)
return linesID

def lsnows(lines):
list=[]
for x in lines:
for y in lsnow1(x):
list.append(y)
return list

def lsnow(line,num):
if num==0:
return line
elif num==1:
return lsnow1(line)
else:
return lsnows(lsnow(line,num-1))

line = rs.GetObject("Select a line:")
degree=rs.GetInteger("Degree(Integer)=?,better <5")
if line and degree:
lsnow(line,degree)

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