Grasshopper

algorithmic modeling for Rhino

So I have come to a point, where I need a specific component that doesn't seem to exist.

Basically I have a set of components that is being recalculated all the time and that creates an output (just a certain sized box in this case). I want to hit a button to "set" that output so it stays the same, even when the components before it get recalculated. Then when I press reset it again looks at the connected input and uses that data.

In vvvv this is basically what a hold node will do.

The data dam is basically what I need, but I dont get why it has the button included in it, rather than having just a boolean input. Its one of those UI quirks, that dont really make sense - maybe they did at the time it was conceived. I need the data dam deep inside a cluster. It would seem silly to route the input and output up through the clusters just for the data dam.

Does anybody know if such a thing exists. Is there a workaround or plugin that has such a component?

Thanks for any help.

Views: 5903

Replies to This Discussion

I just noticed 2 things actually:

1) You cant route the input and output to the top to have a data dam there, as it assumes you are producing recursive data

2) A data dam inside a cluster updates automatically every time you open the cluster, which it shouldn't.

It's pretty straightforward to write a basic data dam, which takes a boolean toggle, using any of the scripting languages (attached a GHPython version).

Attachments:

Thank you, but that is not what I am after. The data dam holds whatever values are in the outputs till I press the button again, even when the inputs change.

So it would have one boolean input to say if the dam is open or not. When set to true the input is just fed through to the output. As soon as it is set to false it stores the last value and uses that as the output.

Unfortunately my coding skills in Python are close to 0 :/

Hello Armin,

check this discussion. In comments there is custom c# solution, for data dam which is based on guids, which i think makes possible what you are after.

i used in a case where i needed the data dam to be empty (or not update) when changing a slider and have it remotely change from live or manual, due to very heavy calculations ahead of it. Changing slider caused system freeze, but with this solution it updates via toggle.

best

alex

Hello Alex.

Thank you, that works!

Ah yes, I missed that it should also output the last updated state of the data. See attached, hope that more accurately captures what you're looking for :)

Attachments:

Even simpler, thanks Anders.

Thats even better :) Thank you very much. Saved it as user object.

Sweet, glad it helped :)

thanks-this is very good

Hello again, so I am using your data dam a lot, but just now noticed that it still doesnt keep the data stored when going up or down a hierarchy level in a cluster. So even with the update input set to false, as soon as I go out of the cluster the data dam is in, it resets the output to 0.

Is there a way to keep the input data in there? If I have the update input routed to the top patch then it works, but as soon as I go into the subpatch or come out of the subpatch it resets itsself.

Is there a way to change the script, so the data remains even when saving and exiting the cluster?

Thanks!

Attachments:

Hmm, that's a good question. I'm not too familiar with how clusters work. But I imagine that it is doable, however this would likely require some traversing up/down the cluster document (as far as I understand, the cluster is technically a sub-document of the Grasshopper document) and the Grasshopper document. The easy solution would be to simply have the update button be an input on the cluster, but that doesn't sound like a solution in your case?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service