Skip to content

Instantly share code, notes, and snippets.

@sbaer
Created May 15, 2013 21:27
Show Gist options
  • Save sbaer/5587540 to your computer and use it in GitHub Desktop.
Save sbaer/5587540 to your computer and use it in GitHub Desktop.
Automate Rhino5 with IronPython
# The following script is meant to be run inside of IronPython
# It demonstrates how to automate Rhino from a script
import System
# start an instance of Rhino
t = System.Type.GetTypeFromProgID("Rhino5.Application")
rhino = System.Activator.CreateInstance(t)
# show Rhino (optional)
rhino.Visible = True
# run your script or a bunch of scripts
rhino.RunScript("!-_RunPythonScript myscript.py", 1)
# shut down rhino
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(rhino)
@acormier
Copy link

Hi Goswin,

let t = System.Type.GetTypeFromProgID("Rhino5.Application")
let rhino = System.Activator.CreateInstance(t)

works for me and gives me a System.__ComObject

I didn't try to go further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment