Friday, 21 December 2007

071220_Origami trusses

"In architecture and structural engineering, a truss is a structure comprising one or more triangular units constructed with straight slender members whose ends are connected at joints[...] The analysis of trusses often assumes that loads are applied to joints only and not at intermediate points along the members[...] Every member of the truss is then in pure compression or pure tension – shear, bending moment, and other more complex stresses are all practically zero." (wikipedia)
The script is the first attempt into the invest
igation of trussed surfaces. In this case, triangular trusses are created between two iso-curves and then lofted together to create a origami-like trussed surface.

Call Main()
Sub Main()
Dim Segments
Segments = Rhino.GetInteger ("Number of points for truss", 20, 3)
If IsNull(Segments) Then Exit Sub

Dim TrussData
Dim arrCrossSections()
Dim N
N = 0

TrussData = GetTrussCrossSection(Segments)
If IsNull(TrussData) Then Exit Do

ReDim Preserve arrCrossSections(N)
arrCrossSections(N) = TrussData

N = N+1

If N < style="color: rgb(153, 153, 153);">
Call Rhino.AddLoftSrf(arrCrossSections,,,2)
End Sub

Function GetTrussCrossSection(Count)
GetTrussCrossSection = Null

Dim A, B
Dim ptA, ptB

A = Rhino.GetObject("Pick the first curve", 4)
If IsNull(A) Then Exit Function

B = Rhino.GetObject("Pick the second curve", 4)
If IsNull(B) Then Exit Function

ptA = Rhino.DivideCurve (A, Count)
ptB = Rhino.DivideCurve (B, Count)

Dim i
For i = 0 To UBound(ptA) Step 2
ptA(i) = ptB(i)

GetTrussCrossSection = Rhino.AddPolyline(ptA)
End Function

No comments: