Showing results for 
Search instead for 
Did you mean: 

Unique Identifiers for JtkPart/Assemblies/Instances

Valued Contributor
Valued Contributor

I'm currently searching for a unique identifier for JtkParts, JtkAssemblies and JtkInstances.

This identifier shouldn't change if someone modifies the object and also be accessible with the JT Open Toolkit.

When I do a detailed dump of my files with the jtinfo utility it get an output like

JtkAssembly: "ArbitraryName" (Id=189989, version=88)
BBox: [-118.8,-75,-37.422] [270,185,156.95]
# Properties: 19

I haven't tested it, but I strongly assume this ID is the same, I'd get if I execute this code

JtkHierarchy* partPointer = something;
int id;

But what worries me is the function description which says

InstId - The 32-bit integer instance identifier value associated with the node. 
Note, if the user has not explicitly set this value, the toolkit will auto-generate a unique identifier and return this value.

What if the program that saved the JT file decided not to attach an ID? Am I guaranteed that the JT Open Toolkit always generates the same ID?


Or is this note just valid if I created a Jt-object with the toolkit and didn't assign an identifier?


Since the documentation says that it's a unique ID, I'd rely on this. But how do I know when and how this value will be changed by a CAD program?


I'm also wondering why some JT files have totally arbitrary IDs whereas others are enumerated.


(The functional description of the JT Open Toolkit also introduces the concept of GUIDs which are in the UUID format, but they represents the state of a JtkXTBody, so it changes every time a change has been made.)



I just noticed that one of my JT files just features "0" for all IDs according to the jtinfo utility.

I'm assuming this utility uses the same getID(int& id) function that is exposed in the toolkit. So shouldn't it create at least some IDs while traversing through the file?


And since the name can appear multiple times, it's not possible to rely on that feature as well.