Unique ID of an Entities mesh

Hi, I need to get the unique ids for each element for an SKP file. I use SUComponentDefinitionToEntity function to cast the components and groups to get the IDs by using SUEntityGetID function. I use SUModelGetGuid to get the guid as a unique identifier for the model itself. The only missing part is the unique ids of meshes. I mean SUEntitiesRef objects which contains faces. Faces have their own ids but I need the one for the whole mesh itself. Moreover, these ids must be the same for each time I read the same SKP file, session based temp ids (like C pointers) are not ideal for us.

Could you please help how to get these unique ids?


I don’t have experience with SDK, and perhaps I’m wrong, but according to Ruby API, the meshes are abstract (PolygonMesh Inherits:Object) and does not have an id(s) like the face witch is inherited this properties from Entity…

1 Like

SketchUp does not have a model data type for meshes. They are just edges and faces joined together.

You should be using SUEntityGetPersistentID()

1 Like

Thanks for the answer. Can I use SUEntityGetPersistentID() also for older versioned SKP files?

For those file versions that supported them for the entity types as listed the model dB will have PIDs.

For those entity types that do not, you will get the NULL pointer return as stated in the docs.

FYI: The C API doc does not list the types correctly. There are 4 lists, but the doc has squashed them into one list.
See the Ruby API docs for better listings: Entity#persistent_id

As an example, a file written with 2017 will not have PIDs assigned to component definition, material, style or font objects.

1 Like