SU file created with Ruby API is "dirty" the first time it's opened

By “dirty”, I mean it needs to be saved, as if I’ve modified something. There’s an asterisk next to the file name in the title bar of the window. So if I open the file, and immediately try to close SU, or open a different model, it prompts for saving. Even though I’ve done nothing to modify it.

I’m not certain exactly what you mean by “created with the Ruby API”. Perhaps you could explain more fully?

But anyway, I’ve seen models immediately show as modified on open when an extension observer does something such as add an attribute it needs for its function.

In one model, I execute an extension (which I wrote) that uses the components in the model to create a new model that gets saved to a file. Then control returns to the original model. If I close Sketchup, and then open the newly created model, it shows as modified. It doesn’t do that for other files, so I don’t think it’s that observer thing, but that’s worth investigating. Thanks.

Something I have noticed since version 23 is that the OverlaysManager is a model collection that is modified if any overlay extensions are loaded and the model had never been opened before.

Once saved, if the state of the overlays did not change since the last time the file was opened, then the members of the OverlaysManager collection would not be modified, so the model’s #modified? flag would also not be set true.

You could do a test with a newly created model, by opening it in a pre-overlay version say 2021 or 2022, and see if the model’s #modified? flag is set or unset.

Yup. That was it. Open the same file with SU 22, and it’s not marked as modified. What would “any overlays extension are loaded” include? The only extensions I have loaded are ones I’ve written myself (and I’ve never used overlays), and 3 authored by Sketchup: Add Location, Dynamic Components, and Sandbox Tools.

1 Like

The first thing you can do is open the Overlays panel and see if any extension attaches an overlay object to the model.

FYI, the text below the overlay name is actually the "Extension: #{extension.name}".


Of the 3 distro’d extensions, I know that the new “Add Location” extension uses a map pin origin icon overlay. Which is too large and beyond annoying.

This is why I switched off this extension myself, also as I do not use geolocated terrain.

I tried disabling all 3, but still get the same behavior. It’s not a big deal, but I expect my users will ask about it.

True, you cannot control what overlay extensions the user(s) may have enabled.