Tuesday, October 7, 2008

Spiraling Inward: Script


Option Explicit
'Script written by Savannah Bridge
'Script version Monday, October 06, 2008 11:47:39 PM
Call Main()
Sub Main()
Rhino.EnableRedraw (False)
'Here we call the Sub Routine Spirals specifiying
'the minimum and maximum depth of the curves.

Spirals Null, 0, 3
Rhino.EnableRedraw (True)
End Sub

Sub Spirals(spiral, depth, maxdepth)

If depth = 0 Then
Rhino.Command "Spiral f 0,0,0 1 1,1,1 M=Pitch P=2 10"
'here we make sure the last created object has only one object,
'rather than an array.

spiral = Rhino.LastCreatedObjects ()(0)
End If

If depth < color="#ccccff">'divide the original spiral and add points
points = Rhino.DivideCurve (spiral,8,True)

Dim i
'This loop just scales the original spiral to 1/4 the
'size and creates a copy at all points.

For i = 0 To Ubound(points)
Dim newSpiral
newSpiral = Rhino.ScaleObject (spiral, points(i), Array(0.25, 0.
25, 0.0), True)
Spirals newSpiral, depth+1, maxDepth
Next
End If
End Sub

No comments: