24 January 2009

VB script diagrid01

Testing Visual Basic script in rhino grasshopper.

"Diagrid (a portmanteau of diagonal grid) is a design for constructing large buildings with steel that creates triangular structures with diagonal support beams. It requires less structural steel than a conventional steel frame. Hearst Tower reportedly uses 21 percent less steel than a standard design. The Diagrid also obviates the need for large corner columns and provides a better distribution of load in the case of a compromised building. Another building designed by Sir Norman Foster, 30 St Mary Axe, known as "the Gherkin", also makes use of this structural system."via Wikipedia



Class Grasshopper_Custom_Script
#Region "members"
Private app As MRhinoApp
Private doc As MRhinoDoc

Public A As System.Object
#End Region

Sub RunScript(ByVal pts As List(Of On3dPoint), ByVal u As Integer, ByVal v As Integer)

Dim arrPt(0 To u, 0 To v) As On3dPoint

Dim cnt As Integer = 0

For i As Int32 = 0 To u

For j As Int32 = 0 To v

arrPt(i, j) = pts(cnt)

cnt = cnt + 1

Next

Next


Dim lines As New List(Of OnCurve)()
'Point Culling
For i As Int32 = 0 To u - 2 Step 2

For j As Int32 = 0 To v - 2 Step 2
lines.Add(New OnLineCurve(arrPt(i + 1, j), arrPt(i + 2, j + 1)))
lines.Add(New OnLineCurve(arrPt(i + 2, j + 1), arrPt(i + 1, j + 2)))
lines.Add(New OnLineCurve(arrPt(i + 1, j + 2), arrPt(i, j + 1)))
lines.Add(New OnLineCurve(arrPt(i, j + 1), arrPt(i + 1, j)))

lines.Add(New OnLineCurve(arrPt(i + 2, j + 1), arrPt(i + 3, j + 2)))
lines.Add(New OnLineCurve(arrPt(i + 3, j + 2), arrPt(i + 2, j + 3)))
lines.Add(New OnLineCurve(arrPt(i + 2, j + 3), arrPt(i + 1, j + 2)))
lines.Add(New OnLineCurve(arrPt(i + 1, j + 2), arrPt(i + 2, j + 1)))

Next

Next

A = lines

End Sub

#Region "Additional methods and Type declarations"

#End Region
End Class

0 commenti: