Grasshopper

algorithmic modeling for Rhino

-------------------------------------------------------------------------------

Sub GenerateGrid(ByVal Points As List(Of On3dPoint), ByVal xNum As Integer, ByVal yNum As Integer, ByVal zNum As Integer, ByRef Grid As On3dPoint(,,))
Dim i,j,k As Integer
Dim x,y,z As New Integer
x = 0
y = 0
z = 0

'Create rows
For i = 0 To Points.Count() - 1 Step zNum

y = 0
For j = i To i + (xNum * yNum) - 1 Step xNum
x = 0
For k = j To j + yNum - 1
Dim pt As New On3dPoint(Points(k))
Grid(x, y, z) = pt
z = z + 1
Next
y = y + 1
Next
x = x + 1
Next


End Sub

Sub GenerateStateGrid(ByVal State As List(Of Integer), ByVal xNum As Integer, ByVal yNum As Integer, ByVal zNum As Integer, ByRef SGrid As Integer(,,))
Dim i,j,k As Integer
Dim x,y,z As Integer
x = 0
y = 0
z = 0

'Create rows
For i = 0 To State.Count() - 1 Step zNum
x = 0
For j = i To i + (xNum * yNum) - 1 Step xNum
y = 0
For k = j To j + yNum - 1
Dim st As Integer
st = State(k)
SGrid(x, y, z) = st
z = z + 1
Next
y = y + 1
Next
x = x + 1
Next

End Sub

----------------------------------------------------------------------------

hi guys ..I am experimenting on vb.net to test CA in 3Dimensional way... This is the code of creating rows....  I don't know why this keep telling me the index being outside the bound of the line" z = z + 1" ...

Is there anyone have any idea of what going on??

Realllly appericiate!!!!Thanks~~T.T

Views: 274

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service