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.
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
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.
This is amazing!
I’m drawing up a library of elements in order to use Quantifier Pro.
However, sometimes I only need to change the name of some of the components with partly the same name.
For example, I have 100 components with name ‘AA_L_x_y_z’ with x/y/z being variables.
I want to change 50 of them to ‘AA_P_x_y_z’. If I were to use this method in the same model, all 100 of them would change. So I copy the 50 ones I want to rename to a blank model, change the name, and then copy them back in the master model. The problem here is that the name changes back to the original name.
Any remedy for this would be very welcome.
I guess it is because SU somehow keep the internal reference of definition of the components.
Perhaps you can cut (instead of copy) then purge the component definition out from your original file then you can insert the components with modified componetinstances with new definition names.
OR
I modified the code snippet.
If there is no selection will work as before.
If there is a selection and contains componentinstance(s) it will replace the string in definition names of selected componentinstance(s).
If the selection does not contains componentinstance(s), will do nothing.
def replace_in_selected_or_all_comp_defname
mod = Sketchup.active_model
sel = mod.selection
if sel.empty?
defins = mod.definitions
else
defins = sel.grep(Sketchup::ComponentInstance).map(&:definition).uniq
return "No component selected" if defins == []
end
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_selected_or_all_comp_defname
I have some simillar problem I am trying to solve but it’s more focused on profile builder.
I have created some moldings with profile builder and I use the “generate as components” feature because I need to extract a cut list at the end with OCL.
My issue is that profile builder adds auto names for the generated components so the definition is something like “Group#”. It does add the profile name in the instance field but this does not help me. I am looking for a way to make profile builder create componenets using the profile name as the definition. Looking for a workaround is the reason I got to this thread, so this could be a workaround to have a script that can change the instance names.
Mike, I do ALL with OCL for woodworking, I still miss a couple of things (posibility of adding veneer similar to the edge banding beeing one of them) but it is the best tool so far.
I do have Quantifier Pro, bought it with PB3 as a bundle but for the life of me I can’t figure out how to use it, specifically in my workflow. I was planing to ask for help from Dale and his team.
If you are curios I can upload a model I’m working on and give you a quick tour of my workflow. maybe some of you guys can give me some improvement ideas.