UGNX二次开发源码分享:Teamcenter集成环境下,报告角色和组 + g2 g7 S4 C+ u, F( ?. S. H通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色! 6 z: j, E' y+ t' f: u3 _( k+ k) M这个类也可以实现设置组,角色,获取卷等操作! : \5 R. P0 R& O$ v& B/ X) Z: T, q! I& I
: P- P7 E2 ]% X9 @( T; ?* w
std::vector< NXString > GetGroups () 8 k! D0 }- s4 ]3 c' T
Gets the names of the Teamcenter groups to which the user belongs. 9 L! |* G' v, o/ H8 W4 S1 I9 _ ! o1 q- K- Z3 E8 U
! ]8 T; Z9 ?2 V, Y: E4 ]( |" E
std::vector< NXString > GetProjects () - `+ e5 d+ p! K! L8 ~# V5 D
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. * B+ v$ S1 k& G* t2 S 8 J# r5 {4 v% F
0 Y4 k; |: n2 d
std::vector< NXString > GetRoles () 0 {$ Y0 P9 E9 L Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 3 C5 N) q* y6 }+ ^
6 \+ N# Q) ~* i" h: b % S5 @1 }- f) M7 m6 y1 N6 ?std::vector< NXString > GetVolumes () 0 M( ^( T( Q2 s
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . % c3 G8 j$ I5 v
, i' _% c! `) E: m7 ?: w8 C/ C+ R7 p 1 b) o+ Y( G1 R- ~% ~3 o5 d+ B5 J; ?9 E# d4 f
static void do_it(void)) H- C- Y! m; L/ r
{$ m% x2 X/ N3 b4 D* H. a6 ?/ G
Session *theSession = Session::GetSession(); 3 j6 @2 C( l" U8 c, U3 R# Z Part *workPart(theSession->Parts()->Work()); 8 S7 E9 v! `2 d- i5 ^ Part *displayPart(theSession->Parts()->Display());; L: @- B9 j @) r
' K: l; r; v4 {0 Y. m2 O; e PDM::SessionSettings *sessionSettings1;& {6 ?. v4 d" t' ?$ C
sessionSettings1 = theSession->NewDatabaseSessionOptions(); ! ? ]5 V0 K% s; x- O) y: `- L7 Z- j E5 Z % }% x7 U: x K& w NXString CurrentGroup; : p! `! l( Z0 i& f3 Y, L CurrentGroup = sessionSettings1->Group();; | I6 L8 C# c( R
% `; G$ Z: r" I9 |! W$ a+ u
NXString CurrentRole;" {5 Q% @( m! M* e$ Q3 t
CurrentRole = sessionSettings1->Role(); 1 T- t' k$ L5 {7 Q" D5 N/ ^ R. P9 _8 j
theSession->ListingWindow()->Open();/ C- h! V" Q8 |8 D0 W% c
! y% {$ E, h N4 y2 U6 } theSession->ListingWindow()->WriteLine("Current Group: "); 9 T: {6 J# @9 H theSession->ListingWindow()->WriteLine(CurrentGroup); ) w0 R L4 L$ g! d5 p4 U% j: u& R; P ) }8 B* S0 e1 `6 S6 v) m4 X4 U
theSession->ListingWindow()->WriteLine("Current Role: "); / ^6 D( l5 {1 C3 H theSession->ListingWindow()->WriteLine(CurrentRole); : u V0 p3 [9 S1 l/ z1 X ' [4 f: q7 L, c1 N6 p}: b' p4 K# D6 W4 {
, C: h, R& w" o7 ~/ G, t" m& t * T6 n/ H" `2 c$ l" x, O% U k( w C8 Z4 x7 z' j