Wish: Replace attribute value component for Grasshopper

As you may be aware, I did some experimentation with attribute referencing and modification. The solution to change particular attributes is still a little bit involved, see this thread: Detect geometry changes - access GUID data in between paranthesis? - #14 by Intuos

Ideally, I would love to see a component where you can input a list of User text keys that you want to replace. You feed in the content that has values to replace and feed in content with replacement values. When replacing values, rather than replacing the attributes alltogether, only the attributes keys that were fed in should be affected.

Sticking to the example of the thread I linked above, I would feed in the referenced geometry, because I want to replace some values there, supply the keys for the values that need to be updated through Grasshopper and finally feed in the content with recomputed values.

It might also be nice if you could feed in just the values, like so:

That saves the hassle of matching key and value lists, albeit easy to do with duplicate data and partition lists.

I would second this notion. As grasshopper and Rhino are adding more data tools it should start to match some of the typical functions in a SQL database. Updated one attribute in a database doesn’t rewrite all the other attributes.

In addition an Upsert function would be a valuable addition. Most SQL and other databases have this function that updates values when a key or id is provided but will insert or create a new value when none is provided.

I believe you can acomplish what you are looking for by right clicking on the component and changing the update type from merge to update, or maybe I’m not understanding what you are trying to acomplish?

What I was trying to achieve is that I want to insert only one key and value in this case, but to do so now requires me to match the keys and values to the data tree I need to insert them in.

1 Like