Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
Programing menu icons
-
Can anyone point me to very simple examples of menu icons, and tell me what to look for. The following is the code used for my menus, is this where I begin to add code to set up the use of icons?
unless file_loaded? File;;basename(__FILE__) add_separator_to_menu("File") UI.menu("File").add_item("Select Component") {hdt_sel_comp} file_loaded File;;basename(__FILE__) end -
Hi,
If you mean a toolbar, here is a typical code block:
arcs_tb = UI;;Toolbar.new("Arcs") #declare the toolbar object cmd = UI;;Command.new(("Arc-Circle; 3 Points")) { Arc3pts.tool } #create a new command object 'cmd' that launches the tool within the {} cmd.small_icon = "3parc2.png" #set this new command a small icon image (users sets this in the preferences dialog) cmd.large_icon = "3parc.png" #set this new command a large icon image (users sets this in the preferences dialog) cmd.tooltip = "Draw an arc or circle with 3 points" #create a tooltip when hovering the icon arcs_tb.add_item(cmd) #add the command 'cmd' to the toolbar objectYou can put the toolbar code (for instance) after your menu settings:
if (not file_loaded?("myScript.rb"))
menu = UI.menu("Plugins") my_menu=menu.add_submenu("my submenu label") my_menu.add_item("Here we go !") { cmd_to_launch }...
...
arcs_tb = UI::Toolbar.new("Arcs") #declare the toolbar object
cmd = UI::Command.new(("Arc-Circle: 3 Points")) { Arc3pts.tool } #create a new command object 'cmd' that launches the tool within the {}
...
...
file_loaded?("myScript.rb") -
Didier, Thanks, This will speed up access to one of my tools.
Addenda: Wow, that was too easy to do.
Advertisement