Tuesday, April 24, 2012

Look I posted!


import rhinoscriptsyntax as rs
import random
from math import * 
###random.random() gives you a random float between 0 and 1

a = 5 

points = []

for i in range (0,20):
    x = pow(i,2)*sin(pi/2*i)
    y = a*cos(pi/2*i)
    z = pow(i,2)
    
    pt = rs.AddPoint([x,y,z])
    points.append(pt)
crv = rs.AddInterpCurve(points)

rotateCrvs = []
numCrv = 5
for i in range (0,numCrv):
    rotateCrv = rs.RotateObject(crv,[0,0,0],360/numCrv*i,None,True)
    rotateCrvs.append(rotateCrv)

divisions = 30
radius = .25


for j in range (0,len(rotateCrvs)):
    circL = []
    for i in range (0,divisions):###If you just put "i in range(20) it reads as 
    ###0 to 20
        param = 1/divisions*i
        
        eval = rs.CurveParameter(rotateCrvs[j],param)
        pointsCoord = rs.EvaluateCurve(rotateCrvs[j],eval)
    #    evalPt = rs.AddPoint(pointsCoord)
        frame = rs.CurvePerpFrame(rotateCrvs[j],eval)
        circ = rs.AddCircle(frame,radius+i)
        circL.append(circ)
    
    rs.AddLoftSrf(circL)

No comments:

Post a Comment