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.
Any idea is welcome! Thanks for reading!
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:
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?
Thanks a lot.
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.
That’s a great idea!! I’ll work on it, thanks heaps.
You’re welcome. If you search the forum, there are lots of similar examples.
I have been looking for a similar method to resetting the recorder’s output with a gh button, I managed to make it work with this python codes
I have two data recorder which I renamed both, that will be pickcked up by
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