Grasshopper

algorithmic modeling for Rhino

hello

i want to connect the For i=0... actions of a VB component with time, can i do that?

if i try timer with the VB component then the grasshopper starts every 1 second (interval i chose) the iterations from the beginning. what i want is to see the result of every step of the For... on my screen connected with time (it could mean something like i is the timer... i=timer i dont know)

i got really confused

thank you in advance

Views: 1536

Replies to This Discussion

thank you mateusz .

1.and how do i use it in my component? not as a for i ... anymore, but as a if i<=... then?

(i tried that but it still starts from the beginning and it doesnt save the list that im trying to make.)

2. in your component you declare counter like this:  Private shared counter as int32 = 0. Can you explain why you did that and why you put that down there?

3. one last question is there any class thing or something in the library like time? something that in the same component gives time relation?

thank you

in your component you declare counter like this:  Private shared counter as int32 = 0. Can you explain why you did that and why you put that down there? does it play the key role?

thank you

The timer component just expires the Script component in set intervals. what jao get is what you see: your for() loop restarting every interval.

what I guess you want to use is System.DateTime.Now. This static property retunrs a DateTime structure representing the current system time. Use it to get the timestamp in your iteration loop and combine it to what ever your output is.

how do i use this datetime.now for my loop?

As I said, this property returns the current system time. You can can use it as a generic timestamp or format it into a string.

You just wrote, you wanted to connect your iterations with time... no idea, how you wanted to do this.

I guess, Andy's post is more about what you were aiming for.

On a sidenote:

Hoopsnake lets you build your iteration in grasshopper components by looping back the output of one single iteration. It basically gives you the component for a for-loop. Starting the iteration will cause GH to redraw the preview for each step.

There are a few time related components in the Firefly tool set which might come in handy.  There is a stopwatch component which takes a boolean input and will return the length of time (in milliseconds) that the stopwatch was in the 'true' state.  I tried to make it like a regular stopwatch, so when the button is down it is running and when you release it, it stops.  Anyway, you could have a boolean input attached to this and if the length of time since you started the stopwatch exceeds a certain limit, then you could trigger some action.  There is also a framrate component, which tells you how many milliseconds the incoming data was last updated.  Typically I use this to see how fast some data is being updated in my scene (some sensor data for example)... although another potential use would be finding velocity of a point moving in space.  You could record the current position and the position the point was just in and then find the distance.  The framerate would give you the time interval between the last two recordings, and you could easily find how fast the point was moving based on these two factors.  There's also a counter component in Firefly which may do more or less (I haven't looked at Mateusz's example) the same as the attached example.  Anyway, perhaps these are useful for you.

-Andy

what i want to do is to see the evolution of the generations of the iterations or whatever i write to do, and not to see just the final product of the vb-function.

You can use the Data Recorder component (Params/Special/Data Recorder) to record each iteration of data (each time it changes).  You can set the limit of the recording to be whatever you want (ie. the last 100 values, or record indefinitely).  Once you record the data, you can use a list item to scrub through the list and retrieve a specific value.  Is this what you want?

-Andy

no not exactly. i want to preview each iteration one after the other. if i generate 5 points from the loop, then what i want to see on my screen is the points to appear one after the other with the previous ones: i got 5 pts -> 1.show pt1 ->2. show pt1,pt2 ->3. show pt1,pt2,pt3... with the help of a "timer" or automatically in some way.

Does this work for you?  The component in the middle is the Fader One Way component (for Firefly).  Then, use that to specify the domain for a SubList component.

andy thank you very much it solved my problem.

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