Does Sketchup has a threading mechanism
-
I’m trying to do lots of calculation that takes long time. So far it’s working fine with a progress bar although as soon as i click on another window sketchup gets frozen until the calculation is finished and i have no idea whether it will continue or i should restart the program...
Any ideas? -
As long as you make sure your calculation routine does not get caught in an endless loop ... Windows will bring the Sketchup UI out of "ghost mode" when your routine finishes.
The Dynamic Component package has a built-in check that will ask the user if they wish to abandon DC updates if it is taking too long. You can do a similar thing.
@timeout = 30.0 # some number of secs the user sets. t = Time.now.to_f
Then each loop check:
if (Time.now.to_f - t) >= @timeout break if ask_to_cancel() end # if
The ask_to_cancel() method would display a messagebox asking the user if they wish to cancel the calculation, and return true or false.
-
You could also try to see if using the UI.start_timer block method works for you.
This with execute the block immediately, and not repeat:
UI.start_timer(0.0,false) { my_calc_method() }
Advertisement