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!
🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
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
Advertisement