Convert Userobject with Python2 Component to Python3 Component(Rhino8)

I frequently use user objects to leverage past legacy. In particular, I have accumulated a large number of UserObjects created with the python2 ghpython component.

As you all know, Rhino8 has been released, allowing the use of python3 in grasshopper. I’m looking for a way to convert the ghpython components, written in Rhino7 and earlier and stored as UserObjects, into python3 components so that I can continue using them.

Of course, it is possible to do this manually by copying, but it’s cumbersome, and I’d prefer not to.

@quarmiere I am working on a script for you to automate the conversion process. I will post it here when ready.

@quarmiere Here is a crude first draft of automatic conversion of UserObjects from legacy IronPython to new scripting component. It can read the component info, source code, parameters, and hints, and most of the configurations (except for the red arrow here)

Rhino_WymR5uBnLQ

:warning: Backup your user objects and give this a spin. Keep me posted on what is missing or not working. You can DM me the user objects that throw an error of fail conversion and I will look at them.

  • Download this plugin
    UserObjectConverter.rhp (66 KB)

  • Open Rhino

  • Drag and drop the plugin into Rhino to load

  • Load Grasshopper first

  • Run ConvertLegacyUserObjects command

  • Wait for a few seconds and it prompts you to select your .ghuser files to convert

  • Then it shows a conversion options dialog. Put the destination path in the field. You can change the name format as well.
    Rhino_ajePR4lEv6

  • Hit Convert

3 Likes