# scotttd/RhinoScriptSamples

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (35 sloc) 1.53 KB
 ﻿''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' ArchimedeanSpiral.rvb -- June 2008 ' If this code works, it was written by Dale Fugier. ' If not, I don't know who wrote it. ' Works with Rhino 4.0. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Creates an archimedean spiral. ' Change 'a_const' to turn the spiral. ' Change 'b_const' to control the distance between turnings. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub ArchimedeanSpiral() Dim a_const, b_const, step_angle, num_points Dim curr_angle, base_point, radius, points(), i Rhino.Print "Archimedean Spiral: 'Radius = A + B * Theta'" a_const = Rhino.GetReal("Value of 'A' constant", 1.0, 0.01) If IsNull(a_const) Then Exit Sub b_const = Rhino.GetReal("Value of 'B' constant", 1.0, 0.01) If IsNull(a_const) Then Exit Sub num_points = Rhino.GetInteger("Number of points to calculate", 10, 2) If IsNull(num_points) Then Exit Sub step_angle = Rhino.GetReal("Angle between points", 30.0, 1.0, 45.0) If IsNull(step_angle) Then Exit Sub curr_angle = 0.0 base_point = Array(0.0, 0.0, 0.0) ReDim points(num_points - 1) For i = 0 To UBound(points) radius = a_const + (b_const * curr_angle) points(i) = Rhino.Polar(base_point, radius, curr_angle) curr_angle = curr_angle + step_angle Next Rhino.AddInterpCurve points 'Rhino.AddPoints points End Sub