Updating user objects

at the risk of receiving the double facepalm, a question about user objects:

I use many clusters to automate repetitive tasks, that I save as user objects but many times I cannot foresee some bug when inserted in more complex definitions and I have to twick a thing or two inside them.

The problem is that every time I change an existing user object, I have to go to user object’s folder, erase the old one and then save the new one, otherwise gh saves it as a different file by adding a number.

Am I doing something wrong? and if not, could you pls add the option to overwrite existing user objects?

2 Likes

Ok, for anyone having the same question:
You can erase a user object if you right click its icon in the user tab and select “delete user object”
This removes it from the ‘user objects’ file and you can resave the edited version.
(still it would be better to just be able to overwrite -or just update- it!)

delete user object

3 Likes

I have the same question, have you learned anything new about this?

I was imagining a scenario in which you can “compile” a user object from a gh file, some text corresponding to the properties, and an image file. If you can do that manually outside of grasshopper, then presumably you can write a script to automate updates?

Hmm, I have missed this one. That is a good suggestion.

@DavidRutten, is it possible that we are able to update user objects? It looks handy.

I took a look around and found posts like these: https://www.grasshopper3d.com/forum/topics/injecting-custom-data-into-a-gh-file
And I noticed you can open and inspect a ghuser file in grasshopper using the viewer if you change the extension to .gh.
It seems like there may be a (very convoluted) way of editing some info in a ghuser file, but the path forward seems very hacky and I’m not sure how you would change the image.

Would love to have this functionality. Specifically, I usually don’t have time to make icons for my user objects, so it would be nice to be able to simply add an image for the icon at any time rather than having to remake the whole object to add an image

1 Like

I’m also struggling with this. Would be best if userobjects would have some sort of tagged assigned.

So let’s say I have facade01.ghuser and I have an updated facade01a.ghuser but both have the same tag. So once I load up another grasshopper file grasshopper will prompt me that there’s a new version of that userobject available and ask if it should be replaced or not.

And even more amazing would be if we could publish them in the cloud, so they get synced between several computers and people ! :tada: :tada: :tada: :tada:

1 Like

Let’s say that I create User Object and place it on canvas 10 times. Then I have to edit the user object (the same way how I edit cluster). Do other objects update automatically or do I have to delete all remaining 9 and replace with newely updated one?

User objects do not update. They don’t even remember they are user objects. It’s just regular objects with some non-standard properties set.

1 Like

I am curious,… I saw some plugins developed in python. There is a core library and the components are .ghuser file with python component that refers to the core library.
At some point the plugins are updated, components and core. Does that mean developers have to update .ghuser file one by one using Grasshopper File/Menu/CreateUserObject each time?
Is there anyway to update .ghuser file through coding?

Yes, there is. GH_IO.dll basically allows you do to this (and many other things). Some of the internal structure of these things are not documented properly, but it’s not hard to understand it, so, I did that in order to create/update our own ghuser components.

I’ve seen Ladybug has a super interesting approach in which the python code and metadata of components is stored in plain-text files, but I was not able to find the code they use to generate .ghuser files out of them, so I built a tool to do just that: take python code + json metadata + png icon and turn it into a .ghuser file:

(I am pretty sure @Mostapha has something similar for Ladybug, I just couldn’t find it anywhere)

I hope this is useful to others as well.

6 Likes

Thanks to @andrea.settimi the GH componentizer now supports also generating CPython components for Grasshopper! :100:

2 Likes