UI::Notification missing


Hi there,

I’m trying to use the UI::Notification to display messages during my script execution under Sketchup 2016 as described in the API (http://ruby.sketchup.com/UI/Notification.html). Unfortunately, when I’m trying to create a notification I always get this error message Error: #<NameError: uninitialized constant UI::Notification>.

When I’m asking the UI module to list the defined constants with the UI.constants command, I get this result:
[:Toolbar, :Command, :WebDialog]

Does it mean that only Sketchup 2017 is allowed to display notifications ? Is there any way to do this under Sketchup 2016 ?

Thanks for your answers/help.



UI::Notification was added new in SU 2017. You cannot use it in older versions. When you consult the Ruby API docs, always check at the top of the page for the Version in which they were introduced.


Thanks for your answer I totally missed the version compatibility at the top of the doc…

Maybe I’m wrong but I think I already saw notifications displayed prior to Sketchup 2017, if I’m not is what was the deprecated method to do this ?

Thanks !


Without a specific example, I’m not sure what you saw. The SU program itself could post notices, but that capability wasn’t exposed in the Ruby API before 2017. The available mechanisms were UI.messagebox or roll-your-own WebDialogs, neither of which work quite the same way as a real notification. Both of those (and the new in 2017 HtmlDialog) are still available, though WebDialog is deprecated as of 2017.


I was much more remembering of notifications that are displayed as a viewport overlay.
As you said, this capabilty wasn’t exposed before Sketchup 2017, I may remember aSketchup builted-in tool behavior.
Thanks for you explanations :wink: