Option Explicit
‘Script written by mark.bearak
‘Script copyrighted by dtls.architecture
‘Script version Monday, October 22, 2007 3:16:51 PM
Call Main()
Sub Main()
Dim h, i
Dim dblRadius, vecDir, intFreq, dblConv, n, dblInflect, arrMovPta(), arrMovPtb(), arrMovPtc(), arrMovPtd(), arrMovPte(), blnEven
Dim dblRad : dblRad = 1
Dim dblSpread : dblSpread = 6
Dim dblCntX, dblCntY, dblCntZ
dblConv = 0.0174532925
For h = 0 To 20
If (h Mod 2=1) Then
n = 0
intFreq = 0
ReDim Preserve arrSrf(h)
For i = 0 To 36
ReDim Preserve arrMovPtd(i)
ReDim Preserve arrMovPte(i)
If (i Mod 4 = 0)Then
blnEven = 1
Else
blnEven = -1
End If
DblCntX = 0
DblCntY = 0
DblCntZ = h*7
If (i Mod 2 = 0) Then
dblRadius = 20+h
dblInflect = dblRadius/10
ReDim Preserve arrMovPta(n)
ReDim Preserve arrMovPtb(n)
ReDim Preserve arrMovPtc(n)
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ-(dblRad*(dblSpread/2))),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ-(dblRad*(dblSpread/2))))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, 90*blnEven, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread)
arrMovPta(n) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ-(dblRad*(dblSpread/2))),vecDir)
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, -90*blnEven, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread)
arrMovPtb(n) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),vecDir)
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ+(dblRad*(dblSpread/2))),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ+(dblRad*(dblSpread/2))))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, 90*blnEven, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread)
arrMovPtc(n) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ+(dblRad*(dblSpread/2))),vecDir)
n = n + 1
End If
If (i Mod 4 = 0) Then
dblRadius = 20+h
dblInflect = dblRadius/10
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, 90, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread/3)
arrMovPtd(i) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),vecDir)
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, -90, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread/3)
arrMovPte(i) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),vecDir)
Else
If (i Mod 4 = 1) Then
dblRadius = 20+h+1
dblInflect = dblRadius/10
arrMovPtd(i) = Rhino.PointCoordinates (Rhino.AddPoint (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ+(dblRad*dblSpread*1.5))))
dblRadius = 20+h-1
dblInflect = dblRadius/10
arrMovPte(i) = Rhino.PointCoordinates (Rhino.AddPoint (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ-(dblRad*dblSpread*1.5))))
Else
If (i Mod 4 = 2) Then
dblRadius = 20+h
dblInflect = dblRadius/10
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, -90, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread/3)
arrMovPtd(i) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),vecDir)
vecDir = Rhino.VectorCreate (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),_
array(cos((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin((i+1)*10*dblConv)*dblRadius*((sin((i+1)*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ))
vecDir = rhino.VectorUnitize(vecDir)
vecDir = Rhino.VectorRotate (vecDir, 90, array(0,0,1))
vecDir = rhino.VectorScale(vecDir, dblSpread/3)
arrMovPte(i) = Rhino.PointAdd(array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ),vecDir)
Else
dblRadius = 20+h-1
dblInflect = dblRadius/10
arrMovPtd(i) = Rhino.PointCoordinates (Rhino.AddPoint (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ-(dblRad*dblSpread*1.5))))
dblRadius = 20+h+1
dblInflect = dblRadius/10
arrMovPte(i) = Rhino.PointCoordinates (Rhino.AddPoint (array(cos(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntX, sin(i*10*dblConv)*dblRadius*((sin(i*intFreq*dblConv)+1)/3+dblInflect)+DblCntY, 0+DblCntZ+(dblRad*dblSpread*1.5))))
End If
End If
End If
Next
Call AddPipe(arrMovPta,dblRad)
Call AddPipe(arrMovPtb,dblRad)
Call AddPipe(arrMovPtc,dblRad)
Call AddPipe(arrMovPtd,dblRad)
Call AddPipe(arrMovPte,dblRad)
End If
Next
End Sub
Function AddPipe(arrMovPta,dblRad)
Dim strLine
strLine = Rhino.AddInterpCurve (arrMovPta)
Call Rhino.SelectObject (strLine)
Call Rhino.Command (“Pipe “&dblRad&” “&dblRad&” enter”)
Call Rhino.Command (“Selnone “)
End Function
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.