Saturday, December 2, 2023
Home3D ModelingContext menu for particular entities - Ruby API

Context menu for particular entities – Ruby API


Is it doable to allow the context menu just for particular entities? It could be good if my customized menus confirmed up just for the entities I goal reasonably than all of them.

I see that the built-in SU context menus are per entity sort, so I wish to know if the identical factor is feasible utilizing the Ruby API.


By no means thoughts, this is very easy to implement. I solely should name context_menu.add_item if sure circumstances are met.

Additionally, a UI::Command that may activate a software, also can have a validation proc that solely permits the command to fireside (ie, activate the software or no matter) when sure circumstances are met.

Likewise a Software itself can have it’s personal customized context menu. See: Sketchup::Software#getMenu()
This latter sample is extra highly effective than the “plain Jane” UI::add_context_menu_handler() as a software’s context menu can also (since v2015) settle for flags, x, y, and view parameters.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments