|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
+ `' M& X6 `% F8 T- _% V6 u通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
! M' a8 s- q" d; L# I, v% V* D这个类也可以实现设置组,角色,获取卷等操作!6 I/ I2 b/ Q4 I6 [; G1 l
/ Y d2 q! q0 `6 D
8 x' t& z3 P& r% _, K2 a
std::vector< NXString > GetGroups ()
" \ G; o$ O; {; ~, l. K Gets the names of the Teamcenter groups to which the user belongs.
. Y9 x7 i8 q' r7 h - ~. c% p+ I( W" A, K% K
9 A+ `9 ~+ X8 d1 }std::vector< NXString > GetProjects ()
2 Z( s- x2 u/ j3 w4 _ Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. & f7 a/ D* F1 i. E
" [1 v) z! J+ i1 N
$ }( v5 z) k0 H& M
std::vector< NXString > GetRoles ()
4 p7 {5 d# A( x1 G: M9 a0 r Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . - @. D9 m/ n) g, j6 `
3 w- h1 _6 Q7 K- f; ~
# ?8 B, U$ ]% b W9 e
std::vector< NXString > GetVolumes ()
7 S/ h3 G) H1 i g' F+ X M Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . , C- G, f6 [0 F4 o3 a
% Q$ J4 c+ n0 I+ `
3 W5 R, L5 U. @8 m" ?5 |" ]( ^* G! p$ g9 s% R' f2 i. i
static void do_it(void)% x; O3 u/ g# U6 _8 R8 Y5 a# h+ \1 t
{8 E& k9 K+ M6 k7 f. m3 O) y
Session *theSession = Session::GetSession();
0 P/ m0 r& _" n5 ~ Part *workPart(theSession->Parts()->Work());( P! W, N, u* p4 L2 \
Part *displayPart(theSession->Parts()->Display());/ X2 }: C; n* d# d4 I+ G
- I; G5 n% k }8 A- J3 U+ e5 \, V PDM::SessionSettings *sessionSettings1;
! N! u8 a; x: R) p6 v$ ] sessionSettings1 = theSession->NewDatabaseSessionOptions();
2 D5 ?+ M- m z' {& V2 [6 `6 C* N6 u
) b' y( U. u3 w5 t% W7 H( O, r NXString CurrentGroup;$ c' u! M* P! k0 X' k! w
CurrentGroup = sessionSettings1->Group();
) E* N. T0 q( }$ Q0 R
6 H2 G4 w; n$ H$ s/ c d) ~ NXString CurrentRole;' i3 ]- l' i3 O
CurrentRole = sessionSettings1->Role();
1 b, a! g" i! a' ~& e" {0 L. ]$ D
% o, ?3 \: G4 b2 s _* B- T8 M theSession->ListingWindow()->Open();3 |6 I8 }2 r" _( k' V" E
4 F# C' `8 _% A2 L0 _ theSession->ListingWindow()->WriteLine("Current Group: ");
0 N/ [! j0 n5 y" ]! N2 I! I theSession->ListingWindow()->WriteLine(CurrentGroup);
' f" x0 X9 n# ]( U2 s0 |
4 U4 ` D3 o5 r theSession->ListingWindow()->WriteLine("Current Role: "); . Z3 k3 s: `9 b2 y& S/ i5 u
theSession->ListingWindow()->WriteLine(CurrentRole);) L! L$ Q! i# p, K$ B9 }
& m' C$ _& ~2 f+ n. Z
}/ c* v% e- x- m r
& a, v# @& Y/ f/ A; t
3 d( n$ x3 y: ^/ J) h# P1 F) ^
% f. z6 M! v. H2 n$ O Z
|
|