Toolbar editor - Unable to add icon for ruby code

HI.,
i am trying to add an icon for the ruby code in the toolbar editor plugin by @Aerilius.
But unable to add the icon in the tool bar.
What is procedure, could anyone help?
Attached here the below screen shot, which i did so far.
Thanks

  • Was the command action not added properly or just the icon image? What happens when you click the empty toolbar button, does it run the code?
  • Is the file format of the image supported by SketchUp? If create a minimal toolbar button directly with SketchUp’s Ruby API, does it display the image?
    Paste into Window → Ruby Console:
    toolbar = UI::Toolbar.new("Test")
    cmd = UI::Command.new("Test") {
      UI.messagebox("Hello World")
    }
    cmd.small_icon = cmd.large_icon = UI.openpanel("Select the icon image")
    toolbar = toolbar.add_item(cmd)
    toolbar.show
    
  • Is the file path string not correctly saved/loaded or passed to the Ruby API? Does the file path contain spaces or special characters?
  • Is it due to SketchUp toolbars being immutable once they have been created (plugin description says some edits take effect after restart)? Does the icon show up when you restart SketchUp?

Hi
@Aerilius Thanks.

The icon image doesnot added properly. There is no clickable action in the tool bar

The file format is png. is there is any restriction for the image file in terms of size(kb) & size( pixel or dimension width x height)?

The code provide works perfect. adds a tool bar, and image with clickable action & Msg box pops out when clicked.

I hope you mean the image file path, which is loaded correctly, with forward slashes. No Spaces and special characters.
Now the only one button is added and works. unable to add other tool buttons. Even after sketchup restarted, the newly added toolbar icon missing in the existing tool bar.
pls Advice

The documentation for UI::Command#small_icon= tells you …

Small icons should be 16 x16 pixel images for best display quality.

The documentation for UI::Command#large_icon= tells you …

Large icons should be 24 x 24 pixel images for best display quality.

SketchUp will downsize or upsize the images to fit, but they could become blurry.

Thanks Dan :+1: