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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement