Overview of Python scripting in Rhino

I’m trying to get started with scripting Rhino, probably using Python, and I have so many questions. For example:

• What is the difference between Rhino.Python (which has documentation Rhino.Python Guides with Python) and PythonScript (in Rhino’s GUI)?
– There seem to be some names that are not helpful. For example, it took me a while to work out that rhinoscriptsyntax does not involve rhinoscript – it mimics it in Python. Why do some commands/methods appear in rhinoscript but not rhinoscriptsyntax?

• When do I want rhinoscriptcontext, scriptcontext or Rhino? Is there a list of the methods associated with each?
– I’m starting to suspect that methods accessed via “import Rhino” are in the RhinoCommon API, but how come the documentation RhinoCommon API - Redirect doesn’t provide Python?

• If I find a method or object etc in someone’s script, how do I search for the documentation on it? – do I need to know which API to look in?

You’re welcome to address those questions, but I have more – so really I would like to ask:
• how do I get started here? and
• are there clever ways to search the documentation?

I’m hoping for answers that go beyond Rhino.Python Guides with Python. (I looked there, and searched from there, for insight on “scriptcontext”, for example.)

Hi @e.wynn

RhinoCommon is the root API for Rhino. Everything you will ever need will be accessible from here. It is written in C# and a little bit of C++.

Rhino ships a version of Python(ironPython) that is different from the normal Python(cPython). The difference is, IronPython support .NET framework. (In english, All C# API/Classes/methods can be accessed). So, you can use RhinoCommon API (I would suggest that you get used to this, than the other ones).

Theother library is rhinoscriptsyntax which is a wrapper over RhinoCommon. It uses RhinoCommon to simplify certain tasks, and provide them as a package/lilbrary. You can check the rhinoscriptsyntax source files at:

\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\

You can check these links on the same page you were looking.
APIs for Python
What is Rhino.Python?


Kaushik LS
Chennai, IN

The above is for Rhino V7. CPython has just been added to the V8 WIP.

1 Like

Hi Kaushik,

Thanks for trying, but this has not helped me very much.

If I want to use RhinoCommon via Python, what is X in “import X”? – where is this stated or explained?

If I assume X=Rhino, what is “import scriptcontext as sc” for? (I see it being used by experts in some examples, such as https://discourse.mcneel.com/t/pythonscript-equivalent-of-isbox-and-boxpoints/133069/2.) Where is it documented?

Why is there no documentation for Python in the RhinoCommon pages?


I think you first need to understand the basics of how Python works before trying to use it with Rhino… There are plenty of books/net-based resources out there for that.

After that, here are some more Rhino-related resources: