WISH : Data dam with trigger input

I want some parts of my definition to allow a new flow of data only upon a certain trigger.
The data dam would be perfect for this, but it’s one of those silly components that requires a button to be pressed on the component.

I managed to hacke it with Metahopper, following this post.

Trigger for data dam.gh (14.2 KB)

I really wish this component had a proper input for triggering.

I don’t get it… my downstream data are re-computed despite the data dam !
They still use the data recorded in the dam, but the big idea was to save time by not recomputing stuff that I don’t need !

What’s going on ?

private void RunScript(DataTree<object> data, bool update, ref object A)
    _data = data;
  A = _data;
DataTree<object> _data;

DataDam.gh (6.5 KB)

1 Like

Thanks !
But in fact, it turns out to be useless because somehow, the components downstream from the dam are recalculated anyways which is what I wanted to prevent with the dam…
I guess I need to put the dam lower downstream and use Metahopper to enable / disable the components that I want to stay put.

EDIT : my bad , the recalculation of components was due to an automatic recompute of the entire definition.
The Metahopper trick actually works fine !

I normally use the Conditional Data dam components from the Fologram plugin.

1 Like

The issue with that C# script is that the DataTree class transforms referenced objects into objects which ruins downstream logic.

Read this topic about preventing expire of downstream components: How to trigger updates down only selected outputs of component?