(n)certainties – Columbia – Fall 2008

AN_Multiple Helix

Option Explicit

By Adolfo Nadal

Copyrighted by Archiologics

Call Main()
Sub Main()
 Dim i, n
 n = Rhino.GetInteger(“Nr of points”, 50,1,100)
 If IsNull (n) Then Exit Sub
 
 Dim D
 D = Rhino.GetInteger(“Diameter for curves”,2,1,5)
 
 Dim basePt : basePt = Rhino.GetPoint(“Base Point”,array(0,0,0))
 
 Dim k, h : h = Rhino.GetInteger(“Nr of Curves”, 4,1,360)
 Dim rad
 
 Dim Pt(), Pts()
 Dim arrPts (), arrPtss()
 Dim arrCrv()
 Dim PolyPt()
 Dim r
 Dim Poly
 
 Rhino.EnableRedraw(False)
 For k = 0 To h-1
  rad = k/h*2*PI
  
  For i = 0 To n-1
   
   ReDim Preserve arrPts(i)
   ’ReDim Preserve arrPtss(i)
   arrPts(i) = Rhino.AddPoint(array(D*sin(i+rad)+basePt(0),D*cos(i+rad)+basePt(1),i+basePt(2)))
   ’arrPtss(i) = Rhino.AddPoint(array(cos(i+rad),sin(i+rad),i))
  
   ReDim Preserve Pt(i)
   ’ReDim Preserve Pts(i)
   Pt(i) = Rhino.PointCoordinates(arrPts(i))
   ’Pts(i) = Rhino.PointCoordinates(arrPtss(i))
     
   If i>0 Then
    ReDim Preserve arrCrv(i)
    ’rrCrv(i-1) = Rhino.AddLine (Pt(i),Pt(i-1))
   End If
   
   If i=n Then
    Rhino.Print(“Point ” & (i) & “: ” & (sin(i)) & “, ” & (cos(i)) & “, ” & (i))   
   End If
  
  Next
  
  Poly = Rhino.AddInterpCurve (Pt)
  r = (Rhino.CurveLength(Poly)/2000)
  Rhino.SelectObject(Poly)
  ’Rhino.Command “Sellast enter Pipe pause 1 pause enter 1 enter enter”
  Rhino.Command “Pipe (r) enter (r) enter enter”
  Rhino.DeleteObjects(arrPts)
  Rhino.UnselectAllObjects
 Next
 Rhino.EnableRedraw(True)
 Rhino.AddText “Settings: ” & vbCrLf & “1. general radius= ” & (D) & vbCrLf & ” 2. Number of Curves: ” & (h) & vbCrLf & ” 3. Sample points: ” & (n),array(basePt(0),basePt(1)-10, basePt(2)),.5,”arial”
 ’Rhino.AddInterpCurve Pts
 
End Sub

Leave a Comment

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment