Forgot password?

Create an account!


« back

RhinoScript – writing to array


Please log in to write a message.

  • 3. clausneergaard (Feb 11, 2010 20.58):


    thanks for the input. it makes sense.



  • 2. Hanno (Feb 11, 2010 19.11):

    Hi claus,

    in the line

    arrPts(intCount) = Rhino.GetPointCoordinates(strPts)

    you are using the whole array strPts as parameter instead of strPts(intCount) for your current point.
    Further, rhino. get pointcoordinates asks the user for a point. Maybe you want to use rhino.pointcoordinates?
    And then, you are creating points and a point cloud. Is that intentional? If not, you can throw out all the strPts stuff and simply collect the coordinates in arrPts, like

    arrPts(intcount) = array(i, j, 0)

    Hope that helps!


  • 1. clausneergaard (Feb 09, 2010 23.02):


    i'm relatively new to rhinoscript, and i'm having difficulties figuring out how to write point coordinates to an array within a function, so that i can send the coordinates back to the main (maybe even as a point cloud).

    Function CreatePointCloud()
            Dim intPtCloudXdir : intPtCloudXdir = 10
            Dim intPtCloudYdir : intPtCloudYdir = 10
            Dim i, j
            ReDim strPts(0)
            ReDim arrPts(0)
            Dim intCount : intCount = 0

            Call Rhino.EnableRedraw(False)
            For i = 0 To intPtCloudXdir-1
                    For j = 0 To intPtCloudYdir-1
                            ReDim Preserve strPts(intCount)
                            ReDim Preserve arrPts(intCount)
                            strPts(intCount) = Rhino.AddPoint(Array(i,j))
                            arrPts(intCount) = Rhino.GetPointCoordinates(strPts)
                            intCount = intCount+1
            Call Rhino.EnableRedraw(True)
            CreatePointCloud = Rhino.AddPointCloud(arrPts)
    End Function

    any ideas of why this code doesn't work? thanks in advance.



Why are these buttons gray?