Wednesday, April 25, 2012

CURVY SCRIPT






###SCRIPT ABOUT CURVES###

import rhinoscriptsyntax as rs

from math import*
from System.Drawing import Color

Rad = 8
Turn = 0.1

Pts = []

for i in range(0,360,5):
    x=Rad*cos(i)
    y=Rad*sin(i)
    z=Turn*i
    Pt = rs.AddPoint(x,y,z)
    Pts.append(Pt)

Curve = rs.AddCurve(Pts,5)

#add a spiral curve around the first one
DivPts = rs.DivideCurve(Curve,500,False,False)
Plns = []
NewPts = []
Circles = []
Val = 0

for i in DivPts:
    Pln = rs.CurvePerpFrame(Curve,i)
    Plns.append(Pln)
   
for j in Plns:
    Val = Val+60
    Circle = rs.AddCircle(j,1)
    NewLay = rs.AddLayer("circles",Color.Gray)
    CircleLay = rs.ObjectLayer(Circle,"circles")
    Center = rs.CircleCenterPoint(Circle)
    Rotate = rs.RotateObject(Circle,Center,Val,j[3])
    NewPt = rs.CurvePoints(Circle)
    NewPts.append(NewPt[0])
    Circles.append(Circle)
#rs.AddLoftSrf(Circles)


Curve02 = rs.AddCurve(NewPts,5)
NewLay01 = rs.AddLayer("Curves",Color.DarkTurquoise)
Curve02Lay = rs.ObjectLayer(Curve02,"Curves")

#Curve02 = rs.AddInterpCurve(NewPts,3)

#change the curve hape trhough one or more attractors

No comments:

Post a Comment