Is there anyway to block interaction of user by Ruby?

When I interact with Sketchup (like pan around or click anything) while there is a piece of ruby code running, Sketchup will said not responding. So to avoid not responding, I wonder is there anyway to block interaction of user until the code finishes running?

While Ruby is running, it blocks the main event loop of SketchUp. The not responding message comes from the OS when it detects that the main event loop is blocked. There is nothing that can be done to prevent this.

2 Likes

Thanks for the fast reply!

BTW I’m pretty sure it is done that way because otherwise a running Ruby script and the user (via the GUI) could try to make simultaneous incompatible changes to the model. At best, chaos would result. But very likely SketchUp would crash!

Is this your own Ruby code ?

Yes, it is

Are you using a model undo operation with the disable_ui flag set true ?

Yes, I know the disable_ui flag. But it doesn’t block the user interaction.