It’s been almost two years since I stopped my apprenticeship in Ruby and today I want to resume.
I am a beginner so please be lenient with me.
I want to send a window with a message only once if one or more components are present in my selection.
mod = Sketchup.active_model sel = mod.selection sel.each do |s| if s.is_a? Sketchup::ComponentInstance UI.messagebox("A component and present in the selection!") else UI.messagebox("No component is present in your selection!") end end
This method works but the problem is that it sends the message several times if several components are in my selection.
So how can I send the message only once even if several components are in my selection?
Thank you in advance for your help.