Is there a method or extension that will change the definitions of multiple components, adding the #1 #2 #3, and so on, all at the same time?
For example:
“Select components” —> “Enter definition (Deck Board)” —> “add number sequence” —> “Deck Board #1, Deck Board #2, Deck Board #3” and so on.
Profile Builder(!
) has a built in ‘batch renamer’ for used Profile members.
There might be more, though…
A quick one…
(Edit: You can get as an extenison rbz file form post #9 : Change the definition of multiple components in bulk - #9 by dezmo)
Copy paste the code snippet below to Ruby Console and hit Enter (Return)
If your selection contains at least one componets you will get a context (right click) menu “Rename Definitions”
Click on it and you will get a prompt for Base name.
The definition names will be based on the Base name and will use the first available
“free” integer number “n” at the end of “Base name#n” pattern. (There will be no number at the end if the Base name is unique itself)
You can undo it.
The code was not tested extensively. USE YOUR OWN RISK! No warranties!

module Dezmo
module DefsRename
@@loaded = false unless defined?(@@loaded)
def self.rename_defs
mod = Sketchup.active_model
sel = mod.selection
defins = sel.grep(Sketchup::ComponentInstance).map(&:definition).uniq
return unless defins.size > 0
prompts = ["Base name:"]
defaults = [""]
input = UI.inputbox(prompts, defaults, "Bulk change component definition names ")
return unless input
basename = input.first
mod.start_operation("Bulk change definitions names", true)
defins.each{|defin|
defin.name = mod.definitions.unique_name(basename)
}
mod.commit_operation
"#{defins.size} changes"
end
unless @@loaded
UI.add_context_menu_handler do |context_menu|
if Sketchup.active_model.selection.grep(Sketchup::ComponentInstance).first
context_menu.add_item("Rename Definitions"){
rename_defs()
}
end
end
@@loaded = true
end
end
end
(Note: There vas a bug in SketchUp version: 2022.0.315 / 2022.0.316 which prevent to work this snippet properly. Make sure you are using latest update of SU 2022, or earlier versions of SU)
Don’t know how I didn’t know about this… But does it only work with profile members?
@dezmo you’re a boss, rolling that out so quickly. Am I missing something or is it able to create duplicate component names? That would be pretty bad, right?
Thanks friends! I’ll check these out!
Yes.
…to try.
No. All definition names will be unique. (Mind the note at the end of my previous post!!)
There are two instances of some of the same definitions on the example gif above…
Yes.
Perhaps you wanted to ask to change the instance nemes of the component definitions, based on the definition name by adding a number sequence at the end of the instance neme? Like this?

No no, you got it right. I just thought having a component name that was identical to another one, but not the same component was an impossibility. If I manually change the component name, it yells at me if it’s the same as another one.
Yeaaaa… Im on it now! Sorry!
Okay yea, it works like magic!
The snippet use the similar “logic” for renaming as a “Make Unique” does if you right click an other instance of same component definition.
If you want I can make - today or tomorrow - a .rbz file, so you can install it as “normal” extension…
Dezmo_DefsRename.rbz (1.4 KB)
Sweet!!! This will make my slothfulness in naming components a non-issue. Now, I just have to deal with my right click context menu being so long it doesn’t fit on the screen… So many extensions, and a lot of them I never use from the context menu, so they are taking up space for no reason.
Is it possible to change only a portion of a definition’s name? For example, I have toaster blue 1.0, toaster red 1.0, toaster green 1.0 and I just want to change the number at the end to 1.1.
This will help you with the numbering, but I don’t think it will change the name incrementally and leave the number the same.
Thanks for the reply, but I don’t think it works for SU2023. I installed the plugin and after restarting Sketchup I got this error:
Error: #<FrozenError: can’t modify frozen String: “GM::NumberComponent”>
c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_main.rbe:850:in <module:NumberComponent>' c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_main.rbe:13:in module:GM’
c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_main.rbe:12:in <main>' c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_loader.rbe:14:in eval’
c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_loader.rbe:14:in require' c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_loader.rbe:14:in module:NumberComponent’
c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_loader.rbe:13:in <module:GM>' c:/users/jdkoll/appdata/roaming/sketchup/sketchup 2023/sketchup/plugins/gm_numbercomponent/numbercomponent_loader.rbe:12:in ’
C:/Program Files/SketchUp/SketchUp 2023/Tools/extensions.rb:197:in eval' C:/Program Files/SketchUp/SketchUp 2023/Tools/extensions.rb:197:in require’
C:/Program Files/SketchUp/SketchUp 2023/Tools/extensions.rb:197:in load' C:/Users/jdkoll/AppData/Roaming/SketchUp/SketchUp 2023/SketchUp/Plugins/GM_NumberComponent.rb:83:in register_extension’
C:/Users/jdkoll/AppData/Roaming/SketchUp/SketchUp 2023/SketchUp/Plugins/GM_NumberComponent.rb:83:in <module:NumberComponent>' C:/Users/jdkoll/AppData/Roaming/SketchUp/SketchUp 2023/SketchUp/Plugins/GM_NumberComponent.rb:41:in module:GM’
C:/Users/jdkoll/AppData/Roaming/SketchUp/SketchUp 2023/SketchUp/Plugins/GM_NumberComponent.rb:40:in `<top (required)>’