|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组; ?) {6 u! t' y
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
6 l+ F2 d8 O# W% z C! C这个类也可以实现设置组,角色,获取卷等操作!5 R% ?, j8 p! o$ M6 D$ ~) b* s
5 O: \' d0 R9 ]2 v
6 o6 s& I" A/ L0 W" {: astd::vector< NXString > GetGroups ()
$ {# Z' j' ?3 V Gets the names of the Teamcenter groups to which the user belongs. 9 G4 a# F- |! s: y3 }
5 ^) v& q# T/ o( D! ]. o
( N& L6 U$ Y k2 s' estd::vector< NXString > GetProjects () 5 U) h- \6 O \1 f) q1 F& l
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. ' b. n* I* L- F5 q) {
+ Y8 u1 H/ c4 J 2 Y) ?- ]) b9 X# a0 ?
std::vector< NXString > GetRoles ()
! s r7 Z; N* B7 O% Y6 L$ f4 A Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
6 m, E0 ?( I. |! w+ z9 c. M }1 T+ ?8 g8 i9 l0 b
3 F! L% v O) X& c
std::vector< NXString > GetVolumes () ) B. y( Z7 N( y
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
0 o* s" B0 O5 f& H. f
# T' G# h, a' O
' H8 s1 L2 N6 L4 S1 R. i9 h- v( J6 x! W/ e" Y
static void do_it(void). B8 x/ j, d7 g$ N0 Q6 v
{
3 V: a' ]0 U8 ~% d Session *theSession = Session::GetSession();
' X# p, I8 q, [ Part *workPart(theSession->Parts()->Work());# D5 e$ p: ]% ?
Part *displayPart(theSession->Parts()->Display());
6 `1 t: ? X( C
, _, F: X9 u2 O) l. v+ Y PDM::SessionSettings *sessionSettings1;
: ]5 y- i% Z, q* M+ P) a) K$ b sessionSettings1 = theSession->NewDatabaseSessionOptions();/ B. U' @: |) T0 T' S. e" e
' K. \! {3 N V: @8 u
NXString CurrentGroup;- h6 c& Y# r: B# q9 o# ?
CurrentGroup = sessionSettings1->Group();
f' ^+ a2 h# `# H) o
: M1 v. m% I7 w5 k" |6 k4 L' H7 S! Q NXString CurrentRole;
+ n) W- o9 J# @4 c& w CurrentRole = sessionSettings1->Role();
# r2 A& I, v; [- x1 ?
2 g3 ~0 d( t9 b3 H Y theSession->ListingWindow()->Open();
3 q+ B0 Z1 Q l) D5 R! q+ {4 [1 [2 B + E- S% Y7 y$ W% Q* `$ u- y7 B
theSession->ListingWindow()->WriteLine("Current Group: ");
; V0 p9 h( U, p7 o. i1 G2 |1 Q theSession->ListingWindow()->WriteLine(CurrentGroup);
- k, l7 I# u% Q& \+ z
( Q% T& ]) O" H theSession->ListingWindow()->WriteLine("Current Role: ");
: I+ O: F5 h ^7 a7 _ theSession->ListingWindow()->WriteLine(CurrentRole);7 o, G4 D0 C: b/ O
) ^& a, }5 H8 }, a: P. s2 [}
! i0 {6 ^) i! ~( d/ r# {, G
0 Y k- ^) r- w( C: u
# d* x/ V) }$ Y- H( V& L8 j
. y0 g4 m& _( X( S# A |
|