|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
8 F2 G, _; G } F% d4 x! z1 B通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!6 @' t3 Z+ V8 l# o
这个类也可以实现设置组,角色,获取卷等操作!
" }) ]# \3 b: @) M9 z' [- p' ^! h9 z0 t" z! I) b
; j: }2 {8 O7 y5 {& hstd::vector< NXString > GetGroups () ) V: f M1 J9 t) j- n
Gets the names of the Teamcenter groups to which the user belongs. + T6 y+ O4 O+ O- y' E+ j3 Q
3 S: ^0 P4 b% n: T
) s0 S. i- d6 b z6 B, ustd::vector< NXString > GetProjects () ( B) ?( L4 }4 A: s9 o" T0 c
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. ) z6 o7 d8 `+ c- S1 W) V+ L8 u' J
7 P, o* l' o7 `! P6 i& O6 E
+ u7 s: {/ H9 r7 \% u. D
std::vector< NXString > GetRoles ()
/ G) ~5 l! d) b Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
- {. D" l. a3 l, G1 g4 d 7 D8 Q! B/ a- V9 h% J. Y
; q! w" y2 f2 z& N# Q% sstd::vector< NXString > GetVolumes ()
6 Q; k1 v1 c' ^7 l% A2 J% N Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
( R f+ E# p) q# @ A" |
( l( {) B7 A& g6 j: {3 N6 o- t
6 Y# _) P$ l4 w9 v* a
% m+ ~. c7 B% bstatic void do_it(void)9 r9 G+ j! C0 S* E% x' X
{3 v, B2 k8 {" O$ c) B5 D
Session *theSession = Session::GetSession();5 D; [! }2 J: S: L3 J: D
Part *workPart(theSession->Parts()->Work());
; N/ j9 m8 p: C0 l Part *displayPart(theSession->Parts()->Display());7 e9 {' j/ v. Z
2 b m) ]8 ]. l0 q PDM::SessionSettings *sessionSettings1;' x$ I$ j7 S J& O& S
sessionSettings1 = theSession->NewDatabaseSessionOptions();
+ L# ]6 R7 ^ j+ C4 C2 F
" M8 v+ U; R$ I. z: G2 h& u/ u( R5 Z NXString CurrentGroup;; N( c& r2 Z/ `8 s# j
CurrentGroup = sessionSettings1->Group();
9 e& D: Y6 f. ?1 D0 c
4 o2 \1 A4 @/ p! j, Q NXString CurrentRole;# i7 d/ ?% q2 P9 v1 ~! D
CurrentRole = sessionSettings1->Role();
3 Y6 Z6 X9 D- `( G( D1 E0 Q! l
. {9 H+ Z. R. N6 ]5 V theSession->ListingWindow()->Open();
5 C/ Q) a& l7 U& @! H5 [& ~ 2 \. v: B: L# h& E5 e: Z: S
theSession->ListingWindow()->WriteLine("Current Group: ");% |) D& u% k) c! S+ m
theSession->ListingWindow()->WriteLine(CurrentGroup);* F g9 }3 O% m, V
- x5 \8 A* z: p) U* f
theSession->ListingWindow()->WriteLine("Current Role: "); 0 H z# ?% U1 Q- M7 W3 ?
theSession->ListingWindow()->WriteLine(CurrentRole);
6 h" K( {" _* p% I7 g2 g2 a' y% J5 n* Q* P2 r8 S
}
5 B% U! R* L, W. y4 t' x1 G! n. o
6 x2 x f" N; d4 d" c( g$ |
8 s# n8 w5 K4 L# ^( V$ x0 Z) [ |
|