algorithmic modeling for Rhino
How can i import a list generated by some other component in grasshopper inside a VB component ?
I assumed it worked as a 1D Array so created the following script, but it gave the error "Index was out of range: Must be a non-negative and less than the size of the collection : Parameter Name Index(line 0)"
Private Sub RunScript(ByVal x As List(Of Boolean), ByVal y As Object, ByRef A As Object)
Dim i , j , p As Integer
Dim arr1(y ,y) As int32
p = 0
For i = 0 To y
For j = 0 To y
If x(p) = True Then
arr1(i, j) = 1
Else
arr1(i, j) = 0
End If
p = p + 1
Next
Next
End Sub
Tags:
Here are the files...
If you have y elements in a collection, the index can go from 0 to y-1.
So: For i=0 to y-1 and For j=0 to y-1, or index will go out of range.
Oh...that was causing all the problem... I was so focused on the way i called the list and assigned it to 2D array, that i missed the flaw in the logic...
Thanks alot SYSTEMIQ ...
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by