Forgot password?

Create an account!


« back

RhinoScript – Problem with arrays


Please log in to write a message.

  • 3. xavido (Sep 29, 2010 17.27):

    Of course! I just fogott to use Preserve. Besides I was using Redim Preserve in the other parts of my script but not in this part... that's why it was not working...

    Thank you!!

  • 2. Hanno (Sep 29, 2010 17.20):


    I don't get your problem exactly, but be aware that all your data in the array is lost if you simply ReDim it. If you want to preserve the data in the array while changing its size, you can use ReDim Preserve MyArray(n)

    If that was not the problem, please try to explain it again :-)


  • 1. xavido (Sep 29, 2010 17.12):

    Hello! I have a problem with arrays: I got a script with makes surfaces from points with AddSrfPt and now I want to join them all, so everytime I use AddSrfPt I store the result in an dynamic array:

    This code is executed correctly:

    Dim arrSurf
    ReDim arrSurf(0)

    Rhino.print "Cont: " & surf_counter & " id: " & arrSurf(surf_counter)

    As you can see, I print my results to check if it works, it does.

    So my problem appears after that, when I want to use the array, the dimension of my array is, for example, 50, and I checked it by using the previous code and also by using Rhino.print Ubound(array); so I ReDim my array to, for example, 20, and then I try to use Rhino.Print array(2) and it says "An array is requiered" while it works if I don't redim the array.

    So I need this array to be exact in order to join the surfaces, that's why the redim is so important because joinsurfaces needs an exact array.

    I've used ReDim in other parts of the script and I have not had any problem.

    Any ideas?? Thanks!


Why are these buttons gray?