Grasshopper

algorithmic modeling for Rhino

Hi.

When I double click the left boolean toggle the timer that is connected to the Kangaroo Physics Engine is enabled.

What would be the most elegant way to turn it off after 2 seconds? Is there something simple like this? setTimeout(function(){ o.Locked = x; }, 2000); (Javascript pseudo code)

Views: 718

Replies to This Discussion

The solution in Python is time.sleep but I'm not sure how the code will work when you run it from insider the component

import time

# do your stuff and turn on the timer

time.sleep(2) # wait for 2 seconds

# turn it off

I think it would be much easier if you would describe exactly what would you like to do in the end. You're using the old Kangaroo, maybe it will be simpler with the new one ? Any way of messing with timers and threads in gh is always risky.

To add to what Mateusz said: If you can move your project to Kangaroo2, you'll have a great deal of freedom in scripting your own custom solver components. Meaning that you'd be able to implement whichever logic you're looking for right in the solver.

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