Grasshopper

algorithmic modeling for Rhino

Hi,

I've really run aground on this (seemingly very simple) problem.

I am trying to set up a boolean switch, that once a certain threshold is passed the switch is tripped, but inside that threshold the value is maintained.

I have a value changing with time, moving between 1 and 100.

If x<25, then True

If x>75, then False

If 25<x<75, make no change to the previous value

It's the last line that's really doing my head in

Thanks in advance for your help

m

Views: 4602

Replies to This Discussion

Hey Matt,

I would recommend the python sticky module. It is an external memory that keeps track of values even after an iteration of GH ended, so you always know the status of your switch at the iteration before the current one.

Best,

Dominik

Attachments:

Marcus,

I am sorry for this - I am not a programmer by training, I might miss some basic conventions.

Here is the correct version then:

Attachments:

Thanks so much to both of you. It's working great.

If I wanted to use different 'mySticky' values in different places around a single definition, how would I do that?

Is it as simple as specifying 'mySticky_02'  etc. for the other values?

Yes, that simple.

Basically it is a globally accessible variable system. You can exchange values even between different GH-definitions. I think the sticky values stay in memory for Rhino runtime.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service