Combining 2 2-dim arrays?

I have 2 2-dim arrays that I want to combine such that array A elements get placed into the even indices of the new array and array B elements get placed into the odd elements.

I thought this would be easy - outline of code.

x=0

j=0

k=0

For i=0 to (A.count()+B.Count()-2)

  if (xmod2)=0 then

      arrNew(i) = A(j)

      j=j+1

  else

      arrNew(i) = B(k)

      k=k+1

  endif

Next

 

But I can't seem to get a count of the number of elements in the first dimension of the array(The getLength() vb.net method doesn't seem to be implemented and I can't even seem to access a particular element such as A(0)(1) which seems to suggest that the data I am getting from grasshopper is not acting like a 2-dim array.

Any help would be appreciated. thanks.

  • up

    John Gulliford

    Try right clicking on "x"/ "y" and "flattening" both. This will pass in 1 1-d array in each x and y.Then you can sort out the lists however you would like.

    Grasshopper is a series of 1-d array's. Conceptually it does not have a 2-d array. That is the innovative part about branches and trees. It throws of traditional programmers, but becomes very intuitive. I am sure there are a lot of people that can expand on this better then I can.

    Hope this helps.

    1