sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Add icon to plugin

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    3 Posts 2 Posters 289 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      Gonvaz
      last edited by

      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 test

      file_loaded(filename)

      module JGV_FVC3

      def self.container_creator
      

      ...

      1 Reply Last reply Reply Quote 0
      • K Offline
        kaas
        last edited by

        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)
        
        1 Reply Last reply Reply Quote 0
        • G Offline
          Gonvaz
          last edited by

          Thanks kaas. It works like a charm.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement