I have several questions about the FindObject command:
Solved! Go to Solution.
1) "How does one parse the string..."
In general, you don't. The "journal identifier" is mostly for the journal recorder's internal use. This isn't to say that you cannot make use of it, but there are usually better ways.
2) "Is there any reason I should not use that field as a general identifier for lookup purposes?"
The journal ID is not guaranteed to be the same across NX releases. In other words, if you are able to "parse out" the value in NX 10, your code may fail when run in NX 9 or NX 11. I'd suggest using tags instead. There are many "wrapped" functions that will work directly with tags. If you need to use one of these functions, it will be easier to use tags than to convert between journal ID's and tags.
3) "When I navigate to the body in that component a find a body that has the same data, but it is not the same body, evidenced by a different tag."
The body in the part file where the geometry is defined is known as the "prototype" body. When you add the part as a component to an assembly, the assembly essentially creates a copy known as an "occurrence" body. Since a component can be added mutiple times to an assembly and each instance can be positioned independently, the assembly needs a way to differentiate which body belongs to which component instance. Therefore, each occurrence body will have a unique tag and each will be different than the prototype body. There are ways of getting the occurrence body if you have a reference to the prototype body (and vice-versa).
In general, you really should not worry about what the journal identifier string looks like, and you should only use FindObject in journals that you record and play back.
Here is the remark about this from the documentation for the FindObject() method on the Component class - the .Net API Reference - emphasis added:
"An object may not return the same value as its JournalIdentifier in different versions of the software. However newer versions of the software should find the same object when FindObject is passed older versions of its journal identifier. In general, this method should not be used in handwritten code and exists to support record and playback of journals. An exception will be thrown if no object can be found with the given journal identifier."
Okay, the name of the field had me suspicious.
..so I should convert journal usage of JournalIdentifier or FindObject(..) to one of the cycle calls.