UI.start_timer() is the new while
-
One thought and one question...
Thought: Now that in Sketchup 8 UI.start_timer() works with factions of a second, I've found it more stable, and more fun, to make any iterative loop with UI.start_timer. By doing this, you give control back to sketchup every cycle so you never get the white screen and the program never locks. Of course it is much slower, but by never locking up the program it even allows me to keep working while whatever script is running. My most current use is on a draping tool that approximates a complex topography with a simpler grid. It's fun to just watch it iterate over the surface and refine the points. Another simple example would be the "drop at intersection" tool. It is easily modified to refresh after each drop. It's sort of like a progress bar that you can see in the model. Just curious what peoples thoughts are on the technique. Before start_timer worked correctly I would do a similar thing with an animation class and next_frame.
Question: In your experience, what is the smallest amount of pause time you can use with UI.start_timer to give sketch-up enough time to properly do it's thing and do you see a lower limit where there is no appreciable difference?
-Mike
-
Fredo is using timers for some of this plugins. He got some more experience.
@mtalbott said:
Question: In your experience, what is the smallest amount of pause time you can use with UI.start_timer to give sketch-up enough time to properly do it's thing and do you see a lower limit where there is no appreciable difference?
That would depend on what you do within the timer block, would it not? And here you get an extra challenge, as you add more entities to a context, the more time it takes to create the next entity. So the time to takes to create geometry in SketchUp isn't constant.
Is a timer of 0.0 interval not enough to return control?
-
I've experimented with using start_timer, and changing the time and/or partition size on the fly. It just gets far too slow to be worthwhile.
http://forums.sketchucation.com/viewtopic.php?f=180&t=27092&p=234026#p234026
Using an Animation class instead of a timer may be easier to code, but I'd guess the result would be similar.
Advertisement