Grasshopper Export from External Python script

Hi Javier,

What can be done in GH Python Remote, from CPython to Rhino, is only to interact with the Rhino Python engine directly. There is no explicit mechanism to control the GH canvas and solver in it. But you can access all the NodeInCode components, which include all your GH components, and call them just like a regular Python function.

However, since Rhino 6, there is no way to call GH User Objects from Python anymore, so you are restricted to using compiled .gha components. So you have to reproduce all the logic in your GH file as Python code calling GH Components. You will not be able to use .ghpy files, or anything like Ladybug/Honeybee which are user objects. edit: workaround available in GH Python Remote v1.3.1, see below.

You are basically limited to the same restrictions as when running RhinoPython (directly in Rhino, not in GH), and calling NodeInCode components. This means you might be able to use the same kind of workarounds to maybe control a GH solver in Python:

But maybe using these directly, without GH Python Remote will be easier to achieve what you are looking for?

Lastly, I have to admit the code for that part of GH Python Remote is a bit dated and I’ve not updated it frequently as it was not used much. To make it work you’ll need a few manual modifications (on top of having installed gh-python-remote v1.3.0, and using Rhino 6):

(Right-click the “Raw” button on the top right of file view and select “Save as…”)
edit: this was fixed in GH Python Remote v1.3.1

I hope this helps!

1 Like