|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
8 |; b4 N2 M& H& c! r. u通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!6 U. W- l0 L* R9 h- g8 C4 Y
这个类也可以实现设置组,角色,获取卷等操作!3 |7 M4 D- {% `6 V: F
2 H2 w0 C& @: V/ S/ u# ~
+ C% g! s: x0 w9 E* o4 @std::vector< NXString > GetGroups () ' g8 g% _0 t5 a% j3 r8 C
Gets the names of the Teamcenter groups to which the user belongs.
/ W8 Q" ^- A* U/ {
2 i) t* x" W/ Y; Y" K& Z5 d" q * J: ?/ w$ ~( I& t
std::vector< NXString > GetProjects () ) ?+ {) f4 ^, V0 q, z3 z
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. ) ?4 z m0 {& Y9 a- C$ A2 p% O. _3 ?" Z
) [1 C3 G5 ^# F
' ^' O' ]1 \5 istd::vector< NXString > GetRoles ()
9 S" L5 d# v5 \8 E# A4 ~$ h* M Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
2 `) X6 H0 z4 s6 \7 A$ h/ d. g
# S8 }! D9 H8 }8 Q: o : m% N0 {3 M+ I5 m
std::vector< NXString > GetVolumes () $ J6 j( L3 n+ C1 g
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . + _. v. @% s; f# g- D! S% e
+ {' K( q& ]: E9 \* I
, U9 d4 z K1 e! J# W9 m) `0 r
- \/ }, v% X8 w5 L, Estatic void do_it(void)1 y j4 p- N! b. H3 V0 }
{
- t5 G5 L: y5 d. o1 h2 L# U Session *theSession = Session::GetSession();8 y) Q. w& Z, H( S- i
Part *workPart(theSession->Parts()->Work());
8 D9 ^$ |! B5 |2 x( V/ v* s Part *displayPart(theSession->Parts()->Display());
9 ~( ?& h) W( [7 i( ?( ~; ?7 v
' a' @! e" x3 E9 D: `1 @6 F8 b' D. A PDM::SessionSettings *sessionSettings1;. v9 P3 ~: v! d
sessionSettings1 = theSession->NewDatabaseSessionOptions();. }( U' ~) C2 C: }* j! ^
) P/ ~( t1 D$ `& R6 j8 g3 K NXString CurrentGroup;
( Y2 t8 m0 `; c# k% M. P4 ` CurrentGroup = sessionSettings1->Group();
p- F8 P# R1 ?
h% O2 f) e0 K% v NXString CurrentRole;) p, m( |0 i @& k2 S/ K
CurrentRole = sessionSettings1->Role();
0 [) U* `+ J* z, Q' i" K- L4 I% x) P
theSession->ListingWindow()->Open();
. ]% |7 | M i" n( m' v" _, e! `2 k
! c( @4 v0 k, N/ E2 P theSession->ListingWindow()->WriteLine("Current Group: ");
0 O- G8 D5 m$ C; K- D$ Z theSession->ListingWindow()->WriteLine(CurrentGroup);& o/ h) c, Q1 c5 n7 g _
" n5 E9 h; d4 z! I theSession->ListingWindow()->WriteLine("Current Role: "); ) J3 K1 ~& t2 ^
theSession->ListingWindow()->WriteLine(CurrentRole);& p/ m7 m8 p1 z4 O- A
2 ~* L" d. G, l" _8 \. Q! S% ]0 w
}$ _" u% ?! V9 q- y) ^
1 {& a' U- Q$ c* N8 K+ F& V" H) J R- z2 q& u
! z7 K0 ?- ~% `. b7 Y4 L4 m) \
|
|