[Need help]How to add several rb_files to a sub_menu
-
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.

-
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
-
Thank you!
I tested it.As what you say ,when sketchup initialize , my rb files can add themself to the same submenu.
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