|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
: F: U, z/ h# P$ f6 C通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!# x/ Z- j8 Y4 ?; a9 \7 B) w
这个类也可以实现设置组,角色,获取卷等操作!1 Q0 R& k* F/ O% d. J- h
, J, \! {: y# y* u- l
) X. F% Y; `3 s3 S
std::vector< NXString > GetGroups () 3 w f* g: y; M/ x3 ]- k
Gets the names of the Teamcenter groups to which the user belongs. * I- e( j' |# n& A
) R/ B) s/ S8 V8 w% X0 k3 h $ w+ v- T% G/ J$ @. c
std::vector< NXString > GetProjects () B j* L; `0 s1 F% N
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
* K- M! r1 ?# J. Q! D1 i& J
' ~3 m5 Q7 B1 z- o: a- z) \
( u3 X6 `( c/ t3 t f* z4 k6 B- Kstd::vector< NXString > GetRoles ()
8 t" D0 O% B, E |, L7 ?! A) b7 n Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
J$ b/ ~' P5 S" e) b, i * G! o; @1 m4 y3 X$ Y
6 g+ I0 e/ G y8 i3 N) tstd::vector< NXString > GetVolumes ()
R( G- V1 G$ N3 @& C u Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . 7 Y; s* m* B. ^, a6 C' F- p" o# Q
6 t; i, h+ z% \% Y' ]8 ? K; q# }% b8 J9 d/ V# o1 D
- Z1 b# S* g; d2 L u
static void do_it(void)
7 D" R" U5 r- f0 P. N{8 [8 @) L" O! v: x! u P) T" W
Session *theSession = Session::GetSession();
. v4 F% I# w8 @$ J& p6 R Part *workPart(theSession->Parts()->Work());* ?3 h% @, L" s8 F" |8 U
Part *displayPart(theSession->Parts()->Display());
- ~& u" e# \3 |
) W/ S# [% _1 m" A9 a PDM::SessionSettings *sessionSettings1;" M$ | ]( S4 _: k# ?" c: G
sessionSettings1 = theSession->NewDatabaseSessionOptions();
4 l& i9 u1 F' l9 n3 r % o2 T2 p2 U. Z, h( X3 j0 e
NXString CurrentGroup;8 h7 k3 z b E. ^2 ]
CurrentGroup = sessionSettings1->Group();
/ F& F$ s0 i" ~/ J D( b; | " e( t' |7 [5 K3 a& v+ A( l
NXString CurrentRole;! o8 ?% l# W5 ?2 i% D4 F
CurrentRole = sessionSettings1->Role();
7 }$ f% T/ N( v( O# B* \. Z: [+ Y3 v; Y7 j' Z4 U ?) K
theSession->ListingWindow()->Open();
# x) |; Q: u" V* X* l1 d# X + t) p( ^& y3 S0 E$ g7 u
theSession->ListingWindow()->WriteLine("Current Group: ");: U; w7 H4 e) A% r4 ?7 y$ d, w
theSession->ListingWindow()->WriteLine(CurrentGroup);* A0 q6 f( N8 ~5 q
Q, R9 ?) {# m+ ~/ d theSession->ListingWindow()->WriteLine("Current Role: "); 2 \2 X% \6 ~3 I6 o$ R) e* ?
theSession->ListingWindow()->WriteLine(CurrentRole);) I2 O# M% r- h k5 k
}' [) n, y( ^5 \# j4 q
}
7 A2 X0 X. x5 U9 z
; A, |; N5 j' m$ U
3 U' A9 i) v. O/ \ u
0 p2 ] h. s+ @6 m: H. Y. I8 C |
|