I’m using TextTags in correlation with some curves to show specific information about my model (i.e. dimensions). I can toggle specific curves on and off using toggleGeometry but can’t see how to do this for individual TextTags. All TextTags are grouped together under a single grouping regardless of their organization in Grasshopper (see image). This is true for both the HTML display (shapediver-domElements) and XHR object.
Is there a way I can structure the Grasshopper file so that TextTags can be targeted separately?
Can we do this via toggleGeometry? Maybe something along the lines of: toggleGeometry([],[ 'CommPlugin_1.Asset_Id.content[0].data[0]'])
If you send your set of text tags as a tree, then you will be able to access each tag individually through the API, and use toggleGeometry as you specified in your message. Each tag will have a scene path of the form
CommPlugin_1.Asset_Id.content_N
where N is the index of the path in the tree. Of course, you will have to make sure the tree has a reliable set of paths that helps you identify the curve and the tag.
Unfortunately, this wasn’t a useful solution for me. I set up separate data trees (GraftTree > ExplodeTree) for each grouping of TextTags but, the separate trees and their references (i.e. {0;1},{0;2}) are not carried over. All TextTags are still grouped as one object and curiously, the index values of one data tree are inputted in ascending order with the values of the second tree between them in descending order (i.e. 0, D, 1, C, 2, B, 3, A). Perhaps, if they are all in a single tree their respective branch values will match their index values?
Regardless, as I now want all the front end functionality of my model to work based on its ticket, this setup gives no method of retrieving the asset id. For now, it seems my best solution is via JS and CSS. As my text tags differentiate between integers and letters, this enables me to target the tags separately:
It is true that the grouping of text tags is not component-based at the moment, it is defined based on parameter dependency, and the tree structure is lost. I filed this as a feature request to update this behaviour and match the other ShapeDiver outputs (grouping based on components and preserving the tree structure).
At the moment, your workaround seems to be the best solution. I will get back to you when the update is implemented.
I appreciate this being a feature request. I think it’s a good idea if all ShapeDiver display component names are referenced in the front end display. As TextTags are rendered as HTML div/span elements, it would be great if their respective names were referenced as ids or classes.