|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
4 F! t! O! Z5 W5 u通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!1 F3 {% }: a3 z3 p. j
这个类也可以实现设置组,角色,获取卷等操作!
. @; I( V) C8 L7 ` l" ^5 ^( G8 e h% O: T8 h8 \- k
9 F2 r* ^9 Q- T0 Ystd::vector< NXString > GetGroups ()
1 g9 _! d1 q0 }$ `6 T Gets the names of the Teamcenter groups to which the user belongs. 4 H- I5 f5 | ]& H F b
. q( W6 B' e; _2 }+ P S : j$ R/ w' S$ }' r% s! v# g
std::vector< NXString > GetProjects ()
: m. S5 F! N9 k' f0 | Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
7 C0 ~ T* f4 t& r* w; u0 \! M 2 `1 P6 l4 g( m* V
; z0 y( A2 l5 D4 H. y* J7 Lstd::vector< NXString > GetRoles () 2 z# E% r( {; q6 h9 b+ }4 t
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
. l* j/ P+ G2 w( a8 l9 x* v R $ { q$ h ~7 a/ Q/ G7 t7 W9 j h
* U l! z2 }9 P7 F( V% l: V- Z4 b
std::vector< NXString > GetVolumes () 6 a5 H* A4 A& M q! ?5 u
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
% I/ p: C5 N- y. k, b8 W$ P: g7 j+ Z# n& T% p
: _, g4 F/ B3 J2 Q7 Z
9 y- W3 @) g/ N6 U Estatic void do_it(void)
3 ^; |* _& H$ N8 K" e{, l% P c2 S$ o, p7 e. m( J \
Session *theSession = Session::GetSession();9 o8 L* f% h# _4 u
Part *workPart(theSession->Parts()->Work());# @1 `. y. e% u" M3 E( J! k
Part *displayPart(theSession->Parts()->Display());3 S0 T' t+ m* \+ E8 F, O8 K) v
. t0 R( L7 J6 S8 Y. \: w5 L6 D
PDM::SessionSettings *sessionSettings1;
3 u' y" q- E+ M+ j) d# |+ [ sessionSettings1 = theSession->NewDatabaseSessionOptions();8 `+ Q! b$ d* f+ P- Y( o8 ]& q
" B. h1 P0 i& _& V7 ^ NXString CurrentGroup;# C$ V5 A4 Y* R, e+ n* w( B
CurrentGroup = sessionSettings1->Group();" \+ F( k. @5 z9 i; \
; S" o/ u$ m, m6 K NXString CurrentRole;
8 H; v- v1 C1 h CurrentRole = sessionSettings1->Role();
" o4 x! |( Z3 ^' [! R0 O% x9 s2 }
; [3 z: }0 Z5 v& W theSession->ListingWindow()->Open();6 A: m# T; m9 e) F9 D* O0 d, T% Y) W
! K1 |& w% V5 G m! S theSession->ListingWindow()->WriteLine("Current Group: ");) \# E, R$ W4 z g# m
theSession->ListingWindow()->WriteLine(CurrentGroup);
5 F: q) k- p2 m5 }9 _
4 E& `7 C6 ~& t9 b( u theSession->ListingWindow()->WriteLine("Current Role: ");
6 c; T* Z$ f) P; t/ k theSession->ListingWindow()->WriteLine(CurrentRole);
9 X" N' U- K w) _9 U: Y, r3 O% n
9 D. a- I. P' I$ W}& L) C/ f: {/ F, g) H) n6 Z" P/ n
' m8 `" O7 H, C# u! d- t) k
. @( g% J, N0 [) t2 U' U, l
+ M, Z) _. U9 E7 ?
|
|