Get Instance Path By Entity Pid

Hi, all. I am trying to use SDK to retrieve the instance path from the model. For example, I want to retrieve the instance path of a component instance. I first upcast component instance to entity using SUComponentInstanceToEntity. Then I get the entity pid by using SUEntityGetPersistentID and it returns an int64 type pid. Next, I want to use SUModelGetInstancePathByPid to get instance path. However, it requires a SUStringRef type as pid input. I am very confused here. Could anyone please tell me is this the right way to get isntance path??

Thanks a lot!


This is a topic where the documentation need better clarification. And we have open issues to address this,

First of all, let me clarify some ambiguity in how Pid is referenced.

When you ask for the PID of an entity, you retrieve a persistent ID across sessions for that leaf node. This by itself have no means of identifying where in the model (it’s instance path). It is impossible to fetch a path from a leaf as there can be multiple paths using a given entity. (Due to component instances)

In order to reference a specific entity we need to keep track of its parents. This can be represented by for instance an SUInstancePathRef or a “PID path”. You can convert between the two.

A PID path is what SUModelGetInstancePathByPid expects. This is a string in the form of:


And example could be:


SUModelGetInstancePathByPid Will take this and return and SUInstancePathRef. So it’s not actually resolving the instance path for you, it’s simply converting the PID path in string form to a data structure.

The Ruby API is actually a bit more specific in saying “Persistent ID Path” to distinguish from “Persistent ID”:

The question is then, what do you need the instance path for? And in what context?

Thank you for the reply!

Basically, I want to export skp format to a customized format. And I need to get the hierarchy of component instances so that i can get the transform of each component instance. So is there any easy way to get the hierarchy of the model? Thank you!

Have a look in the snippet of this post: Retrieve position of face vertex in global frame of reference

Thanks a lot!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.