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

    Asking question and help

    Scheduled Pinned Locked Moved Plugins
    3 Posts 2 Posters 175 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.
    • kenK Offline
      ken
      last edited by

      I have 10 components or dynamic components that I load into a model more than once per model. I wish to add a toolbar, with an icon representing the component, such that I select the icon and the component is loaded into the model. Below is code that I have copied from another script. TIG's I believe, and thank you for not encrypting you plugins.

      I am wondering can the below code be change such that after selecting the icon, a component that I assign to this code is loaded. I wish to have a toolbar that I can add icon for the most used components. At the most 10 components.

      I have been looking at different plugins to see if I can find any code that would help, however, I haven't found any code that I can decipher that would help.

      I know that I can add the component to a template file. However, for some reason after modeling for some time, the component browser does not work, so this is my work around.

      Thank you in advance.

      if not file_loaded?(File.basename(FILE))
      toolbar = UI::Toolbar.new "Ken Tools"
      cmd = UI::Command.new("Plugin Description") { insertselectedcomponent }
      cmd.small_icon = "A_KenIconUse/Image to use sm.png"
      cmd.large_icon = "A_KenIconUse/Image to use lg.png"
      cmd.tooltip = "Tool tip text"
      cmd.status_bar_text = "Status bar Help text"
      toolbar = toolbar.add_item cmd
      file_loaded(File.basename(FILE))
      end

      Fight like your the third monkey on Noah's Ark gangway.

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        cmd0=UI::Command.new("Plugin Description") { insertselectedcomponent(0) }
        cmd1=UI::Command.new("Plugin Description") { insertselectedcomponent(1) }
        cmd2=UI::Command.new("Plugin Description") { insertselectedcomponent(2) }
        etc
        with corresponding icons for each command.

        Then in the method 'def insertselectedcomponent(num=0)' itself
        You look for 'num' with a case structure
        case num
        when 0
        comp="ABC"
        when 1
        compo="BCD"
        etc
        ebd
        Now you have a comp[nent] set by name.
        So you can load it etc using that...

        TIG

        1 Reply Last reply Reply Quote 0
        • kenK Offline
          ken
          last edited by

          TIG

          Thank you for the reply.

          For some reason yesterday, I couldn't get back on this site.

          Ken

          Fight like your the third monkey on Noah's Ark gangway.

          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