Add icon to plugin
-
I'm trying to add an icon to a plugin but I can't make it work and I see no errors on the Ruby Console. Can you help?
Thanks in advance!require 'Sketchup'
filename=File.basename(FILE)
if not file_loaded?(filename)
UI.menu('Plugins').add_item('Container creator') { JGV_FVC3.container_creator() }
end#Toolbar test
if !file_loaded?("Container.rb")
#Container creator toolbar
FV_project_tb = UI::Toolbar.new("FV JGV")
#Container creator command
cmd3 = UI::Command.new(("Container creator")) { JGV_FVC3.container_creator() }
cmd3.small_icon = "containersmall.png"
cmd3.large_icon = "containerbig.png"
cmd3.tooltip = "Inserts a container"
FV_project_tb.add_item(cmd3)
end
#End Toolbar testfile_loaded(filename)
module JGV_FVC3
def self.container_creator
...
-
I think you need some extra lines to actually show your toolbar:
require 'Sketchup' filename=File.basename(__FILE__) if not file_loaded?(filename) UI.menu('Plugins').add_item('Container creator') { JGV_FVC3.container_creator() } end #Toolbar test if !file_loaded?("Container.rb") #Container creator toolbar FV_project_tb = UI;;Toolbar.new("FV JGV") #Container creator command cmd3 = UI;;Command.new(("Container creator")) { JGV_FVC3.container_creator() } cmd3.small_icon = "containersmall.png" cmd3.large_icon = "containerbig.png" cmd3.tooltip = "Inserts a container" FV_project_tb.add_item(cmd3) if FV_project_tb.get_last_state==TB_NEVER_SHOWN FV_project_tb.show elsif FV_project_tb.get_last_state==TB_VISIBLE FV_project_tb.restore end end #End Toolbar test file_loaded(filename)
-
Thanks kaas. It works like a charm.
Advertisement