Grasshopper user objects -> replacing in all grasshopper files

Hi,

I have a following situation:

  1. I have many grasshopper files.
  2. In those files I have python user objects
  3. From time to time I update code in a python user object.

Afterwards I manually need to replace the components one by one.
In compiled .NET components this does not happen.

Is there a way to update all example files with new user objects?

Hi @Petras_Vestartas

You might take a look at how the LBT folks do their component-swapout:

For me, a better method has been moving all of the logic of the component out to functions or classes in a package, and them importing those into the component. When you update the package’s logic, it also updates in all your GH-Files.

@AndersDeleuran had a good explanation of several other methods for managing your code in a recent post here.

@ed.p.may

2 Likes

Thanks!

Very interesting solution from ladybug… I ll try get into.

Classes and packaging is great, but most of the time I have user interface issues e.g. input naming, type updates. Little minor things… but a bit tedious to update.

FWIW: It is possible to configure the component input/output nodes dynamically from the imported scripts as well. I don’t do this often, but if there are components where you know ahead of time that they will change a lot (or maybe where the options change based on the ‘type’ the user selected), it is sometimes worth setting them up this way.

If its helpful, you can see an example here: honeybee_grasshopper_ph.honeybee_ph_rhino.gh_compo_io.hvac.create_cooling_params

Though there is sometimes some funny behavior.

@ed.p.may