|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组- d3 O; d) K$ s1 ^
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!( n: L/ p3 C! [$ S3 r- z/ A: _% R6 T
这个类也可以实现设置组,角色,获取卷等操作!4 @3 w) s) {+ o& J6 |- q# u) }6 x
; ?& O4 C9 X2 U" U, I/ {8 p, }
. W J' h0 Z+ C; o' o/ b0 n2 K estd::vector< NXString > GetGroups () 1 }5 g4 ?1 h( V8 }) v: L0 @/ F
Gets the names of the Teamcenter groups to which the user belongs. + B5 h" |/ K6 P* f1 T
# i+ Q b$ A% f3 A# Z 9 R/ a' ]$ c4 ~" ~" D" c" ^
std::vector< NXString > GetProjects ()
i/ R: _" C$ B! B Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
8 m: ?9 I9 J! o( C' f : A/ s, W# J3 d- G! G- s
# d O# ~/ } r/ V- b/ X
std::vector< NXString > GetRoles () T. U4 M( b" l$ Y5 ]
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
( |, L7 ?8 @* g. F) T& {' v 5 ]9 E; v; h0 r1 y$ q& f$ f
1 [4 @+ D: f# b( Z0 K, r
std::vector< NXString > GetVolumes ()
& g% @) o6 J( k0 ~ d* j/ l* X Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
* b+ J3 r( ~" n
+ V2 M: F# v5 M/ e( u& ?' {7 G U
4 x5 O2 B. o$ A
* D3 e) c0 k, J1 ^3 h ustatic void do_it(void)
! w: S" {' k6 ]4 S$ g+ y$ M, O{
2 x! @( }+ m) [; N; A7 F Session *theSession = Session::GetSession();
: n- k* x$ ?' Z5 b3 n0 r6 a8 y Part *workPart(theSession->Parts()->Work());
" U! V" a; O1 ~% G# D5 s Part *displayPart(theSession->Parts()->Display());' \( j$ s* v" k$ E `
. c0 p. V5 w8 ? PDM::SessionSettings *sessionSettings1;7 q9 a$ w8 b. Y2 y, D1 p
sessionSettings1 = theSession->NewDatabaseSessionOptions();
( W' y% ]6 y0 k- i
( v$ t5 x2 z' A' O: ]; i NXString CurrentGroup;
7 }( b" G5 ^. z: B CurrentGroup = sessionSettings1->Group();: E8 [% k) F+ T6 M! [
" H: m6 m; g$ g NXString CurrentRole;$ u: }7 r3 B% d# k
CurrentRole = sessionSettings1->Role();
$ D, l0 e' L' x# N( t" J/ s0 R3 E# @+ i6 Z' X
theSession->ListingWindow()->Open();- t9 E) ^: B: m8 y# u4 z
% c, M o4 h, g9 _4 K6 C& l2 Q# M theSession->ListingWindow()->WriteLine("Current Group: ");+ S8 B1 p* w( t: u1 I. C
theSession->ListingWindow()->WriteLine(CurrentGroup);
! ?1 L1 `; X5 b+ S ) x! n% p+ r$ c; u9 Q( |* B) r k
theSession->ListingWindow()->WriteLine("Current Role: ");
% [9 }; q1 G9 B, Y. u9 h- E theSession->ListingWindow()->WriteLine(CurrentRole);
2 @" J G) N- x+ c7 d- K% I M& o3 _& x+ y" Y
}
1 T8 J- y# N8 D! P8 J( ~; t# F0 b1 a: k( U1 |, f g2 S( [8 ]: y$ p
# R: p: b" M6 q( r- A+ J" D* ~' K
|
|