|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组' u3 |* j3 w: D, d( ~
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!2 f, i& }2 N- {/ H6 A- Y% W) X
这个类也可以实现设置组,角色,获取卷等操作!7 `. @. r* E0 r6 \' H7 B! B( g' j
0 B/ G) F ^3 N, X
3 I4 v4 s( |! `+ N4 vstd::vector< NXString > GetGroups ()
8 }' E% F- l6 H4 k7 L1 C0 e Gets the names of the Teamcenter groups to which the user belongs. 5 @ s3 J) \+ G# S6 T
; ?+ K+ Z5 Y* n3 t' U5 E: ?- x" Z
9 @9 M$ o5 M6 S: Z1 Hstd::vector< NXString > GetProjects () . [/ \1 R% 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.
/ B! p* E1 E3 ]- N 4 _% f# T T5 y6 }
& Z( F7 }( q I/ S/ `std::vector< NXString > GetRoles () + ^& {! z% P, l$ g3 j- C
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 6 `, X! o( e" [% c
( ~$ J/ \7 c4 |; g( r" a6 k; L) b6 T5 a
% O9 m& J% Y" m2 cstd::vector< NXString > GetVolumes ()
3 k# m: j0 j9 @* ]6 M Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
, O- a8 l! S) X1 h8 v6 k- B$ {5 C$ N' {2 j7 ?" j
. V; p. Y1 T" ^9 M: r4 {. B2 A( i& a H
static void do_it(void)5 `* |( }( ^( Q+ U8 B; Q, o
{# ?% _8 ~5 V e: I; Z" Q" `
Session *theSession = Session::GetSession();# g2 N* M9 s# U6 Y' s
Part *workPart(theSession->Parts()->Work());( T, x; Q: r6 p3 y. a/ E
Part *displayPart(theSession->Parts()->Display());
; O3 z9 c7 y1 q$ D9 q
- Y$ ^8 Y# l! b. M) `2 q9 d PDM::SessionSettings *sessionSettings1;" V/ u1 d0 B) h0 e9 z1 d( _
sessionSettings1 = theSession->NewDatabaseSessionOptions();
7 y& j, ~$ t# _3 v; _! a: b 5 D* Y9 ]; t/ R
NXString CurrentGroup;
) D d; I5 M* @5 K3 g5 a CurrentGroup = sessionSettings1->Group();; C3 M: D, o2 c5 u$ X
( H5 U" O/ S9 ? NXString CurrentRole;
3 i' x5 K2 i# _& |# \0 J( I1 u CurrentRole = sessionSettings1->Role();
4 w! _% u+ D* w: N5 B/ {8 W% t2 X( }/ c6 K0 V4 a3 }" Z2 [8 {, o9 Z
theSession->ListingWindow()->Open();. e, A* ~! }4 v9 v1 I
4 l ]0 X1 D+ Q# [/ B$ f/ W: _4 \ theSession->ListingWindow()->WriteLine("Current Group: ");( P( x3 X1 F& m8 O" n! T% c- o7 ?
theSession->ListingWindow()->WriteLine(CurrentGroup);: K2 ^% f$ f4 p4 G' r& R5 n6 i
O0 X* k8 a# \* l7 y9 x
theSession->ListingWindow()->WriteLine("Current Role: ");
* Q# }! M& x' R; p theSession->ListingWindow()->WriteLine(CurrentRole);
* c9 _3 c/ ^6 z1 K7 {2 J$ b/ S3 y# y8 }1 K2 a
}
0 Y2 q- R+ b& V* }- J. y' }! r. r( _! z- m+ U0 ?" @% H/ `
6 Q$ h$ x* }% n% l0 y9 U5 z
3 Q6 F/ a& v# E7 j8 D( M% D/ v+ d3 H |
|