29 January 2009

Honeycomb panels 02

After last post you can found here, where i used rhino paneling tool in order to reconstruct a surface with honeycomb tesselation, now i wrote a very simple lines construction point by point in a rhinoscript found on this blog: 4ofseven, Design Studio at University of Belgrade Graduate Programme.

Option Explicit
' Author: Milutin Cerovic 2009
' www.4ofseven.com
' adapted: www.madeincalifornia.blogspot.com

Call Main()
Sub Main()
'declare variables
'-------------------------------

Dim arrIsoCurves
Dim arrPoints
Dim DivNumber
Dim i,j

'select isocurves
'-------------------------------
arrIsoCurves=Rhino.GetObjects ("Select Isocurves, in order one by one")
ReDim arrPoints(UBound(arrIsoCurves))
'divide curve into equal distances and array points

'-------------------------------
DivNumber = Rhino.GetReal ("enter divide number
")
For i=0 To UBound(arrIsoCurves)
arrPoints(i)=Rhino.DivideCurve(arrIsoCurves(i),DivNumber,True)

Next
'draw lines with honeycomb pattern
'-------------------------------

For i=0 To (UBound(arrIsoCurves)-1)Step 4
For j=0 To (DivNumber-2)
If j Mod 2 <> 0 Then
Rhino.addLine arrPoints(i)(j),arrPoints(i+1)(j)
Rhino.addLine arrPoints(i+1)(j),arrPoints(i+2)(j+1)

Rhino.addLine arrPoints(i+2)(j+1),arrPoints(i+1)(j+2)
Rhino.addLine arrPoints(i+2)(j+1),arrPoints(i+3)(j+1)
Rhino.addLine arrPoints(i+3)(j+1),arrPoints(i+4)(j+2)
Rhino.addLine arrPoints(i+3)(j+1),arrPoints(i+4)(j)


End If
Next
Next
End Sub

0 commenti: