Grasshopper

algorithmic modeling for Rhino

Fellow coders,

I attempt is to create a movie showing an object changing dimensions randomly. As advised in a previous post, I am using a Script to take screenshots from the object anytime a parameter is changed, by implementing timers, which is working quite good.

What I don't manage to do is to take multiple screenshots giving a continuous change. For example: if I am drawing a line, I would like GH to take 10 screenshots when x value of the first point is changed from 4 to 5, one screenshot every 0.1mm.

I have implemented a While Loop outputing x value with a step of 0.1mm whenever the objective is changed, but it looks like the system doesn't have time to take a screenshot for each value. How can I slow down this loop to get enough time for the rest of the GH code to execute?

I have tried to use System.Threading.Thread.Sleep, but it doesn't change anything. I guess it freezes as well the rest of the GH Code.

Thanks for your help,

PS: Grasshopper is an awesome tool, a big thanks to the developpers!

Views: 554

Replies to This Discussion

Just to clarify... Are you changing the value of x directly from 4 to 5? or you do it in 0.1 intervals (4.1, 4.2, 4.3...) outside the script of screenshot?

Unless you're working with threads, until one method does not finish, the next does not start, so rhino takes all necesary time to capture the image I think. The problem must be another, perhaps the display or logic.

Hello Daniel,

No I am doing it in the same script that way:

I only get a screenshot  for the start value and the end value, with the correct File Extension Number. Let's say, if I change x from 4 to 5, I get Image Number 40 and 51 only.

Maybe you get a better idea to change the xvalue outside of the script?

I'm not sure how you are doing, but I would do this in this way:

Move the object outside of capture view script, moving the object in intervals of 0.1, so at each new solution (one for each 0.1 move), the script receives a parameter has changed (can be an irrelevant parameter or in this case the fname param) and so will make a capture for each move.

Everything that happens within the code will not be displayed, unless you do it explicitly, so it is advisable to do this (the move) from outside the script.

Attachments:

Hmm, I see.

So what you basically mean is even if my x X Value is an output of the loop within the script, it won't be displayed as long as the script - the While Loop - is running?

I tried to make the Move in a different script but this is still the same issue, for the same reasons I guess.

How can I tell GH to display the solution for every value inside the script? Is there any -recompute the solution, display it and then jump to the next value- instruction in VB?

I actually figured out my mistake, kindly dismiss my previous questions. The script you gave me helped me a lot.

Thanks Daniel

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service