Forgot password?

Create an account!


« back

RhinoScript – Parsing array to a rhino script function


Please log in to write a message.

  • 2. Hanno (Apr 27, 2013 14.06):

    Hi Miro,

    the error "string required" means that one of items in the array was not a string (object GUID) but something else (propably NULL or empty). Reason could be that one of your AddLine methods failed and returned null, or that you did not fill all the items of the array.
    The change you introduced rebuilding the array really should not have made any difference, so I am guessing it was just a coincidence and the real change happend somewhere else?



    PS: You can use array_print of the array library here at to check your arrays in cases like this.

  • 1. serpens (Apr 18, 2013 17.19):

    Hi all,

    I try to develop some script in Rhino and I have one issue with parsing an array into a Rhino.AddOjectToGroup()

    Here is a small part of the code.

    'Define the array variable
    Dim moBlockID(2)


    'Fill it with objectIDs of created lines/circle
    moBlockID(0) = Rhino.AddCircle(Rhino.WorldXYPlane(), 0.15)
    moBlockID(1) = Rhino.AddLine(moRefLine(0), moRefLine(1))
    moBlockID(2) = Rhino.AddLine(moRefLine(1), Array(moRefLine(1)(0) + moNumLine, moRefLine(1)(1), moRefLine(1)(2)))


    'Here I want to create a group and then insert all the objectIDs stored in moBlokcID to the group

    Call Rhino.AddGroup(moBlockName)
    Call Rhino.AddObjectsToGroup(moBlockID, moBlockName)

    I have the problem with the AddObjectToGroup() function. When I run it I get an error - 'Type mismatch in parameter. String required'. At first I was confused because of the mentioned string and looking for the second argument of the function. Later after some debugging I found the problem is in the first (array) so I try to rewrite it like this:

    Call Rhino.AddObjectsToGroup(array(moBlockID(0), moBlockID(1), moBlockID(2)), moBlockName)

    Now the code works, how ever I would like to understand why it doesn't accept the moBlockID variable when it's also an array.



Why are these buttons gray?