The SU 2023 Outliner has some quirks that sometimes interfere with GTD (Getting Things Done!), as discussed here:
Summary
One of these matters of funky business is the number of clicks it takes to Rename Groups (the quintuple L-click). Here I’ve tried to create a work-around in the form of a Toolbar extension. The extension creates Groups from selected components and prompts for a New Group Name. This avoids clicking the Group in the Outliner in order to rename the Group. It is also available from the R-click context menu.
Group Namer:
Select components and press the Group Namer Toolbar button. A Group will be created and a prompt will pop-up asking for a “New Group Name”
Input the new group name and press “Enter” or “OK”.
The new group is then created and can be undone using Undo or Ctrl+z.
Context Menu view:
For those who might like to try it (Caution… danger… et cetera):
Registration Code
###########################################################################
# Copyright 2023 IDK_Programming
###########################################################################
# Group_Namer - "As-Is" / "Use at Your Own Risk" Disclaimer
# By using the [Group_Namer] SketchUp extension ("the Extension"), you acknowledge and agree to the following terms:
# 1. No Warranty or Guarantee: The Extension is provided "as is," without any warranty, express or implied. The creators, developers, or distributors of the Extension make no representations or warranties of any kind concerning the functionality, accuracy, reliability, or suitability for any purpose of the Extension.
# 2. Limited Liability: In no event shall the creators, developers, or distributors of the Extension be liable for any damages, whether direct, indirect, incidental, special, or consequential, arising out of the use or inability to use the Extension, including but not limited to damages for loss of profits, data, or business interruption.
# 3. User Responsibility: You are solely responsible for the installation, use, and consequences of using the Extension. It is your responsibility to evaluate the Extension's compatibility with your specific SketchUp version, system configuration, and other relevant factors.
# 4. No Support or Maintenance: The creators, developers, or distributors of the Extension are under no obligation to provide support, updates, or maintenance for the Extension. They may, at their sole discretion, offer support or updates, but this is not guaranteed.
# 5. Indemnification: You agree to indemnify and hold harmless the creators, developers, or distributors of the Extension from any claims, damages, liabilities, or expenses arising out of your use of the Extension.
# 6. User Acceptance: By installing and using the Extension, you indicate your acceptance of these terms and conditions. If you do not agree with any part of this disclaimer, you should immediately uninstall and cease using the Extension.
###########################################################################
# TESTED IN SKETCHUP Pro 2023 (VERSION 23.0.419 64-BIT) on WINDOWS 11.
###########################################################################
require 'sketchup.rb'
require 'extensions.rb'
module IDK_Programming
module IDK_Programming_Group_Namer
PLUGIN_NAME = "Group_Namer"
# Plugin information
PLUGIN_ID = File.basename(__FILE__, "Main.rb")
PLUGIN_ROOT = File.dirname(__FILE__)
PLUGIN_DIR = File.join( PLUGIN_ROOT, PLUGIN_ID )
unless file_loaded?( __FILE__ )
LOADER = File.join(PLUGIN_DIR, "Main.rb")
EXTENSION = SketchupExtension.new( 'Group_Namer', 'IDK_Programming_Group_Namer/Main.rb' )
EXTENSION.creator = "IDK_Programming"
EXTENSION.description = "A toolbar extension that creates a component group, with a prompt for a group name."
EXTENSION.version = "0.1"
EXTENSION.copyright = "IDK_Programming"
Sketchup.register_extension(EXTENSION, true)
file_loaded( __FILE__ )
end
end
end
###########################################################################
# Acknowledgements: Useful contributions from SketchUp Community Forum:
# @DanRathbun
# @Dezmo
# Any errors are the author's alone.
Main
module IDK_Programming
module Group_Namer
extend self
@@loaded = false unless defined?(@@loaded)
def create_new_group(selected_entities)
model = Sketchup.active_model
# Start a new operation for undo
model.start_operation('Create New Group', true)
begin
# Create a new group
new_group = model.entities.add_group(selected_entities)
# Prompt for new group name
new_group_name = UI.inputbox(['New Group Name'], [''])[0]
new_group.name = new_group_name
new_group
rescue StandardError => e
puts "Error creating group: #{e.message}"
model.abort_operation
else
# Commit the operation (undo point)
model.commit_operation
end
end
unless @@loaded
cmd1 = UI::Command.new("Create and Name Group") { create_new_group(Sketchup.active_model.selection.to_a) }
cmd1.small_icon = File.join(File.dirname(__FILE__), 'Icons/Group-Name.png')
cmd1.large_icon = File.join(File.dirname(__FILE__), 'Icons/Group-Name.png')
cmd1.tooltip = "Group Namer"
cmd1.status_bar_text = "Create and name a new group of components using a prompt."
cmd1.set_validation_proc {
if Sketchup.active_model.selection.grep(Sketchup::ComponentInstance).first
MF_ENABLED
else
MF_GRAYED | MF_DISABLED
end
}
UI.add_context_menu_handler do |context_menu|
if Sketchup.active_model.selection.grep(Sketchup::ComponentInstance).first
context_menu.add_item(cmd1)
end
end
toolbar1 = UI::Toolbar.new("Group Namer.")
toolbar1.add_item(cmd1)
toolbar1.restore
@@loaded = true
end
end # module Group_Namer
end # module IDK_Programming
IDK_Programming_Group_Namer.rbz (11.8 KB)
Thanks to those who have previously helped me and provided examples! @DanRathbun @dezmo