|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组, A+ X2 c* _1 ^2 G9 X! r3 ]1 B, f
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!/ S$ ]! ^5 ~, H: I- t, p
这个类也可以实现设置组,角色,获取卷等操作!
0 |' s/ { Z2 V* U( c. N' w5 c8 r/ G' N5 m J. G7 C0 u' u5 x
& r' O# @8 [$ J! ?" G* c' qstd::vector< NXString > GetGroups () ; a$ T5 Z0 `- b; q2 Z) c! A0 m
Gets the names of the Teamcenter groups to which the user belongs. ! e3 [: k. O7 P7 I9 e5 Y
; k7 z/ a% _5 n7 v7 E z* p d; w( e" S
std::vector< NXString > GetProjects () 0 H2 |" H: m1 q
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
0 I8 P: f5 D$ M# F, W5 w
' W9 b7 Z6 I3 N9 v0 ]
7 y/ l# r4 {) w+ n, ^1 r5 X" ]std::vector< NXString > GetRoles ()
6 k( k+ ?$ D. Y9 n$ R Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
5 w) Z2 p% ]- b' q& r/ \% g
/ B0 ~% O( @4 k! ^/ H4 i3 n , ^0 L8 j0 c1 D1 `9 g1 e5 x
std::vector< NXString > GetVolumes ()
; f5 y/ @7 k+ \ l9 X Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
: T& H& K& G3 A( p4 A% w) R. ~8 d
) [3 E6 r+ u- m4 S- N. V/ ~0 S, r1 A% ?! v* y- i/ H
, i) g% e3 w- x) _8 D
static void do_it(void)
. v6 S W) ]% Z, p( [' P+ U{
9 O% C8 X5 b0 d) V; E Session *theSession = Session::GetSession();
1 W, _# t: k% g& F; c Part *workPart(theSession->Parts()->Work());0 \/ o2 K' x! V& g
Part *displayPart(theSession->Parts()->Display());- U4 ^+ `. Z% V0 b& m! e( ~, \( u
/ h i, V/ ~7 z$ X- S3 @2 l PDM::SessionSettings *sessionSettings1;9 T( r. ]' V$ C/ M" w! A" n$ U
sessionSettings1 = theSession->NewDatabaseSessionOptions();
1 b( q1 b1 f9 W9 M9 g- l
$ a* `# l$ |5 R2 P% ?& m; B% h NXString CurrentGroup;
: G; w+ J' J- P& o4 \ A+ D CurrentGroup = sessionSettings1->Group();
! p( k/ m8 |/ U8 B2 K$ W , r A7 |, d" q$ C: H X
NXString CurrentRole;
, Y6 R5 c& B3 I: L1 f CurrentRole = sessionSettings1->Role();1 H& w; k( {* l0 K, a$ d
! ~# j; S4 P( @: ` theSession->ListingWindow()->Open();
" P8 A) t4 M1 H$ u# k
, `6 ~7 |7 \3 x T theSession->ListingWindow()->WriteLine("Current Group: ");
; |# V6 {/ m2 z* p theSession->ListingWindow()->WriteLine(CurrentGroup);
. }: J; Q1 P( |# _$ B8 c4 [
O% W: b, C7 j; Q theSession->ListingWindow()->WriteLine("Current Role: ");
5 `. b( V2 V& _9 @& @3 ~2 ~& L theSession->ListingWindow()->WriteLine(CurrentRole);
: _7 H' b+ Y) K* v
2 h' m8 E; t1 G0 w' I}2 [8 K/ H& M9 [
- }$ X& n, x* h4 r
$ i$ X, G/ f& N7 E L8 S& S# n9 O
! y& \2 |/ \: `6 [$ n( S( g3 w |
|