|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
! D2 T. n5 B' {9 v6 i通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!* v* ^: u+ h- O! ~( n; P
这个类也可以实现设置组,角色,获取卷等操作!- l: C8 T P. ^# Z' D5 f N
# _3 m7 O( @; @( b2 ^
5 l# o) x% @9 m f$ m9 C
std::vector< NXString > GetGroups ()
0 R3 J w4 u$ f Gets the names of the Teamcenter groups to which the user belongs.
) P$ U; p9 ~% e 1 Y1 }. z; K5 M8 y! w/ I( g1 R: P
5 s; p) i- a3 Z: s
std::vector< NXString > GetProjects () + V) E6 T: |' O, l$ x3 X I
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. . v9 I! i2 l) t. E( s' x- U- U
; Z& C: }4 Y7 m: M) K6 { \ p' M" R9 m$ y. O4 U
std::vector< NXString > GetRoles () 5 N# P7 `4 F- f" t, C: D
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 7 C* A7 I8 q/ S% v! I
/ j% Q; D! a$ V$ W
+ C3 K3 V6 W! }6 d! i/ l' r; ^
std::vector< NXString > GetVolumes () - ] N- {* |6 P# n- r
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
: Y \6 x5 m! R
+ V: F( t4 _; @
% n# v) N+ j! v; B1 k, Z
' s! G5 B" L S9 f0 z8 xstatic void do_it(void)
5 S+ P% g8 J4 ?{
6 |8 g; F" i4 F1 g3 ? Session *theSession = Session::GetSession();
1 ?, G; r* _' y6 _/ b Part *workPart(theSession->Parts()->Work());2 z) H; B0 W0 h. }3 S X
Part *displayPart(theSession->Parts()->Display()); J3 |: F% V, K t% N7 W+ _$ m
3 c M9 j+ V9 h5 T2 m) L4 D
PDM::SessionSettings *sessionSettings1;: R4 p6 r% [& z1 M7 e
sessionSettings1 = theSession->NewDatabaseSessionOptions();1 ^. `3 F7 h& n
6 | w6 |* {4 ?" t
NXString CurrentGroup;. x+ ~1 C' O' \6 S
CurrentGroup = sessionSettings1->Group();) e' `5 u. j! n) ]9 h
9 ?/ M$ n! f2 i: Q# S: ?
NXString CurrentRole;$ j, J0 |. J% i
CurrentRole = sessionSettings1->Role();8 f2 r$ v& @9 V$ p6 v) r% \& S
& M8 n& ]$ _0 k2 J' M) D# X theSession->ListingWindow()->Open();
8 O) j( X+ E5 S) i : @/ d f0 V: M( v. i
theSession->ListingWindow()->WriteLine("Current Group: ");0 X0 m0 S) c @3 Z& s
theSession->ListingWindow()->WriteLine(CurrentGroup);; ^% c& Z0 J! c
7 _6 ~; B4 n6 B i
theSession->ListingWindow()->WriteLine("Current Role: "); / b5 P. ?& z; B7 F# @% A! Y; n
theSession->ListingWindow()->WriteLine(CurrentRole);
: r3 |- [+ p5 }: C v& O/ h* A m2 |3 u" d
}( V. p9 Z# g0 R* @" @
3 b. F) c% H( F) t4 M: P
" _0 [% ? V2 l2 N5 Y3 U
# ?0 {! G' N7 ^. t7 y |
|