algorithmic modeling for Rhino
Hi Conor,
I think you have the wrong impression of what the Binary Blink component does. It merely oscillates 0s and 1s based on an incoming time pattern (in ms). So, this wont increment anything (as it will always return back to 0). I'm not sure there is a built in component (although I could be wrong) that does what you want to do (Kangaroo might have something).
However, this isn't hard to do with a simple scripting component. Basically, what you need to do is to declare a counter variable outside the RunScript routine. Each time the RunScript routine is called, the counter is incremented by 1. You can use the GH Timer component to trigger this solve instance routine to occur at regular intervals. If you add an input for the reset (boolean), then you can reset the counter back to zero whenever you want. The code would look something like this (in C#).
private void RunScript(bool rst, ref object A)
{
globalcnt += 1;
if (rst) globalcnt = 0;
A = globalcnt;
}
//<Custom additional code>
int globalcnt = 0;
I've also added the .ghx file in case you wanted to take a look.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by