Persistent vs non-persistent updates

I do realize that there’s an option for persistent vs non-persistent updates for the ShapeDiver API (extensive explanations were posted in the API documentation pages). But are there practical cases where a developer needs to update certain assets persistently (updatePersistentAsync(); ) rather than just updateAsync()?
Just trying to understand its application. Thanks in advance!

Persistent updates are typically used for advanced API functionalities, like making objects selectable or draggable for example. If you make an object selectable using updateAsync() and then request a parameter update that affects said object, the backend will send you a brand new asset that will overwrite the previous one, therefore losing the selectability that you defined. If you use updatePersistentAsync(), all the properties updated in the call will never be overwritten with subsequent updates.

@mathieu1 I see, thanks for the thorough explanation!
Related to advanced API functionalities. I’m currently trying to play around with the mouse interactivity aspect of ShapeDiver’s API.
My goal is to get certain geometry assets by name in api.scene.get() instead of getting all geometry assets by setting the first argument null.
I’m struggling to find a place to declare the name of the geometry assets while building my model in GH. Or am I looking at the wrong direction?
thanks

Set names of the geometry by renaming the SDDisplayGeometry output components in Grasshopper and re-upload. You will be able the get scene assets by name.

Does this mean that if an object connected with SDDisplayGeometry was made up of multiple geometries (let’s say a shelf with multiple layers/sections), all these geometries would be array elements in data under api.scene.get(…) of that particular object?

That’s exactly how it works. You need to organise the geometry in Grasshopper with further development in mind and feed it to relevant SDDisplayGeomtery outputs. Depending on the data structure (list or tree), the geometry is accessible as one or list of objects with the api.scene.get() call.

This video explains how to manage data in Grasshopper for online apps:

1 Like

Awesome! Thank you so much for the detailed explanation! @pavol