I have also created some other handy functions, such as MirrorHull(), TranslateHull() etc. However, having all these functions in one script file makes the file very large and unreadable. How do I separate each function or a group of functions to a separate file? Keeping them in the same directory is not working like in Matlab.
Are you using python or VB to create your functions? Using python you can save all your functions in a library and load as needed. I’m not sure about doing the same thing in VB though.
I am using Rhinoscript (or VB Script). Most tutorials are specific to one problem where everything is in one single file. In my case, it’s getting too long.
Hi Amitava,
you can save each Function or Subroutine in a separate file. Once loaded you can Call it from any other script.
Or do you want to compile your scripts to a plug-in? If so which compiler do you use?
Hi Amitava, looks like you are running your scripts from the ScriptEditor. That’s fine during development but there are many more possibilities. However, the general concept of loading and running scripts is well explained here:
If you have more questions feel free to ask.
Edit: I’ll add some info:
Have a look at the ScriptEditor: There are two scripts Main and HelloRhino. HelloRhino contains a Subroutine named PrintHelloRhino. Once you have loaded that script the Subroutine is in the memory of the scriptengine. That means you can call it from any other script (like demonstrated in Main.rvb). You can also run it from the _RunScript Command which lists all loaded Subroutines (but not Functions).
Hi @mconti
I have not used vbscripts for a while, but I think this should still work: Load your common functions rvb-file with the script compiler. Then enter the index of the automatically created command and edit the type. Change the type from command to Library. Then you should be able to access your functions from all other vb-scripts.