|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
1 }) B/ f# u1 o) _- b通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!7 K; }! I2 F X/ o! N. P
这个类也可以实现设置组,角色,获取卷等操作!' m- D2 }7 Z3 s5 Z! N2 c0 b
1 D+ v8 x$ B8 I" D0 ]
5 J+ u/ F! a- M3 Cstd::vector< NXString > GetGroups ()
5 P6 n9 [6 ~* Z/ \7 J Gets the names of the Teamcenter groups to which the user belongs.
% U6 w: F. ^: `
8 V" T4 I5 r; Z4 G) q
6 k# @7 S' R! _+ j1 f) astd::vector< NXString > GetProjects ()
) F! P. n5 E: y5 A Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
6 S8 {( ?( u* E
/ \( N ~( e* g
4 a$ F9 U7 b# ustd::vector< NXString > GetRoles ()
) e0 P5 a' x: S& q Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
- x" u2 }- A3 l( X 9 _$ v0 I& _3 z( ^ E
% X( F* d- M; e+ `4 g' o% cstd::vector< NXString > GetVolumes () : k/ P0 q/ B6 r! ~* A
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
1 W) w" ~' e. A( D
" R4 e/ @6 {4 F: w# F) U
% \& {- \; E- i) B: A2 _
! G- k |" W# @$ N( ]: k) C, c. G& Fstatic void do_it(void)
3 U" e& e$ e) `3 o0 P{
* Y' s) i% H" D' J/ q, q" ` Session *theSession = Session::GetSession();$ g. H1 I5 @" I# ]" o; L3 t7 J
Part *workPart(theSession->Parts()->Work());
; t+ V* B, k. c" ]/ Q6 `2 E Part *displayPart(theSession->Parts()->Display());
, [0 s$ v: q6 L& ]4 n6 y$ x
2 ^3 v1 q0 f8 p* g2 z2 t8 P3 H PDM::SessionSettings *sessionSettings1;! ^& x( Q" I" v% ]+ d! `
sessionSettings1 = theSession->NewDatabaseSessionOptions();+ F3 v' J$ W m) d" R% v
% C5 ~0 P/ Q7 s4 O2 Q" U NXString CurrentGroup;
4 U7 R. i" M$ J3 A. C6 _8 Z CurrentGroup = sessionSettings1->Group();
' M( ^7 a1 w7 q 4 x- b& P$ R* G
NXString CurrentRole;
$ p5 Q t5 O0 k1 e% N$ ~ CurrentRole = sessionSettings1->Role();9 o! c7 B& x! u0 O J
. n+ d* Y- X1 J. k |2 _
theSession->ListingWindow()->Open();
5 [; V B) t% v, {
% [+ A! P" f7 }" y" z4 ^' z3 Y9 m theSession->ListingWindow()->WriteLine("Current Group: ");" z- A3 A( T, I O J- R/ k, b9 p
theSession->ListingWindow()->WriteLine(CurrentGroup);* B5 }, A0 i I$ h4 z/ Q% `' ~/ g
+ v) `8 D) H: X3 w0 K' K4 @ theSession->ListingWindow()->WriteLine("Current Role: ");
- r8 Z" L' ]" N* J% e9 p theSession->ListingWindow()->WriteLine(CurrentRole);
& J# ?+ P) _) ^5 P& O. w; a* |: _* E1 @7 z
}
" z3 j7 ], X% e: A
) t; F5 F" I7 M
9 J1 Q' _* o9 `; t. d5 y. l/ |, w+ r/ P$ E) L$ s! `( W
|
|