|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
! Y$ N V2 _& i通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
! O3 h v/ Z' B, |/ i0 s Q$ a这个类也可以实现设置组,角色,获取卷等操作!$ K. V9 U$ C; _/ y6 q' R, ~
G' u' o/ `/ _; s
# v& ^! t" H& g7 R s8 \5 e
std::vector< NXString > GetGroups ()
! D6 e/ H, {; e" }" t Gets the names of the Teamcenter groups to which the user belongs. 5 R9 w9 |3 S4 l# ?- A
" q" e$ n4 I; B: c& D7 }; t, }
4 o/ Y0 ^, G' a! l2 X9 |# o: dstd::vector< NXString > GetProjects () , r, t. Q7 C9 ], q; V1 ]/ G
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. - Z3 o5 N) r/ a Q! z- n3 H$ z
% g1 |& {0 L& P, A6 B- ~1 f& { % u; ^- K+ i7 c9 F# M; g7 b4 h
std::vector< NXString > GetRoles ()
w1 {5 ]* Z( j Z' a7 B1 R Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
* N% Z D- q% @8 n 9 E; `: w& K9 o! `
& g: s9 w& g* Y3 a5 g/ A2 B$ i
std::vector< NXString > GetVolumes () 5 J: u5 h6 `+ t, A% m% d
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . ! f( W6 {6 c+ l* e |; b
$ ?; U- `+ n' S, Q% Y
& S t5 t, \% m# ?1 V6 H
7 a+ ^. T3 d: n! \3 wstatic void do_it(void)0 q. `& X- r+ }; `9 w% R
{
# d! x6 S8 o, G( l Session *theSession = Session::GetSession();
% W, r8 E( U+ @8 S Part *workPart(theSession->Parts()->Work());. h% L* d8 F% Q/ O- o' h& @
Part *displayPart(theSession->Parts()->Display());( u* U4 J0 R; ] w
! j& i) L4 [) i- t3 Y/ T# M# }$ ^
PDM::SessionSettings *sessionSettings1;
, T R! f5 Z/ }/ v" u5 @) B2 x- H sessionSettings1 = theSession->NewDatabaseSessionOptions();
$ h" P7 V! F2 p" j1 s, b
* `" E1 o) C7 ^; q6 ?: m! `7 C/ z( m) ? NXString CurrentGroup;3 V! Z9 z! n/ e8 k' r
CurrentGroup = sessionSettings1->Group();
9 z; t# q$ V( V$ Y& G' B3 { # _ X) v, Y" r1 m9 y
NXString CurrentRole;
, k. t3 a3 j/ K; p+ D* P0 P CurrentRole = sessionSettings1->Role();- x' j- Y; R' o+ n2 L! M* q
r, S0 j' p' a) E+ G; O$ @
theSession->ListingWindow()->Open();
3 B+ h) Y1 n8 s
9 c4 [+ T' q* J+ _% O. |( \4 Y theSession->ListingWindow()->WriteLine("Current Group: ");
0 w/ K* c9 u( Q4 q# p5 O% | theSession->ListingWindow()->WriteLine(CurrentGroup);3 ?" R& |! r( B2 E
1 P7 e" e3 L, f1 \' b, h theSession->ListingWindow()->WriteLine("Current Role: "); # W3 I6 k4 P% r9 H4 R+ d5 X! P& X
theSession->ListingWindow()->WriteLine(CurrentRole);5 A# l7 {; L3 `" C
4 b5 h' Y$ G$ S' S% `}/ Z, Q' q0 z. T: J9 c. ]) S
! J9 x/ _) v" c+ d
6 i; A Q3 E4 w
3 [; \* U6 U, y0 g2 S |
|