|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
+ t# [; |, j8 ]- @7 f5 i7 o通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!5 z* D, M. y' |; o# j0 u [1 Q
这个类也可以实现设置组,角色,获取卷等操作!
; V Q/ ?2 C0 j. n/ e: G5 |( {2 t! I9 z$ p( s; _
% h5 N, g5 [& W7 b. Sstd::vector< NXString > GetGroups ()
- d" [9 b6 ^( R4 i) s* v Gets the names of the Teamcenter groups to which the user belongs.
7 H7 G9 E0 A6 B* v4 C " v& Q' X, m0 u0 [* Q& L2 l' \ [) X3 y
- n( c7 A9 C9 D5 Y' h* f: U
std::vector< NXString > GetProjects ()
3 n) V: [/ X8 H Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
& Q1 ~' B* M2 i6 |. ?
( n# D: t) p& c $ C, Q3 ?& {4 {( I
std::vector< NXString > GetRoles ()
9 L% S7 `- z# g( B/ ^* h9 ]1 r* s2 r Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
2 [* r, L% {, Z* V Y0 K& E
& f2 T5 G0 A8 _9 P0 P
$ e6 K) r0 R {) H; @9 T8 E k, ^std::vector< NXString > GetVolumes () * D9 [1 a: z6 {+ p2 [( ]
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . " _) l) k, k: s# w
4 B& \ Y$ X+ a0 T8 n- V
! I. e+ z% g9 q8 g3 ~
1 E6 o) |( }5 P' Tstatic void do_it(void) T8 q, ?5 k" B2 }
{' T( r4 k$ A5 W, X; \
Session *theSession = Session::GetSession();
3 F7 r u+ J, D4 O3 E Part *workPart(theSession->Parts()->Work());
& z, v# X3 | z- M# o1 u Part *displayPart(theSession->Parts()->Display());
6 {4 m: O! `: G4 G9 E: ` ' L' S" ]7 a* T) d2 _+ B. d0 `
PDM::SessionSettings *sessionSettings1;
& t+ w- E Q1 |/ b" z3 c7 ~1 B3 V sessionSettings1 = theSession->NewDatabaseSessionOptions();: L; Q5 a. E) _% ?. J# w" f
" e3 l& n& W& w NXString CurrentGroup;2 p3 g7 o4 ]$ u" ]3 R
CurrentGroup = sessionSettings1->Group();
Y$ a) @2 [" _ " Y2 d) ]/ k' `- P0 ^ D2 I! p
NXString CurrentRole;. b0 |1 s4 d8 o
CurrentRole = sessionSettings1->Role();
- B! I1 c) G( m4 w; M" T* I0 h# f, f2 Q
theSession->ListingWindow()->Open();
7 i- e' k. b( E- y
+ F2 }+ p. {- [ theSession->ListingWindow()->WriteLine("Current Group: ");& e8 T; r* G2 v" r; @3 `& @( g
theSession->ListingWindow()->WriteLine(CurrentGroup);
: Q6 i" D$ y. ]1 u( ^* V) k3 r / W1 \' s: Z3 G9 X: _8 O& x6 B; Q6 Y
theSession->ListingWindow()->WriteLine("Current Role: "); / \5 f" }. J3 d* J; c S( o
theSession->ListingWindow()->WriteLine(CurrentRole);
, p2 g/ H+ q. F! ]5 j
: H O" {5 B" O, @ h}
0 n& O3 e! Y) Z. ^
: }, d$ P, j$ C6 i1 D: x9 ]
( d. n2 H( I: F3 _9 n3 A, ?" d0 E
|
|