# Toggle Data Dam

**URL:** <https://discourse.mcneel.com/t/toggle-data-dam/190183>\
**Category:** Grasshopper\
**Tags:** windows\
**Created:** [August 27, 2024, 5:43pm UTC](https://discourse.mcneel.com/t/toggle-data-dam/190183 "2024-08-27T17:43:06Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![AndersDeleuran](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andersdeleuran/32/476683_2.png) [@AndersDeleuran](https://discourse.mcneel.com/u/AndersDeleuran)\
**Post date:** [October 24, 2024, 6:48am UTC](https://discourse.mcneel.com/t/toggle-data-dam/190183/7 "2024-10-24T06:48:19Z")

</div>

> [@nathanlundberg77](#):
>
> When you start a grasshopper script, data dams instantly pass through whatever data is connected to them.

Hmm, I never actually noticed that. I wonder if that’s the intended behaviour, feels like a bug,

> [@nathanlundberg77](#):
>
> I’m wondering if there’s a way to instantly disable the data dams at the beginning of the script, and then enable them only once I press the button.

Here’s a quick hacky workaround, where we lock/disable the targeted data dams on the first canvas run, and then unlock/enable them again when the transfer button is pushed. This requires that the GhPython must compute first, which is solved here by sending it the back with Ctrl + B (see [this great article](https://james-ramsden.com/tag/draw-order/)):

 ![2024-10-24 08_34_36-Grasshopper - 240829_TransferDataDams_02_](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/f/2/4f2f2945add606c97868e98e13d687d26c3abae0.png)  

  
[241024\_TransferDataDams\_00.gh](https://discourse.mcneel.com/uploads/short-url/ptvXUB59h8bm6YUWPIIq5pSGD0Q.gh) (8.9 KB)

**Edit:** Unlocking the dams appear to raise an expiration error when you first run the script. You can choose to ignore those warning and it should work as expected, but obviously we should code that out. I’ll have a look when I get a moment.

---

_[View the full topic](https://discourse.mcneel.com/t/toggle-data-dam/190183)._
