This line:

     rejilla.add(springs(j))

should look like this:

     rejilla.add( new On3dPoint(springs(j)) )


The equal method points both variables to the same list.  The new
comment will actually create a new list, not just point to the
existing list.

- Scott

On May 28, 2:03 pm, jorgeduro <dai.generat...@gmail.com> wrote:
> i have this problem with vb lists in grasshopper:
>
> -i introduce SPRINGS as input List(Of On3dPoint),
> -i declare REJILLA as input List(Of On3dPoint),
> -then i equal REJILLA to SPRINGS
> -i operate with REJILLA
> -and when i look at the output values for SPRINGS and REJILLA, both
> are modified by the operator!
> so my question is:
> how can i introduce a list in vb and keep it non-modified (while i
> operate with another one created in vb that has inherited its values)
>
> the script:
>
> thanks a lot!
> jorge
>
> Sub RunScript(ByVal puntos As List(Of On3dPoint), ByVal springs As List
> (Of On3dPoint), ByVal k As Double, ByVal m As Double, ByVal iter As
> Integer, ByVal num_f As Integer, ByVal num_c As Integer)
>     Dim i As Int16
>     Dim p0 As New On3dPoint()
>     Dim cont As Int16
>     Dim num_i As Integer
>     num_i = num_f + 2
>     Dim num_j As Integer
>     num_j = num_c + 2
>     Dim max_i As Integer
>     max_i = num_f - 1
>     Dim max_j As Integer
>     max_j = num_c - 1
>     Dim j As Integer
>     Dim p_max As Integer
>     Dim p_list As New List(Of On3dPoint)
>     p_max = springs.Count() - (num_f + num_c)
>        Dim rejilla As New List(Of On3dPoint)
>     For i = num_j To p_max Step num_j - 1
>       For j = i To i + num_c - 2
>         rejilla.add(springs(j))
>       Next
>     Next
>     While cont < iter
>       For i = 0 To rejilla.count() - 1
>         rejilla(i).x += 3
>         rejilla(i).y += 4
>         rejilla(i).z += 6
>         print("posicion " & rejilla(i).x & " " & rejilla(i).y & " " &
> rejilla(i).z)
>       Next
>       cont += 1
>     End While
>
>     SP = springs
>     RJ = rejilla
>     PT = puntos

Reply via email to