I opened that issue at github. Sorry for duplicating it with already present ones.
There is no specific reason, at least from my side. I just wanted to run some small script which will add text string to the document, then explode it to curves. Like “Merry Christmas” or something similar. Just a play-around really.
Adding the folder where Rhino startup .py is located to the “Module Search Paths” (inside of Rhino Python Editor) and then adding the name of that specific Rhino startup .py to Rhino Command list (_-RunPythonScript “startup.py”) worked perfectly.
I also checked the option with supplying the full path, instead of adding the folder location to “Module Searc Paths” - it worked too.
Just like Mitch explained.
Pascal is this something that can be called outside of Rhino?
I would like to run a startup script that populates the user’s Grasshopper template directory field with a server location. This way the user would always have the latest Grasshopper template upon starting Rhino.
The reason I’d like to call this outside of Rhino is so that the script is automatically referenced within the Rhino Options > RhinoScript > Startup field upon the user’s installation of Rhino.
If I can’t let me know what you suggest, for example I could make a toolbar button using Rhino.AddStartupScript() to take care of this.
Create a script that allows you to select a folder. Then iterate all the files in the folder and added the .rvb files to the list of scripts to load at start using Rhino.AddStartupScript.
Could someone walk me down the process of adding a python script to rhino (loading it at startup) and then assigning a shortcut to the said python script. I mean, is this possible with Rhino 5 (for windows)? I’m aware there is a wish/effort to combine .rvb and .py scripts at start-up in rhino 6 but I was just curious, thanks. Or a relevant blog post would be very useful as well. Thank you, noob out.
Mitch, thanks for the prompt response. One more thing to clear, does this process load the script to be recalled later during the session and attach aliases to it? I’m doubtful but hopeful anyhow my follow-up question is if you have these scripts in .rvb format then? Thank you!
Any idea why this there isn’t an easier way in Rhino to create aliases for python scripts? Most users I deal with prefer keyboard commands rather than buttons.
It’s not all that hard… Yes, it would be easier to drag and drop, but having set a path to the scripts folder (once) in the editor, all you need to do is throw the script file into that folder and then make your alias.
Call StartUp()
Sub StartUp()
Call ClearStartUp()
Rhino.AddStartUpScript “PATH\TO\MY\FOLDER_StartUp.RVB”
Call AddStartupScript()
End Sub
Function ClearStartUp()
Dim intCount, arrPaths, strPath
intCount = Rhino.StartupScriptCount
If intCount > 0 Then
arrPaths = Rhino.StartupScriptList
For Each strPath In arrPaths
Rhino.DeleteStartupScript(strPath)
Next
End If
End Function
Function AddStartupScript()
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("PATH\TO\MY\OTHER\FOLDER\FULL\OF\SCRIPTS")
Set fc = f.Files
For Each f1 In fc
s = f & "\" & f1.name
Rhino.AddStartupScript s
Next