The #suspend method is called by SketchUp when the tool temporarily becomes inactive because another tool has been activated. This typically happens when a viewing tool is activated, such as when orbit is active due to the middle mouse button.
This method is automatically called within your Tool. You can write your code “inside” this method to be able to react as you desired…
Even you can design what will happen if the orbit tool “handling back the execution” to your tool with the #resume method.
_
_
I’m very far from that. I’m just an amateur curious person trying to observe the mysteries of Ruby in his limited spare time. I’m probably more advanced in learning than you are, but that’s it. Programming is not my profession.
Unfortunately for me, there are no background studies. I don’t understand or know a lot of things. I’m just trying to understand, for example, from what others are asking and answering here on the forum.
I started dealing with Ruby about 10 years ago. First, I studied the Ruby API documentation in depth:
https://ruby.sketchup.com/index.html
I mean, you have to read each method back and forth several times in detail. Then again.
Honestly, this website should always be open when you write a program.
In addition, since the SU Ruby API only contains SU special procedures, you need to know the general Ruby. The current Ruby version in SU2021 is https://ruby-doc.org/core-2.7.1/index.html (If I remember right in SU2018 the Ruby version is 2.2.4 and in SU2019 is 2.5.1)
Then I studied a lot of plugins (extensions) that others wrote. For example, you can start here with the “official” example: https://github.com/SketchUp/sketchup-ruby-api-tutorials
But there are many good examples e.g. here: https://sketchucation.com/pluginstore and there: https://extensions.sketchup.com/
Dan wrote a very good summary here: https://forums.sketchup.com/t/ruby-learning-resources-wikilists/22861