RhinoScript from EXCEL with Option Base 1

Working on a project in which RhinoScript is being called from with an EXCEL spreadsheet. For example to create a line from 0,0,0 to 1,0,0 the code would be:

'Base 1 commented out because it wreaks havoc with the calls to Rhino
'Option Base 1
Option Explicit
Function makeSomething()
    Dim Rhino, RhinoScript As Object
    Set Rhino = CreateObject("Rhino5x64.Interface")
    Set RhinoScript = Rhino.GetScriptObject()
    Dim arrLine
    arrLine = RhinoScript.AddLine(Array(0, 0, 0), Array(1, 0, 0))
End Function

This code works. However when Option Base is set to 1, the error message, “This array is fixed or temporarily locked” is issued. The problem is the person in charge has a disdain for using arrays and counters beginning with 0. Is there a workaround that will allow the calls to Rhino to work in an environment where the base subscript of an array is set to 1?

Hi @bkassel,

I can’t say that I’ve ever run into the Option Base 1 statement before. At first read, it sounds like a confusing and potentially hazardous declaration.

If your code works without it, then I’d say that’s the way to go - I have no idea how you’d work around it.

For what it’s worth, most all programming languages (certainly the ones that I am familiar with) use zero-based array indexing. I’m sure that is no consolation to your colleague. :wink:

– Dale

I completely agree with you. First of all let me say I am not a programmer, but I am guessing the vast majority of your RhinoScript users are just like me, “an engineer that programs”. But before I spend a bunch of time attempting to force the Rhino calls to work within a one-based array index I thought I would shout out to the community first.

Current condition is to place all the code that makes calls to Rhino in their own module that uses zero-based array indexing. I will let the team know that modules making calls to Rhino need to use zero-based array indexing. If we figure out a way around this I will let you know, but I am not sure that I want to spend any more time on this and even so if I would want to blast this out to the community because as you mentioned it is “confusing and potentially hazardous”

thank you very much for your prompt response, I have no idea how you consistently do it.