How to initialize an object from the string representation of its reference in Windchill ?

How to initialize an object from the string representation of its reference in Windchill ?

Add Comment
1 Answer(s)
  • The principal string representation of references in Windchill :
<class>:<key> : string representation of an ObjectIdentifier.
OR:<class>:<key> : string representation of an ObjectReference.
VR:<class>:<key> : string representation of an VersionReference.
  • Snippet code to dereference these strings :
import wt.fc.ObjectIdentifier;
import wt.fc.PersistenceHelper;
import wt.fc.ReferenceFactory;
import wt.fc.WTReference;

/* ObjectIdentifier string to WTPart */
ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier(“wt.part.WTPart:20154“);
WTPart part = (WTPart) PersistenceHelper.manager.refresh(oid);
/* ObjectReference / VersionReference string to WTPart */
ReferenceFactory rf = new ReferenceFactory();
WTReference ref = (WTReference) rf.getReference(“OR:wt.part.WTPart:20154“);
WTPartpart = (WTPart) ref.getObject();
ReferenceFactory rf = new ReferenceFactory();
WTReference ref = (WTReference) rf.getReference(“VR:wt.part.WTPart:20153“);
WTPart part = (WTPart) ref.getObject();
Answered on September 9, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.