GH to Python

Hi, I need to basically rewrite my GH script to Python (with little Python experience). I looked at GHPython Script but it seams that it’s for writing new scripts rather than translating the GH into Python. Has anyone attempted to translate extensive GH scripts to Python? Is there anything out there (other than tutorials :smiley: ) that would fasten the process?

Thank you!

Hello,

no there is no gh-definition-to-python-converter. Would be a good idea actually.
Usually, when scripting, you directly call Rhino functionality, by using Rhinoscriptsyntax or Rhinocommon directly. However you can also directly call components, as shown here

…however, don’t this. This is odd scripting.

Hi,
I would recommend that you start by incorporating some of your existing GH definition into GH python components within the same definition. Keep working, keep removing grasshopper elements and incorporating them into the python parts.
You say it’s a big project so it may make sense to break your definition up into multiple logical blocks in separate python components. These could become separate files later.
This will let you work progressively and fix things as you break them. You will also get a feel as you go on for how big a task you have set yourself.

2 Likes

Seconded! I think that is a really good idea, i hope we see it implemented soon