sketchucation logo sketchucation
    • Login
    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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [Need help]How to add several rb_files to a sub_menu

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 312 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.
    • W Offline
      wikii
      last edited by

      My target is adding every plugins that I wrote to a certain sub_menu.

      I try to add codes as below to every rb files.But it sames that only the first loaded rb file can add item to the menu correctly.

      
      if !$my_menu
      	$my_menu=UI.menu("Plugins").add_submenu("My_Tools")
      end
      $my_menu.add_item("some_string") { some_code}
      
      

      I test following code in a rb file.It works well.

      
      a_menu=UI.menu("plugins")
      a_menu.add_item("print") { p "1"*10 }
      
      

      But when I run each line of following in Ruby Console.It does't work at all!

      
      a_menu=UI.menu("plugins")
      a_menu.add_item("print") { p "1"*10 }
      
      

      It is a puzzle to me.
      😞

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        I think it can only be done when SketchUp loads. Once SU is loaded, you can no longer add items to a submenu. That has been my experience. And I have problems somtimes where my plugins will still split themselves up into 2 "Chris Fullmer Tools" submenus. So putting all .rbs into the same submenu is do-able on loading, but still a little buggy I think. I don't know if SU was designed to wokr like that.

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • W Offline
          wikii
          last edited by

          Thank you!
          I tested it.As what you say ,when sketchup initialize , my rb files can add themself to the same submenu.

          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