Grasshopper

algorithmic modeling for Rhino

Good evening Daniel, 

I have a quick question; is there a big trade secret behind how you internalize the timer for kangaroo 2?

or would you mind sharing some information about how you cracked it? 

I am currently trying to do it with the StopWatch class, but I am thinking that you should be able to access your current component and force it to refresh somehow.. 

Looking forward to hear from you.

Views: 833

Replies to This Discussion

Hi Jens. You can a look at the function called ghComponentTimer() here. As far as I recall I based it on a C# snippet by either David or Andrew Heumann, you should be able to find it through a forum search I imagine. As you can see the trick is to call ScheduleSolution(). Have a good meeting today and say hi :)

PERFECT thank you!:) 

fixed it if anyone is interested:

private void RunScript(bool a, ref object A)
{

if(a){
_timer();
}

A = count++;

}

int count = 0;
GH_Document GHdoc;

void _timer()
{
GHdoc = owner.OnPingDocument();
GHdoc.ScheduleSolution(1, callBack);
}

public void callBack(GH_Document GHdoc)
{
owner.ExpireSolution(false);
}

public void ExpireSolution(bool recompute)
{
recompute = true;
}

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