Okay sorry @Japhy, I dug around more and realized that in a different part of the script I had a Python component setting user text values which worked great for the updates being live in Rhino but I was not calling a refresh of the GH script, thus the Query components weren’t getting the latest values (unless a GUID component was added? which confuses me… I guess that’s because it’s then calling directly to that GUID object vs passing through a Model Object?)
I believe this was the issue why the UserText values weren’t being updated from the GH components dynamically.
Sorry for misleading you all on that, it now appears to be working just fine (the grasshopper components, not my script yet)
I wish there was a way (or perhaps there is) to refresh specific components or upstream components, I was able to refresh “downstream” logic by calling ExpireSolution(False) but unsure how to update the upstream Query Model Objects component so that the Model Objects coming out have the proper User Text values.
@AndyPayne and @kike or maybe this is a @scottd question, what method is being called within the “Synchronize” menu option of the Query Model Object component?
My question is, if I set UserText from a Python script how do I ensure that the referenced Model Objects from the Query components are always getting the latest and greatest attribute values without carpet bombing the whole script in a recompute?
Here’s more info about my script specifically and the GH context surrounding it:
-Historically I’ve been setting User Text immediately after a Query and then continuing with logic after that (the logic downstream relies on the User Text values being dynamic)
-However, in a large definition Caching at the start of a script starts to slow down everything over time where as directly calling a SetUserText definition is very fast.
Is there a way to set the User Text without the Content Cache but still get downstream Model Objects to have the correct, updated values without “carpet bombing” the larger script component refresh states?
Thanks for your help!
Attached is the simplest example I could come up with to illustrate this. Obviously a Cache at this scale is speedy but when I replicate the logic more than 10 times it gets slower of course.
I thought about using a data tree to have only 1 Query for “everything” and 1 Cache for “everything” but the problem with that is then it fires downstream logic if only 1 “piece” of said Query or Cache is modified.
Example if I am editing a layer called “Shapes” but the Query Model Objects component has layers “Shapes, Tools, Paths, Etc.” in it, then all the downstream logic relying on Tools Paths Etc also gets fired which is a deal breaker.
Any ideas are greatly appreciated! Thank you!
Graph Space:
Model Space:
20240614_Set_User_Text_01a.gh (39.4 KB)
20240614_Set_User_Text_01a.3dm (90.0 KB)
Thank you!