Grasshopper

algorithmic modeling for Rhino

I have been using Piacentino's The Engine C# component to generate numbers to drive a simulation.  However he suggests using the built in Timer component to achieve the same thing.  I cannot seem to get a grasp of how to do this.  Any help will be much appreciated.

 

 

Regards

 

Views: 603

Replies to This Discussion

I thought The Engine was created by Giulio Piacentino. Nevermind, to do what you are asking try the following:

Place a vb.net component into the canvas, double click on it to edit the code and where it says "your code goes here…" add the following:

 

If x Then  int = -1

int += 1

a = int

 

and where it says "'<Custom additional code>" add the following:

 

Dim int As Integer

 

Now connect a "Boolean toggle" component to the x input and link a timer component to the vb.net one. When the boolean toggle is set to FALSE, the vb.net component will start outputting integers that increment by 1 every second (the default time interval of the timer component). If you want to reset the timer to 0 set the boolean toggle to TRUE.

 

You could also try the following, instead of just generating integers, on every update get the current system time and subtract it from the previously stored system time. Output the actual time increase between updates. This will create a more fluid animation.

Apologies for getting the creator of The Engine wrong.  Have corrected it in my post.  Many thanks for your help

and You can use Firefly component "Playback" to read at given framerate numbers stored in external txt file.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service