|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组/ l* f+ C K/ w9 A( n1 C
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!* T, ]: y2 x0 f5 k' O. }6 T
这个类也可以实现设置组,角色,获取卷等操作!
5 p4 ]: I! L" R# H# L2 \* r* A3 }9 t3 q2 J q4 O
% c" L8 C3 S! h6 w! }4 N6 k0 Ustd::vector< NXString > GetGroups () ! Y: E9 J4 o0 s! Q
Gets the names of the Teamcenter groups to which the user belongs.
4 B2 q+ b9 ]) c, B% l6 A 1 C4 D6 U" N; r/ _" ~
; I# k! L0 r0 V1 b4 b' V
std::vector< NXString > GetProjects ()
! S. T+ r8 I1 y) g! [) E Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
; S+ M' k1 x( z, I. {
9 e! b" D0 k# p% r
! K( V$ B2 g0 D' E: x8 }9 Ystd::vector< NXString > GetRoles ()
; |' E' Z- A. w) P; s Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
1 S6 k( R z' b2 ?; K# p 4 S6 o( X4 }7 k7 q* N# y, s
; R/ ^- V2 V) E( V% Xstd::vector< NXString > GetVolumes () - B, P" H& H5 f( i, k+ n
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
u' N) h. R& ?1 C X9 O
Q: \3 t) g7 Z" @ w
; N: X! @$ ?& p# @; ]
, ]: V/ T1 M' E( Y; L: |! ~, Tstatic void do_it(void)
: h$ t( h0 x$ H; {/ g{
$ `3 _* x* a5 R- x: [( r; W* r) w6 j Session *theSession = Session::GetSession();
- E& @. s7 W, v+ \/ p9 Z Part *workPart(theSession->Parts()->Work());
( m) I7 @# Y% Z V Part *displayPart(theSession->Parts()->Display());7 V7 c' ?2 r! r& x% `
3 f+ p+ g' m7 M# H0 g1 N, `& z PDM::SessionSettings *sessionSettings1;7 c3 F8 n( e+ z4 c; V4 s- B+ R
sessionSettings1 = theSession->NewDatabaseSessionOptions();* L' j1 @' u3 o7 S
$ _# q' D" S. u& k NXString CurrentGroup;5 |" D0 x2 m0 E( A
CurrentGroup = sessionSettings1->Group();
! Y: u6 [# d: D3 ~5 X Y ]7 e6 p N# u. U# c( E, ]
NXString CurrentRole;% }( q! H. `, G; x( N2 L: U4 X# u2 ^
CurrentRole = sessionSettings1->Role(); X7 {. X, e6 O: n! |
, p9 I. V3 Y4 g, p% ~: v
theSession->ListingWindow()->Open();
' o' F& O% t* B; C& h) M8 V 3 n5 @7 p0 w+ }6 G0 r! Y
theSession->ListingWindow()->WriteLine("Current Group: ");% L" O" D# I* l2 r
theSession->ListingWindow()->WriteLine(CurrentGroup);/ @' o2 n7 b9 v; L6 o2 \
; M: a+ ~7 {% p2 V! j theSession->ListingWindow()->WriteLine("Current Role: ");
z+ S k; A# q4 n1 k9 J. N4 s3 v+ ^ theSession->ListingWindow()->WriteLine(CurrentRole);
. a1 b5 `! K% ~! W; h) C
/ ^" k2 `. ] F}
" |5 l& O! p! h4 ]. ]
' {- ?- n( }# W4 G
- s: ~( q0 w0 p* m
$ H+ U* `. `: U$ I: A |
|