Rhino inside Python

is it possible to use rhinoinside inside rhino or only outside of rhino.
So i can only use cpython modules outside of rhino but not inside with the grasshopper python editor ?.

I mean if i use your example it works but can this rhino.curve.object be exist in rhino to make it visible?

sorry i am very new to this

Hi, Flokart. I think that what you are trying to achieve is not a rhino inside subprocess. If what you want to do is run a CPython script inside Grasshopper, maybe you can succeed with this plugin:

or this one:

@flokart It’s not currently possible to use cpython modules in Rhino/Grasshopper because it uses IronPython (not withstanding the workarounds that @ffribeiro shared). If you run Rhino.Inside CPython then you don’t get the Rhino UI, but all the geometry you create can be written to a 3dm file and viewed in regular Rhino.

Really neat project!
One thing that I’ve been struggling with is using methods from RhinoApp.
For example I’ve tried to use Rhino.RhinoApp.WriteLine("Hello World"), but nothing seems to show up.

However, if I use print(Rhino.RhinoApp.Version) in python I get the expected version: 7.0.20007.12535. Is there something I’m missing to control Rhino from python?

This command writes to the Rhino GUI command-line, not to terminal. Since Rhino inside Pythen runs headless you won’t see anything.

Great news, looking forward on testing this @stevebaer, thanks!

Hi @nathanletwory, perhaps it is a good idea that there is some kind of output redirection, don’t you think? WriteLine and Print are used quite often for debugging. I had to use chrome in headless mode recently and without being able to print something on the terminal I wouldn’t be able to fix my bugs.

Nothing is stopping you from using print that comes with Python…

1 Like

Sorry if this is obvious: So rhinoinside only connects to a headless Rhino?

I very much love the UI of Rhino and all of its functionality, but I also write Python 3 (not iron python friendly) code. Is it possible for rhinoinside to connect to an existing Rhino instance, and interact with the active document?

For the method of using Rhino that I described above this is correct as python is a headless console application controlling and containing Rhino.

This may eventually be possible, but I haven’t figured out how to do this yet.

Thanks for your reply, I wonder if other people also have similar needs. At the moment the GH_CPython libraryis not very robust.

Hope you figure this out soon. :muscle:

You aren’t alone, many people want python 3 support and many others want CPython support. We know this is an issue, and the technique described in this post is all we can offer for now.


Guys, thank you for your comments, I was very interested in reading them.