071023_MBearak_Interlocking Linear Mesh

meshing.jpg

Option Explicit
‘Script written by mark bearak
‘Script copyrighted by dtls.architecture
‘Script version Wednesday, October 17, 2007 12:19:11 PM

Call Main()
Sub Main()
Dim h, i, j, k, l, n, o
Dim arrStart, arrPoint, arrPlane, dblLength
Dim dblIniLength : dblIniLength = 16
Dim dblHeight : dblHeight = 3
Dim ArrPta(), ArrPtb(), ArrPtc(), ArrPtd()
Dim dblRadius : dblRadius = .4
j = 0
For h = 0 To 15
i = h*dblRadius*8
For k = 0 To 12
dblLength = dblIniLength * 2
ReDim Preserve ArrPta(k), ArrPtb(k)
If (k Mod 2 = 0) Then
arrPlane = Rhino.PlaneFromPoints (Array(k*dblLength,j+dblRadius+i,0), Array(k*dblLength,j+i,0), Array(k*dblLength,j+.5+i,1))
arrPta(k) = Rhino.AddCircle (arrPlane, dblRadius)
arrPlane = Rhino.PlaneFromPoints (Array(k*dblLength,j-dblRadius+i,0), Array(k*dblLength,j+i,0), Array(k*dblLength,j-.5+i,1))
arrPtb(k) = Rhino.AddCircle (arrPlane, dblRadius)
Else
arrPlane = Rhino.PlaneFromPoints (Array(k*dblLength,j+dblRadius+i,dblHeight),Array(k*dblLength,j+i,dblHeight), Array(k*dblLength,j+.5+i,dblHeight+1))
arrPta(k) = Rhino.AddCircle (arrPlane, dblRadius)
arrPlane = Rhino.PlaneFromPoints (Array(k*dblLength,j-dblRadius+i,dblHeight),Array(k*dblLength,j+i,dblHeight), Array(k*dblLength,j-.5+i,dblHeight+1))
arrPtb(k) = Rhino.AddCircle (arrPlane, dblRadius)
End If
Next
For l = 0 To 24
dblLength = dblIniLength
ReDim Preserve  ArrPtc(l), ArrPtd(l)
If (l Mod 4 = 0) Then
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j+i,dblHeight/2-dblRadius), Array(l*dblLength,j+1+i,dblHeight/2-dblRadius), Array(l*dblLength,j+i,dblHeight))
arrPtc(l) = Rhino.AddCircle (arrPlane, dblRadius)
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j+i,dblHeight/2+dblRadius), Array(l*dblLength,j+1+i,dblHeight/2+dblRadius), Array(l*dblLength,j+i,dblHeight))
arrPtd(l) = Rhino.AddCircle (arrPlane, dblRadius)
Else
If (l Mod 4 = 2) Then
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j+i,dblHeight/2+dblRadius), Array(l*dblLength,j+1+i,dblHeight/2+dblRadius), Array(l*dblLength,j+i,dblHeight))
arrPtc(l) = Rhino.AddCircle (arrPlane, dblRadius)
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j+i,dblHeight/2-dblRadius), Array(l*dblLength,j+1+i,dblHeight/2-dblRadius), Array(l*dblLength,j+i,dblHeight))
arrPtd(l) = Rhino.AddCircle (arrPlane, dblRadius)
Else
If (l Mod 4 = 1) Then
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j-(dblRadius*(dblRadius*12))+i,dblHeight/2), Array(l*dblLength,j+3+i,dblHeight/2-dblRadius), Array(l*dblLength,j-1.5+i,dblHeight))
arrPtc(l) = Rhino.AddCircle (arrPlane, dblRadius)
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j+(dblRadius*(dblRadius*12))+i,dblHeight/2), Array(l*dblLength,j+3+i,dblHeight/2+dblRadius), Array(l*dblLength,j+1.5+i,dblHeight))
arrPtd(l) = Rhino.AddCircle (arrPlane, dblRadius)
Else
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j+(dblRadius*(dblRadius*12))+i,dblHeight/2), Array(l*dblLength,j+3+i,dblHeight/2-dblRadius), Array(l*dblLength,j+1.5+i,dblHeight))
arrPtc(l) = Rhino.AddCircle (arrPlane, dblRadius)
arrPlane = Rhino.PlaneFromPoints (Array(l*dblLength,j-(dblRadius*(dblRadius*12))+i,dblHeight/2), Array(l*dblLength,j+3+i,dblHeight/2+dblRadius), Array(l*dblLength,j-1.5,dblHeight))
arrPtd(l) = Rhino.AddCircle (arrPlane, dblRadius)
End If
End If
End If
Next
Call Rhino.AddLoftSrf (arrPta)
Call Rhino.DeleteObjects (arrPta)
Call Rhino.AddLoftSrf (arrPtb)
Call Rhino.DeleteObjects (arrPtb)
Call Rhino.AddLoftSrf (arrPtc)
Call Rhino.DeleteObjects (arrPtc)
Call Rhino.AddLoftSrf (arrPtd)
Call Rhino.DeleteObjects (arrPtd)
Next

End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s