Tell running Rhino application to execute script

Hey everybody!

I have written a little Python script in the embedded script editor. Now I am looking for some windows console commands to:

  • start Rhino with a certain 3dm file/ open a certain file in running Rhino
  • tell the running Rhino application to execute the previously created Python script

I have already come across the /runscript command but I didn’t get all of the information I need.

The purpose is that some other software produces input data which the Rhino Python script should process and therefore both, the loading of the file and the script execution should be automated.

Thanks in advance,

Couldn’t you ‘fake’ this by having the other software overwrite your Rhino template file?
I didn’t fully understand if the script also is changed every time but, regardless, you could also overwrite a single script that you have set to load when Rhino starts (Options > RhinoScript > Startup).

Thanks for your answer, but as Rhino shall remain running the solution with only running the script when Rhino starts does not really solve my problem.

To clarify the usage:

Another software produces an IGES file containing 3d data. The Python script calculates the intersection points of some ray with the 3d data and saves the intersection coordinates and normal vectors in that poins into some txt file (or processes them in another way).

As the IGES files are generated automatically, I am looking for a way to also automatically open the file in Rhino and run the Python script whithout any user interaction.

I dont know if this is possible with scripting but if you create a plugin that check’s a directory every 5 - 10 secs, and if there are changes open the file and run the python script…

Else you have to do it manually… open the file and run the scipt.

Ok, if there is really no way to use Rhino as some server for my requests, I will have to stick with that.


I wouldn’t jump to that conclusion :smile:. It’s just a matter of getting someone who knows about this to answer.
Perhaps @dale can provide a pointer?

I think you can make it automaticly with python or rhinoscript so you only have to click one button.

The problem is that everything should work completely automated, without pushing any button, so after a new IGES or 3dm file has arrived, my pythonscript should trigger and process the data.

Ok, if there is really no way to use Rhino as some server for my requests, I will have to stick with that.

You have not understood what @jordy1989 thinks…
Programing/Run Your script as loop and not close Rhino
Automatic Startup Your script in Rhino…

Which system do you work 32 or 64 bit ?

I think I did understand what jordy meant, that’s why i wrote “i will have to stick with that” :smile:
I just thought it would be more elegant to start the script only when needed and not looping all day long (or checking for new data after some sleep)

I have a 64bit system

I remember it used to be possible, here how it was up to Rhino 4:

Is this dead?

If you create a windows application you can use this yes.
It is not for python scripting because you still have an eternal loop then.

Not, is not dead, i’m use this external ACX access. (That’s a very good interface in Rhino)

  1. Download and install from here: AutoIt Downloads - AutoIt

Download attached file (1.0 KB) (979 Bytes)

2.Install Autoit → Scite with option Edit Script !!! !!! not Run Script

3.On your desktop create directory named IGS_Files

4.Put there few IGS files (For first test small files !!!)

5.Start Rhino

  1. Unzip, open Scite Editor and load extracted file ArrivedFiles.au3 (Source code)

  2. Press F5 or run script from scite menu → Tools → Go

What happens ?
External program is started
Every 20 minutes is checked whether new files arrived in folder IGS_Files
Files older than 20 minutes are ignored !!!
If new file arrived, command is executed, in my example, command Import IGS is used
If sixteen(16) clock is reached, script quit automatically
Exit script manual with RMB over Icon in systray

If everything works test your script
Give your script a command alias and change line like this

$r.Command("YourAlias", False)

Or Pythonscript: Make that Your Pythonscript is on search patch and add this as command

$r.Command("-_RunPythonScript (")  ;;;Not tested

At the end of your script → do not forget to delete all objects from document !!!

If everything works
You can compile this script as exe file. Ctrl + F7 or menu → Tools → Compile

Do not use Obfuscator ore UPX, otherwise your antivirus program will explode

use at your own risk, I do not give liability

Quick tested in Rhino4,
I do not know if LastCommandResult() returns a value when used aliased script

So finito end midday meal…

Wow, thanks a lot for this detailed description!!!

I will try it out as soon as possible.

First sorry for my bad English. (Google translater is my friend)

Here was a little logical bug
I have added two more lines (1.0 KB)
First loop import file that are no older than 20 minutes.
(But “DAY” is not checked, so remove files from previous day)
Next loop imports file that are no older than 20 minutes + Running time from previous loops.
After all loop’s finished, rhino.interface is destroyed, script will pause’s for 20 minutes.
After pause, for next loop new reference to running Rhino will be created, but in this case not ideal.

I have new modified old script, in this case, the object will accessed remain permanently in one same Rhino process. (1.0 KB)

Rhino can be automated, externally using ActiveX.

Here are a couple of examples that demonstrate this using VBScript.]

I don’t know if standalone Python supports ActiveX. But using VBScript, you can launch Rhino and have it run a Rhino.Python script.

Hi Dale, I was trying this automation example:
When trying to create an instance of Rhino it hangs. Task Manager is showing the process Rhino.exe, but from the description it appears to be the WIP. After some time it gives up trying. Do you have an idea how to get it to work?


Well the command is trying to create a Rhino5x64.Application object and (from your screen capture) Rhino 6 is loading which is a problem. Looks like the WIP installer is hosing COM entries in the Registry that were added by the Rhino 5 installer.

To fix, run REGEDIT and navigate to this key:


Modify the entry to point to the Rhino 5 x64 executable.

Thanks Dale!
I was using the interface in the meantime and think I’ll stick with that :wink: