mildcat 发表于 2014-9-27 21:10:30

UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组

UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
这个类也可以实现设置组,角色,获取卷等操作!


std::vector< NXString >GetGroups ()
Gets the names of the Teamcenter groups to which the user belongs.


std::vector< NXString >GetProjects ()
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.


std::vector< NXString >GetRoles ()
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .


std::vector< NXString >GetVolumes ()
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .



static void do_it(void)
{
    Session *theSession = Session::GetSession();
    Part *workPart(theSession->Parts()->Work());
    Part *displayPart(theSession->Parts()->Display());
   
    PDM::SessionSettings *sessionSettings1;
    sessionSettings1 = theSession->NewDatabaseSessionOptions();
   
    NXString CurrentGroup;
    CurrentGroup = sessionSettings1->Group();
   
    NXString CurrentRole;
    CurrentRole = sessionSettings1->Role();

    theSession->ListingWindow()->Open();
   
    theSession->ListingWindow()->WriteLine("Current Group: ");
    theSession->ListingWindow()->WriteLine(CurrentGroup);
      
    theSession->ListingWindow()->WriteLine("Current Role: ");   
    theSession->ListingWindow()->WriteLine(CurrentRole);

}



页: [1]
查看完整版本: UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组