Update grasshopper user object / cluster with python or manually GH_UpgradeUtil

How can I update a Grasshopper user object/ cluster (without changing the inputs / outputs at the boundaries of the cluster) while using python for example with the GH_UpgradeUtil (Grasshopper.Kernel.GH_UpgradeUtil)? How would a manual update process without python look like?
Is GH_UpgradeUtil only available for components?

I want to improve user objects over the time and then decide wether I want to update the old versions of it in documents. Is the update process

I found this:
Ladybug update
This only seems to work for pure python code, as it seems like only the code attribute of gh python components get’s updated.

io-generated-errors-which-component

So you can get the version for installed components, didn’t find information about user objects yet.
https://www.grasshopper3d.com/forum/topics/io-generated-errors-which-component

Information on component update process
[update / redraw modified custom component in existing defintion? - Grasshopper]

Information on how upgrade using IGH_UpgradeObject, so one can use Solution -->Upgrade
(update / redraw modified custom component in existing defintion? - Grasshopper)

1 Like

I don’t think you can use GH_UpgradeUtil on user objects / clusters. It’s designed for plug-in authors to enable upgrading from one version of a component to another. It operates on the basis of the component Guid — all clusters have the same Guid so it wouldn’t know how to differentiate between them. You’ll have to write or find something custom for this purpose.

You could externalize your clusters via the “Export and Reference” menu item — this saves them out as external files. Then, make a user object from the referenced cluster. If you edit the cluster at any point and save it, it will modify your external .ghcluster file. The next time you add the cluster as a user object you’ll see this: Screen Shot 2020-09-24 at 8.23.47 AM

You can right click it and choose “Update” to load the latest version of it from the external file. That’s one way to propagate your changes to every instance of a cluster, but it’s not totally automatic.

1 Like

And this might help you with the automatic update of those clusters: Update All Clusters in a GH Script

1 Like

Thanks!

This seems to work for one user, but how can I dynamically edit the referenced path of the clusters?
There are several users, which would reference different file paths for the clusters.

Can I dynamically adapt the path to the clusters from a C# or python component?
Would a symlink leading to the different folders be enough to avoid the problem of different paths?

My use case is kinda similar to https://www.grasshopper3d.com/forum/topics/dynamically-link-or-mass-internalize-ghcluster-references.