Component List Renaming

I have finally mostly finished modelling our construction project this summer. I’d like to be as efficient and effective as possible in my Component naming scheme before transferring to Layout drawings though. I have applied as much logic as my limited SketchUp experience will allow in these Component names.

Here is an example…

Framing - Level Two Floor - 2X8 - Main Section - Joist#2

I’ve labelled everything in my model starting with the material type, in this example ‘Framing’. Every subsequent distinction is delineated with a hyphen. This model has several hundred unique framing elements, therefore several hundred components start with ‘Framing’. Is there a way to make a wholesale name change in my component library, say from ‘Framing’ to ‘Frmg’, affecting every single instance? There are several examples like this… of changes in my component names that I would like to make, some for the sake of abbreviation and some for clarification. I wouldn’t want to go through and do them all one at a time.

I can’t find anything within SketchUp to do this but perhaps someone out there has already created a routine that would sort this out? Any help would be gratefully received.

Profile Builder has a batch renamer. You could use the filter search in the Outliner panel to select the objects.
It does sound that you don’t have a hierarchy set up in the model. That is, you nest all joists in a group and assign that group to a Tag. That group can than be part of a larger group which has all the elements of a ‘level’ group and so forth.
There is always some redundancy in naming and currently, one can only select when doing a search in outliner (you can search and filter tags, but there is no easy native way to select ‘all on Tag’)

Thank you Mike. I will try this batch renamer today. Am happy knowing that there this in fact, a built in means of renaming multiple components at once. This will be a very useful tool for re-organizing my model’s component names.

I do have hierarchy set up in my model, and have nested components of up to seven levels. But I have nested components into ‘components’ and not ‘groups’. I will do a little reading up on the advantages of using ‘groups’ over ‘components’. When I first started with SketchUp 7 months ago, I watched a few YouTube videos on components and groups. Generally, the wisdom imparted in these videos was that ‘components’ should be used for anything that is or will be duplicated and that ‘groups’ should be used when an element or collection of elements is unique. But I have a large number of 1st level unique elements (a 2X4 or 2X8 that is used only once for example) and it didn’t seem appropriate to identify the collection of edges and faces in that one piece of framing as a ‘group’. I need to understand more about the distinction between ‘components’ and ‘groups’ and all the reasons for using one over the other.

Basically, this is true, however, to refine things, one should take in account the purpose of the model. Are you ‘visualising’ things or need the information to create cut lists? One could use the definition of a standard length 2x4 and scale the length only. This will take the number of unique definitions down and you could easily generate a report for the total length needed or grouped by length.

If you need to label the 2x4’s you would be better of with making components unique for naming (With some Dynamic Components magic, you could also use the length info to create labels…)
All that info could than be used in LayOut.

Mind you, the scaling does have effect when the geometry is more than the simple cube and you are adding miters etc. It kind of depends on how much you need modeling.

To Add, I do think the components need to be native profile members to use with the rename option in Profile Builder, I do not know of other extensions that do the same but I am sure there is one.

Check this thread as well, not for renaming, but for handling visibility of the objects in LayOut:

There’s some heady stuff in this reply. I’m going to have to spend some time digesting it.

Not sure I understand what you’re meaning here, or how to use it to my advantage in generating a report. When you say, ‘unique definitions’, is this the same thing as saying ‘unique components’?

I am anxious to begin creating Layout drawings from my model, but am thinking now that I’ve got a few more things to get sorted out in SketchUp first. John McLenahan has been an invaluable source of SketchUp wisdom. He’s now taken on the task of figuring out Layout as well.

It seems ironic that a 2D drawing is more daunting than a 3D drawing. Hopefully, I’ll be able to rectify that before our building window ends this year.

Thanks so much for your advice and tips. It is much appreciated. I’m going to see if I can follow the instructions for Ruby Console from this link and make that work.

Is this something what you are looking for?
Copy-paste the code below to Ruby console and hit Enter (Return)
Type the string what you want to replace and for what…
the first occurrence of string will be replaced in all definition names in a model
(You can undo it)

See animation (Click on it if not animating)
NOTE: I don’t think it’s going to go wrong, but it’s best to try a “non-live” model or have a backup.



def replace_in_comp_defname
  mod = Sketchup.active_model
  defins = mod.definitions
  prompts = ["original string:", "new string:"]
  defaults = ["", ""]
  input = UI.inputbox(prompts, defaults, "Change component definition name ")
  return unless input
  old,new = input
  mod.start_operation("Change definition names", true)
  i = 0
  defins.each{|defin|
    next unless defin.name.include?(old)
    defin.name = defin.name.sub(old,new)
    i += 1
  }
  mod.commit_operation
  "#{i} changes"
end
replace_in_comp_defname
1 Like

You are allowed to create one extension per day😀

1 Like

This is just a five-minute code snippet… :blush:

Yes, this looks like it might do the trick. Mike the SketchUp Sage already sent me the link. Coding is a little over my head. It’d be like learning Arabic or Klingon. I got a syntax error, after ‘copy and paste’ so obviously did something wrong. I’ll figure it out. Thank you Learned One.