|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
6 M3 m# |4 Y; p) F通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
+ D8 L( f2 |$ u( v这个类也可以实现设置组,角色,获取卷等操作!1 G1 V$ m' b( z% E1 f# ~/ k
( B! o0 l$ W# ]2 _! [7 L
" h7 r. \$ |0 o" g B% v" ~std::vector< NXString > GetGroups () - f1 V% C1 v( N6 [- {7 f
Gets the names of the Teamcenter groups to which the user belongs. % {& G: k! }3 [7 r3 H; g# w
4 e+ ^# v0 }4 b
6 N) h. [, {5 v5 ^8 K5 D5 Vstd::vector< NXString > GetProjects () & u4 r. r/ @( I# V
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! G% s4 e& Q- d8 }
[! T! }, J `) |# B 4 |0 [+ |6 Q% t4 h
std::vector< NXString > GetRoles ()
9 l/ G; O) m2 l. _ Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . ) g( d) E% q4 f" l5 q/ T
% y$ H7 W: }5 W6 S6 w; \) m- R
& n% Z2 T! f8 M8 p6 a7 t" fstd::vector< NXString > GetVolumes ()
' |: E/ G- p/ O8 m7 o Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
- ~5 ~, h! A8 Q+ [. O9 s
# W* ?$ N: ^& [7 B. I8 J
2 `' [' ?2 a5 Y9 d4 c2 p
) b3 z; k/ j6 D+ B) W& Vstatic void do_it(void)6 F$ l0 J6 T+ E0 r0 p& z$ Y* Z O7 ~
{& U4 Q$ S) e0 B# r, ~4 i
Session *theSession = Session::GetSession();1 o O5 E* v7 t5 s& j! T
Part *workPart(theSession->Parts()->Work());
L. Z# t/ f! _- ~. W Part *displayPart(theSession->Parts()->Display());0 w2 Y$ t' O) c! x; a2 P" z
6 D9 _1 ~+ X G0 [5 l1 d5 E0 l
PDM::SessionSettings *sessionSettings1;6 d* Z( \1 [& V- q3 R5 w4 {8 A5 g" c
sessionSettings1 = theSession->NewDatabaseSessionOptions();
' H& X4 y" C6 l& M
1 u+ X9 Q! n3 M% o. T" W NXString CurrentGroup;7 s5 v2 F) g' G2 n5 n8 v
CurrentGroup = sessionSettings1->Group();. D, A0 A, q% p* v
: ] `) a! U; u7 t3 { NXString CurrentRole;
3 W+ L/ Y1 O! b2 Q CurrentRole = sessionSettings1->Role();
3 L$ R, O9 a, {+ G: v! ~: H
1 b0 u' {6 w( ?; Q* Q4 `3 v theSession->ListingWindow()->Open();
* Z( P6 P" @5 Y0 I$ t! U9 w + g8 t& `; D$ } F& a! b/ e+ j7 E
theSession->ListingWindow()->WriteLine("Current Group: ");5 R& G2 f/ Q) ?
theSession->ListingWindow()->WriteLine(CurrentGroup);
J3 u% V8 C4 X o* E$ }
8 }7 c* X9 d, `$ b4 [ theSession->ListingWindow()->WriteLine("Current Role: "); + M0 T0 G1 X0 c n4 H9 ^6 T
theSession->ListingWindow()->WriteLine(CurrentRole);+ p9 I( k* V5 r- k( q; X, c: |* d
4 Q; g+ z) f- l! l( L& `' k
}% ]& Z6 t# F% | G- E
) Q& O/ { y' D+ Z: P. j' g$ a
! r2 r* x% u, [! p
- f9 O9 k8 q) J0 n8 y
|
|