Teamcenter中UID和对象之间相互转化

 TC中每个对象都有唯一的标识符,即UID

Teamcenter中UID和对象之间相互转化_第1张图片

RCP:

                

//根据UID获取对象
TCComponentManager manager = new TCComponentManager(session);
TCComponent comp = manager.getTCComponent("A5clPTwi4m5qKD");
System.out.println(comp.getProperty("object_name")); 

    或者

TCComponent dataset = session.getComponentManager().getTCComponent(uid);

    获取uid,每个TCComponent都有getUid方法

     dataset.getUid()

SOA:

      

/**
* 根据UID来获取ModelObject
* @param session
* @param uid
* @return
*/
public static ModelObject getModelObjectByUid(String uid)
{
    DataManagementService dmService = DataManagementService.getService(TcSession.getConnection());
    ModelObject modelObj = null;
    ServiceData loadResp = dmService.loadObjects(new String[] { uid });
    modelObj = loadResp.getPlainObject(0);
    dmService.refreshObjects(new ModelObject[]{modelObj});
    return modelObj;
}

       //ModelObject获取uid

        tempdataset.getUid()

ITK:

           ITK__convert_uid_to_tag (const char* uid,tag_t * aTag);

           ITK__convert_tag_to_uid(tag_t aTag,char ** uid);

 

你可能感兴趣的:(Teamcenter)