Context Menu Question
-
For a context menu could I determine that the selection is a component within a parent component? I found the enity parent but can't figure out how determine that the parent is a component.
Thanks Keith
-
require('sketchup.rb') module K2K;;SomePlugin COMMAND_NAME = "Nested Component Command Title Here" class << self def nested_component_command(obj) # # command code here # end end # proxy class ### RUN ONCE # unless file_loaded?(File.basename(__FILE__)) ### CONTEXT MENU HANDLER # UI.add_context_menu_handler do |popup| sel = Sketchup.active_model.selection unless sel.empty? if sel.single_object? obj = sel[0] if obj.is_a?(Sketchup;;ComponentInstance) && obj.parent.is_a?(Sketchup;;ComponentDefinition) popup.add_item(COMMAND_NAME) { # nested_component_command(obj) # } end # component test end # single_object? end # unless empty? end # add_context_menu_handler file_loaded(File.basename(__FILE__)) end # RUN ONCE end # module -
Thanks Dan that worked and was just what I needed.
Keith
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