Quering and Updating the User Attributes from Rhino and Grasshopper using speckle

I’m sending custom user attributes for objects from Rhino to my stream. I have added some keys and values for every object. Is it possible for me to query all objects sent to my stream and receive objects with a certain key and value?

For Example a curve in Rhino, I add a custom attribute key:check and with a value: False. and another curve with key:check and value:True. Is there a way I can query in grasshopper to receive only the object with value: False ?

In the end I want to also update the value to True once I open in Grasshopper. Can I update the key value of a stream using the same commit name I had used previously? Am I able to update the commit this way? or my only option is by creating a new commit for the stream with updated properties for all objects?(Its like amending the commit in github and pushing the commit again after changes)

1 Like

Hi @sujal_ks!

I have good news and bad news for you :slight_smile:

The good news is that our API does allow you to filter the results using a query. The bad news is that this is not exposed on our Grasshopper nodes (and would be tricky to do so).

@dimitrie wrote a very nice answer on this thread (GraphQL: how to query a speckle object - #4 by dimitrie) that will give you some insight on how the query and select features work.

On a brighter side, it is possible to do this in Grasshopper using a short custom python/c# script. We have docs on our website on how to set those up, and there’s a couple of nice nodes you could have a look at here

Commits in speckle are like snapshots of the data you’re sending, so currently you cannot update a specific commit to “amend it” as you could do with git. Your best solution would be to re-send the entirety of your data.

This doesn’t mean you are actually sending everything again, as any objects that are unchanged will have the same id when converted to speckle, and will be skipped if the object already exists in a prior commit of that stream. @cristi may be able to provide more details of that diffing behaviour, as this goes beyond my knowledge :slight_smile:

Hope this helps! Let us know if you need any more clarification :+1:t3:

1 Like