Component name mismatching during component save

Hi, SU Team!

There is one old, painful, and unsolved issue in the SU. When I rename (one or more times) my components during the construction process and then run “Save as local collection” command, sometimes (but not every time!!!) some components are saved with their old names. In case I have a new component with the same name as changed one before, this command saves one file over other without asking. The same result I got with copied and then modified and renamed components. To avoid this, I usually make a new component inside the old one to maintain axis orientation, select all old component’s instances and then explode the old component. That is very awkward process on large projects. The alternative is to save each component individually and rename them each time in “Save as” dialog, but it is even worse.

I do not understand why SU cannot link saved file names with components actual definition names. The last ones are unique within the file and the saved file names are the only reference for importing the right files into the Layout.

Is there a solution expected in the near future?

Can you share a component or two that shows this? That would be helpful in sorting out what’s going on.

There are a skp file and a screenshot. Main component is “tornis 1”, but SU offers save it as “siena 1”, what is its old name.

SU comp.skp (3.5 MB)

That helps. I see what you describe in your model although I’ve never seen this with my own components. Maybe someone from the SU team like @colin will be able see what is going on in your file.

This problem has been around for a very long time, at least since version 15, if not before, regardless of the computer I’m working with.

It’s odd because I’ve never seen this happen with any of my components and I’ve been using SketchUp since 2003. I wonder what is different.

I’ve never had that happen either. I’ve had the other issue, where I wanted to replace the component and couldn’t seem to get it to save over the old one.

What happens if you do the drag and drop method for saving components? Do you still see the name mismatch?

A component definition has two properties, the Path from which it has been loaded and the Name. Renaming the name does not affect the ‘Save As’ feature automatically.
(There was a fix in version 5~6, I believe, that dealt with inserting components with the same (file)name).
I believe it is by design, otherwise, the risk of self-referencing is too high.

Workarounds are, ‘Save collection’ , then iterate through that folder and alter the names of the files and then use this script:

USE AT OWN RISK…

How do you mean that exactly?

If I understood you correctly, this happens when you delete a component from a model but do not run the Purge Unused command in the component panel or in the Model Info → Statistics dialog, or run the CleanUp extension. In that case, it is understandable.

The method you describe is probably able to correct this flaw in the program, but by the way it is described, it is very time-consuming and complicated for large projects. For example, my current model has 1834 components (with subcomponents on multiple levels), where many are created and modified as copies of the same basic components as a plywood sheet, a piece of square tube, and so on. I believe that the only logical solution is to correct the operating principles of the SU engine, not to try to fix errors with different extensions.

But anyway thanks for the advice!

Do you still see the name mismatch if you open the secondary pane in the Components panel and drag the component from In Model to the collection?

Yes. If I put this new component in a model, it still will be saved with the old name.

When I drag the component you shared from In Model to a local collection, it keeps the name it has in the model. Do you see a different behavior?

Oh, you didn,t understand. The problem is only in the file names with which the components are stored during the batch process “Save as local collection”. On-screen names inside SU are always correct.

Oh I hadn’t remembered writing that example. But I do now that I look at it again.

You are correct, it brings up a prompt if there are non-empty Definition names and this would be a tedious operation for you.
So it would need to be modified to overwrite the name property with the basename of it’s filename.

But as Jack and the Trimble developers have said, the saved file pathname and the definition name property are two distinct and separate things.

However, I am now understanding that some users have a workflow where they want the two to match (even though the filenames don’t look as nice in the Components listing.)

I would support an option that such users could switch on in their SketchUp preferences (or Model Info) dialogs. (@jclements :wink: )

1 Like

The Save As name for a new component will be the in model definition name. The Save As name for a component that was loaded from an external file will be the same file name as the file you loaded. My guess is that if you are modifying a local collection component, you want all new files that use that collection to also use the modified version of the component, and you would intentionally overwrite the existing file.

The file you used to give an example came from:

C:\Users\gunti\OneDrive\Desktop\Dublinieši\Rasējumi\skp\Komponenti\Sienas\siena 1.skp

On Windows that then assumes you want to update the original siena 1.skp, and the file dialog has taken you into the collection folder. Funnily, on Mac you get a name of C__Users_gunti_OneDrive_Desktop_Dublinieši_Rasējumi_skp_Komponenti_Sienas_siena 1.skp, but again the file dialog has taken you to the component collections folder.

If you have a component that came from a collection or other external file, you could explode it and make a new component, with your new definition name. Then the Save As name will be the new name. Unfortunately, using Make Unique keeps the original loaded from path.

Short version of all that is that the name you might want to use defaults to the existing file name, if the component was created from an external file. Exploding/make new component, or saving as a new name are work arounds, that you already know about.

Perhaps there should be a Save a Copy… option, that would always use the definition name.

I am often making updates to components and it gives me a new component name as component-suffix for the component. so I will end up with several components with different suffix attached. I usually try to do as @DaveR suggests and drag it from the model window to the open component window.

Thanks for the reply, but that’s not the real problem! I know how to deal with this feature of the program, but I am not satisfied with it because it is illogical and time consuming.

By the way, the file I showed was specially created as an example, but the same problem exists in the original file, which is much larger, so I didn’t upload it here. Also in other project files.

Problems related to the inadequate operation of “Save as local collection” in these forums have been reported in the past, for example:

but have been left without a satisfactory answer.

I insist that this is a real and serious problem for users, and program developers must fix it in the future, not offer complicated ways to circumvent it.