First of all, thank you for creating this extention - I’ve been wondering for some time if there was an easy way to locate materials that may not be needed. I finally decided to make a run to the Extension Warehouse to look around and found this one.
After I installed the Eneroth Material Usage Inspector extension, in attempting to see how it worked, I immediately ran into a problem with the very first material I wanted to check out - the Inspector returns [entity?] names that I don’t know where or how to find or identify.
I found no group/groups in the Outliner with a number. I even tried the filter, typing “Group#149,” which returned nothing. I then just tried to enter “149,” but again, nothing. There IS however a “Group>>Component#14,” and when I clikked on it, SU went right to it…but that was not the right entity.
Fig 1: There are many “Group” in the Outliner list, but they have no numbers.
Fig 2: There are several “Group” in the list with a plus sign by them, but even when I open them up, there will be more, again with no numbers
Fig 3: There are several entities with names that had plus signs by them. When opening them, I found “Group” listed under those, also with no numbers.
This is a quite quick and not very polished extension. It works nicely on components but with groups it shows the group definition name, which to my knowledge isn’t necessarily the same as the group instance name shown in the UI.
The extension merely goes through all definitions and doesn’t make any difference on whether they are currently placed or not.
Eneroth’s extension iterates all defitions in the model (file), regardless if being used (eg. You might have deleted items that still reside in the component or material ‘library’)
Purging would get rid of all components and materials (Styles and Layers, too) if you go to [menu] Window->Model Info->Statistics and hit purge.
Another extension to inspect materials and resize them if to large is Material resizer:
These are unfortunate aspects of SketchUp’s handling of groups:
you cannot assign a name to the group’s definition, it automatically gets a sequentially numbered name such as “Group#123”. There is nothing anyone can do about this.
unless you manually assign a name to a group instance, the outliner will display it as simply “Group”, omitting the number
So, @eneroth3’s extension is giving as much information as possible under the circumstances but that info is inadequate to be of much use to you.
Maybe someone could write up a script that adds labels to all of the groups in the model so they can be identified. Or maybe it could write ‘Group#123’ into the Instance field. That would at least make Outliner a little bit more useful for groups.
From what I see, if the Instance field is blank, Outliner only displays the word Group. If the instance field is filled, Outliner shows that instead of the word Group.
Sketchup.active_model.definitions.each{|defn|
next unless defn.group?
defn.instances.each{|inst| inst.name = defn.name }
}
makes the Outliner displayed instance-name to be the same as the deep-down definition-name - which is used for component.
To make the instance-name to be the group’s definition name, with your own inflection, use:
The extension could check if the definition is for a group and in such case print the name of the first instance (groups are made unique when renamed so it can be assumed all instances have the same name) but I haven’t gotten around to do it.
For the time being this snipped can be used to help identify a group by definition name. It lets you place out a new instance of the group so you know what it looks like and easier can find the group you are looking for. Just change Group#1 to the actual group definition name.
I think that the Outliner should display item info the same for both.
Also recently had a discussion on the API issue tracker about whether Images should allow instance naming. (So it’d be nice if image names would appear in the Outliner too. The workaround is to wrap an image inside a group or component.)
Well…this thread flew right over my head with all the tech talk of snippets, UIs, APIs and one-liners. Whew…LOL!
Anywhoooo…
Actually that model is not mine, so I really dunno all of what’s in it - it appears the owner used mostly groups, though. I have learned to purge my models and remember to do so now more than when I first started uploading models to the 3DWH a few years ago. I also have an extension called CleanUp3 installed on SUM2014.
But what I really wanted @eneroth3’s extension for was, sometimes I end up with 2 or 3 instances of the same material, but they might have different names. For instance, I might end up with an entity that had a material in it labeled “black,” another entity might contain a material labeled “Color_009” or “0137_Black.” I don’t need all three and prefer to apply just one no matter where it’s needed, but I can’t always find where each one is located. In the past I have thought I tracked down everything, delete one and later discover areas where a colour is missing.
I guess if I do use a Group on occasion, the trick for me would be to remember to make it a point to open Entity Info where I could give the group a name after it’s been created …which then in the Outliner, “Group” would be replaced by the name assigned in Entity Info
After I began learning more about and experimenting with components, I create more of them today than I used to. Chances are, I can probably successfully use @eneroth3’s extension - especially on my later models, my future models and perhaps on models I’ve downloaded if the owner of those models worked mostly with components.