This works fine if you run the code that contains the class definition only once.
The second time it gives the error “Name redefined”
That should not be such a problem when the program is finished, but during programming
and debugging, it would be handy if a class could be redefined without having to restart rhinoceros.
All script subroutines, functions, classes and global variables that are loaded into the loaded into the memory of the VBScript interpreter will remain in memory for the duration of the modeling session, unless the “Reinitialize script engine when opening new models” scripting option is enabled. This can be problematic when developing scripts that declare global constants or class definitions for these types of expressions can only be loaded once during a scripting session. When you try load a script that contains these types of declarations, you will receive a “Name redefined” VBScript runtime error.
To work around this limitation, you can simply open a new model if the “Reinitialize script engine when opening new models” scripting option is enabled. But, opening new models is not always a practical solution.
You can also run the ResetRhinoScript command. Note, when either one of these techniques is used, all script subroutines, functions, classes and variables loaded during the scripting session will be erased.
Note, the ResetRhinoScript command should only be used during the development and debugging of scripts. It should not be used a method for cleaning up after scripts for this command will erase all scripting data, not just your scripting data. Also, this command does not auto-complete on the Rhino command line.
Do you mean using a dictionnary like explaines here ?
In my case I use nested arrays, because of my data structure, and I amvery happy with it. For instance I am storing all the points of my building in an array (arrPoints), such that the point j of structural element i is arrPoints(i)(j).
My script reads texte files and finally draws alll points (and meshes), about 1 million of points.
What I want to do is just store this array (arrPoint). From what I hear from @Helvetosaur I can just write, out of all functions
:
Private arrPoints()
I am referring here to Helvetosaur example here :
Can I then use this array in other scripts (during the same rhino session) ?