I am working on a custom undo cluster and I was wondering if I can make a GHPython component that resets the data recorder’s stored data. What I have in mind is to have 2 inputs connect into the GHPython component. First one a boolean value and the second one is the GUID of the Data Rec component. When a True value is received from the first input, the code will execute and reset the stored data in the Data Rec component.
I have seen some videos about setting sliders to different values with python code but I have no idea how to reset the data on the Data Rec component.
I found this code online which returns the GUID of the component that is connected to the input of the GHPython component that has this code.
for input in ghenv.Component.Params.Input:
print input
for source in input.Sources:
a = str(source.InstanceGuid)
Can I somehow get the GUID of the Data Recorder component using this code and then somehow using another bit of code reset the values in that particular Data Recorder component?
What I have in mind looks a bit like the screenshot. When I pressed the button I want the Data Recorder component to lose all its existing data. Is it possible? What else would you suggest?
Instead of trying to reset the obscure DataRecorder component - which is kept under closed wraps -, you could come up with your own Pythonic recorder that you would have total control over?
The data recorder could for instance be a custom class that gets stored in the sticky dictionary and reloaded from there every time the canvas refreshes/recomputes. You could simply delete it if you want to get rid of data. I’m sure somebody might have tried something like this before.
As suggested by @diff-arch above, you can likely simplify/better manage things by also recording the data using GHPython. Here’s some examples demonstrating the basic ingredients you’d need:
Edit: Ah, sorry. You were posting a solution, need more coffee
I attached the gh code but I had to comment out the bits on ExpireDownStreamObjects(), but I swear it was working before, but looks like it can work without it too
Thank you for your effort, still not working. I do use the latest Rhino7SR37 on Windows11 machine.
This time no errors on the Python script but the DataRecorder itself shows a warning message saying: 1. Floating parameter Cycle failed to collect data
Weird things. It is not clearing the data in the panels only after pressing the Button again. If I connect the newly created empty panel at the end of the video to an existing panel, will inherit the data from the original panels.