|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组" v9 c( Q: X' Q; I
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
+ G; T+ n2 F9 L8 l- Y这个类也可以实现设置组,角色,获取卷等操作!3 i6 `' C. o3 v9 f
' I& y& z z3 T- I' F! y 1 c( f) [4 @5 Y0 j# A, W" ~% M
std::vector< NXString > GetGroups ()
( M7 G3 F4 d3 h. U. A+ u# A Gets the names of the Teamcenter groups to which the user belongs. + H2 a: O) C( \6 G; u3 W: Z
: R& A- ?8 g c" N$ S2 g
* J: G& a) U O! C5 [( a/ w0 |2 nstd::vector< NXString > GetProjects () 8 \# J j* ^8 {7 G: z
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. 7 C r9 B6 n3 `$ C1 Z$ q5 a" I
6 M- s d& F+ h/ i 6 a7 V2 b. V' b7 C
std::vector< NXString > GetRoles ()
2 f# W. U2 X, t* D$ _& l Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
4 F+ V8 f K- q% A8 _ H 3 Z5 j+ S" ^ x9 P
9 {. C* C1 B n' Q1 f9 @
std::vector< NXString > GetVolumes () 1 z) S3 r' r8 h0 [, C
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . 9 B7 _! f: n+ l% g$ X
9 G* C/ D. z" I' S1 Z8 h
) _! W* k) ?+ E9 V8 V& w
3 v: k l5 I; U) w$ s3 P4 M3 f
static void do_it(void). `' x2 _# w D# s
{
) x* G% d0 z+ g1 O- }& Z, Z6 T; T Session *theSession = Session::GetSession();
! t X; C/ g% g$ D4 a: R Part *workPart(theSession->Parts()->Work());
3 j+ W) F: O0 K t) S/ e K* {& K Part *displayPart(theSession->Parts()->Display());
" e7 {' A: u1 }* J- H! r& a 2 y4 E @. k- Q" |& u7 ]/ m
PDM::SessionSettings *sessionSettings1;
8 d& x: K* B3 Q+ y3 }* ~ sessionSettings1 = theSession->NewDatabaseSessionOptions();# Z$ E" N( e# H0 K
- j4 h' u8 W5 x4 I! U# n- x# R1 ^ NXString CurrentGroup;1 B+ y. F5 j' V w2 K
CurrentGroup = sessionSettings1->Group();
5 a0 l4 L; a* M, A% i6 j
- {9 v+ G. [7 y7 X/ G( i NXString CurrentRole;
\4 r+ z0 n! ~: P4 k0 W5 R+ S CurrentRole = sessionSettings1->Role();) b4 W. X Z; c" W
7 r; s9 [( l7 h' c. @( L5 G
theSession->ListingWindow()->Open();, V4 @. H& i3 {4 p) I' h$ k
, G! k3 ^3 r$ w3 t% Y ]3 q: A theSession->ListingWindow()->WriteLine("Current Group: ");
& ?7 ?+ f b# @6 E% b theSession->ListingWindow()->WriteLine(CurrentGroup);
! H; l" f3 |7 Q " @9 V1 a3 `- l0 H
theSession->ListingWindow()->WriteLine("Current Role: ");
5 T+ F; `; Z2 u( D& \ theSession->ListingWindow()->WriteLine(CurrentRole);& h0 z) N9 V6 ^7 ~
0 S3 q; N$ }6 N2 o! u0 h}+ {# `: z( g6 J$ `% Q5 t
1 s' l A* n r% | |$ Z
3 {2 y7 w% A' v" x
r: J- |5 N* c; E! L |
|