GUID vs. persistent_id for Groups and Component Instances

It looks to me that for Groups and Component Instances (comps), the GUID is persistent

  • regardless of changes applied to the comp
  • across Sketchup sessions

Am I correct, or did anyone encounter situations where this is not the case?

The point is that, unlike persistent_id which was introduced with SU2017, GUID has been around since SU6.

my memory was it’s unstable on a mac, if user switches models before closing…

there was stuff on SCF…


I checked on Sketchucation, and the only thing I found is this post.

The only mention of Mac is for the Model GUID, which is indeed varying with the MDI framework when you change the current model document.

As usual, the reason I raise the point is to be sure that the preservation of GUID for component instances and groups across changes and SU sessions is a feature of the API, not a coincidental side-effect that may disappear in a next version.

The API documentation is silent on this preservation.

By the way, GUID were introduced for Groups and Component Instances with version SU2014. It is the GUID for ComponentDefinition that was already there in SU6.

According to the docs, the GUID changes when a component definition is changed. It is maybe more like a hash function whose value is unique for a specific state of an object.

I have not tested yet if all kinds of changes affect the GUID (contained entities, definition properties like description and behavior). And whether this is true also for component instance (or model) GUID.

For ComponentDefinition, the GUID changes whenever there is a modification of the content of the definition. The main issue is that the assignment of the new GUID is done after the commit_operation().

For Groups and Components, what I observed is that the GUID is persistent, regardless of any change on the object, even if you change its definition, add / remove geometry inside, paint it, change its layer, etc… So seems to act as a persistent_id.

Maybe they are not triggered for changes within the definition, only changes on the instance, e.g. instance description, instance transformation, assigned definition?

Apparently, this is not the case. They keep the GUID unchanged, whatever you do with them.

I’ve been using Group’s and ComponentInstance’s GUIDs forever in Skatter to keep track of the model hierarchy. I can confirm that these GUIDs are persistent between sessions.
I have never had any issue with it.

1 Like

Component definition GUIDs changes for every single change to a component. These are what defines whether components are the same or not, e.g. when copying between models.

Instance GUIDs were added later, maybe because Dynamic Components needed them for something, but I’m not sure. I view instance GUIDs as a sort of obsolete proto PIDs while definition GUIDs are at the very core of SketchUp.

EDIT: TT wrote in the SketchUcation thread the new GUIDs were for IFC exports, so my suspicion about DCs was wrong.