How could one make panel's volatile data persistent?

Could anyone suggest how can I persistently overwrite data in the panel? Its output is used in a larger script, so expirable data won’t do.

I know I can write persistent data with SetUserText, but I didn’t find a way to write a dynamic number of lines with it.


setpanelvalues.gh (5.2 KB)

Python code

Something like this maybe:


setpanelvalues_AHD.gh (8.5 KB)

I would have said some tricks with Data Recorder, but Python script maybe is cleaner

Thank you, this is very cool and simple. Though, do you happen to know what can be done with volatile data? I’m just curious at this point.

edit:
Once the panel is reset, it expects input to be in one line and then splits it into multiple lines, which is very inconvenient from the user’s standpoint… sorry.

This looks promising, too. May I ask you to elaborate?

I need a more specific question, I’m not sure what you don’t understand.

with record data you record data everytime it refreshes
with the buttons you clear data and enable/disable recording
the recorded data grows indefinitely everytime new data is added if you don’t set a limit.
looking at your case I understand there is a list of numbers that can change in length of list and its values, so using a limit related to the list length is not suitable. I just pack all the list in one item by grouping and I use 1 as limit, then I ungroup
Group component works only with geometry, not text/numbers, so I convert numbers to points

Sorry, I should have been more specific. What I don’t understand is what should happen next. I can’t seem to implement your solution to make it work :frowning:

the data is stored and refreshed everytime the Num input is updated

Oh. It’s not beneficial in my case, sorry. I’d have to expire the Number component, while the real non-volatile values in the panel stay intact, so the moment Grasshopper expires this panel it would create a mess.

I’m not sure I understand what you mean by expire. can you give a more detailed example in your file of what are you actually doing?

setpanelvalues_AHD2.gh (7.9 KB)
As you can see, the wire from “Reset all to 0” is tied to the Y input in the script on the right. The code uses .ExpireSolution(True) method to tell the number that the panel has updated.

And if we disconnect this wire, the panel’s volatile data gets updated, while Number component doesn’t know that the data has updated, so it has to be expired manually.

This would have been a viable solution, but it creates unnecessary overhead and leaves room for error. So the script that AndersDeleuran provided is more robust for my purposes.

Ah yeah, sorry, you probably need to use \r\n when adding the line breaks:


setpanelvalues_AHD_01.gh (9.2 KB)

Yay! Hell yeah..! I thought this was some kind of a bug on Grasshopper’s side.

edit: how do you even start knowing this…

I’m old.. and the old internet was pretty good with this stuff :old_man: