Sunday, September 30, 2007

Scripting Boundary Negotiations

The following is a script written for a group Visual Studies project done with Lauren MacCuaig, Leslie Billhymer and Dan Affleck. The main objective for us was to be able to negotiate within, and actually rely on, boundary conditions.





















Main

Sub Main
Dim arrCurveSetIDs, arrCurvePts1, arrCurvePts2
Dim i, counter, arrAllPoints(), backCounter

arrCurveSetIDs = Rhino.GetObjects("Select Curves", 4)
If IsNull(arrCurveSetIDs) Then Exit Sub
arrCurvePts1 = Rhino.DivideCurve(arrCurveSetIDs(0),300)
arrCurvePts2 = Rhino.DivideCurve(arrCurveSetIDs(1),300)

backCounter = UBound(arrCurvePts1)
counter = 0
For i = 0 To UBound(arrCurvePts1)
If counter Mod 4 = 0 Then
ReDim Preserve arrAllPoints(i)
arrAllPoints(i) = arrCurvePts1(backCounter)
Else If counter Mod 4 = 1 Then
ReDim Preserve arrAllPoints(i)
arrAllPoints(i) = arrCurvePts1(counter)
Else If counter Mod 4 = 2 Then
ReDim Preserve arrAllPoints(i)
arrAllPoints(i) = arrCurvePts2(counter)
Else If counter Mod 4 = 3 Then
ReDim Preserve arrAllPoints(i)
arrAllPoints(i) = arrCurvePts2(backCounter)
End If
End If
End If
End If
counter = counter+1
backCounter = backCounter - 1
Next

Rhino.AddInterpCurve arrAllPoints

End Sub

No comments: