Keeping control over very long tasks
-
Hi to all,
I was wondering if there was a way to give back control to the Tool message loop when performing a long calculations.
To be clearer let's assume you have a piece of code that may take a long while to process. Assuming it is executed in the context of a Tool, it seems that you cannot catch any event while it is processed (such as getting a key or click down). This may be because Sketchup is monothreaded.
I tried to call iteratively each piece of processing in a Start_timer call, but this does not work (in addition the usage of Ruby continuation, callcc, does crash the program).
If you start a seaparet thread, it does not work either (it seems that Skecthup API cannot eb executed ina separated thread).If anyone has an idea, that would be helpful. It is a pity that Sketchup does not have a method for that!
Thanks
Fredo
-
I've had no success either. I guess its because if you look at how its recommended to embed Ruby in an App, its a very simple ruby_run() model. So SU may be multi-threaded or not, but the call to Ruby is a busy wait.
Pretty much the only thing that does work is spawn a Ruby thread that twiddles the Sketchup.set_status_text

Adam
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement