Data Recorder Reseting Python Code

Hello everyone,

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!

Hello again,

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?

DataRecorderReset

Thanks a lot.

Hi @Erdem,

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.

1 Like

Hello @diff-arch,

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.

Will do, thanks again. :slight_smile: