Grasshopper

algorithmic modeling for Rhino

this two-liner script component seen in the embedded image lets me slider-select an element from a list and change its content via a second slider. 


of course, the values are not stored because at each call the component fetches the initial list again.


is it now somehow possible to count the times this component has been called in order to decide whether to use the initial list or a backup with changes from the last call?


maybe this could be done by defining an additional storage class of global scope that can be seen from within all script components?


best regards,


heinz.


Views: 250

Replies to This Discussion

In the section the RunScript, where it says 'additional custom code', type in:

private static int counter

Now this counter would not expire until this component is deleted off the canvas, or in some cases, even until Rhino is not closed. So use cautiously.

On the first run, counter would obviously be nothing, so you have to declare it if its nothing, and do a +=1 if it already has a value.
thanks a lot, this works out pretty fine now!

best regards, heinz.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service