admin 发表于 2014-11-4 21:07:30

NX二次开发源码分享:报告当前teamcenter是两层还是四层



NX二次开发源码分享:报告当前teamcenter是两层还是四层
static void do_it(void)
{
    logical IsManagedSession = FALSE;
   
    UF_is_ugmanager_active(&IsManagedSession);

    if(IsManagedSession == FALSE) return;

    Session *theSession = Session::GetSession();
    ListingWindow* lw;
    lw = theSession->ListingWindow();

    NXString connectString;
    NXString discriminator;
   
    theSession->PdmSession()->GetTcserverSettings(&connectString,
                                                &discriminator);
   
    lw->Open();
   
    /********************* uncomment to see the string values

    lw->WriteLine("connectString: ");
    lw->WriteLine(connectString);
   
    lw->WriteLine("discriminator: ");
    lw->WriteLine(discriminator);

    lw->WriteLine("Note:Empty string indicates 2-tier");
    *************************************************************/

    const char * discriminatorString = discriminator.GetText();

    size_t sl = strlen(discriminatorString);

    if((int)sl < 2)
    {
      lw->WriteLine("This is a 2-tier session.");
    }
    else
    {
      lw->WriteLine("This is a 4-tier session.");
    }
   
}



页: [1]
查看完整版本: NX二次开发源码分享:报告当前teamcenter是两层还是四层