Right Click Menu Items
- 
 I’ve noticed with some plugins that when you create something within them you can then right click on the object and plugin specific items are shown in that menu. I would like to do something like that for the truss and foundation plugin where a user can right click and then be shown the option to edit the roof or foundation assembly. Can someone point me in the right direction for adding this type of functionality. 
- 
 Here's a simple example from part of my SectionCutFacetool's code.
 That tool actually ONLY works from the right-click context-menu, when there's a suitable selection...### Setup Context-menu unless file_loaded?(__FILE__) UI.add_context_menu_handler{|menu| if TIG;;SectionCutFace.ok() menu.add_item( "#{MENUTXT}" ){ TIG;;SectionCutFace.new() } end ###...etc...### } file_loaded(__FILE__) end #unlessTo explain the parts a little... 
 TheTIG::SectionCutFace.ok()method returnstrueif the current selection contains just one Section-Plane.
 TheMENUTXTis a Constant which I had set up earlier - so it can involve translations etc - you could just use a text-string.
 If that context-menu item is chosen, then theTIG::SectionCutFace.new()method runs [using the selected Section-Plane]...
 You can simply replace bits with your own methods etc.
 You can add several possible methods, each with their own 'tests', which can have multiple hits etc if needed...
 You can also add a menu item based on your tool-name, and add commands into that as they become appropriate - just like you do in the top menu bar with a sub-item set up...
- 
 Thank-you for the example and explanations. 
Advertisement


 
                             
                             
                             
                             
                             
                             
                            