|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
# k2 U2 r: {5 j) f通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!: S. g4 M" }6 n" k% z( D- f
这个类也可以实现设置组,角色,获取卷等操作!0 H0 N; p4 D4 r$ d8 H" s' S# @
6 @. C/ u7 H M; I% t; S 3 J8 i4 W+ T. j f/ i
std::vector< NXString > GetGroups () ' u" T" A7 _" w$ `$ a
Gets the names of the Teamcenter groups to which the user belongs.
4 R M* `) V; a& H, z3 o 0 w' N. l+ H/ n- D
3 f) i1 y# |) }4 }! F+ X, ^std::vector< NXString > GetProjects ()
5 R' |7 [& x: R) i Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. ( p' d6 A/ Y" z+ v/ w1 t9 }2 ~
" f' n7 o! Y4 M4 h& ]6 o
6 L0 t. @ F) m3 }, p
std::vector< NXString > GetRoles ()
4 ]% }3 j. D/ x/ V2 x Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
. x( S+ j1 ]$ q% ` . Y9 l7 h+ _# D
4 x( W( I" z q0 i& \std::vector< NXString > GetVolumes ()
* O3 @0 \) w" h' A, `* x Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
5 Y. t2 f, E7 e$ b/ _0 | ^0 |! \0 ^8 d8 Y& s% G/ d
4 Z: k- K) E6 M6 O+ e& N1 ~% A8 ], Z2 j
5 m. C# [; ~* a2 z6 }* F) c, G# w. N
static void do_it(void)( W/ Q3 i) l) d( z3 o
{
* }3 m4 N+ x/ I) c% f. J Session *theSession = Session::GetSession();" F8 M& {2 C- J
Part *workPart(theSession->Parts()->Work());+ x( s6 n- w9 K9 L/ ^4 F' f! U
Part *displayPart(theSession->Parts()->Display());2 E% a2 g( [0 b' S, P
: u: \7 |8 m% ~8 M
PDM::SessionSettings *sessionSettings1;* S* Z$ g3 m' L& u* |
sessionSettings1 = theSession->NewDatabaseSessionOptions();
& B* C! R8 Z S/ q/ c5 t& O9 p0 G$ @ & Q. @/ A8 N, s+ O6 n: v/ B
NXString CurrentGroup;. [2 k$ o) ~. n% X+ z( z, I
CurrentGroup = sessionSettings1->Group(); ]- B+ J; L( {: [1 P4 T/ P) z
, [# I, S$ y8 I/ Z7 i NXString CurrentRole;
3 n" q2 s6 V& j9 S3 |! \ CurrentRole = sessionSettings1->Role();' @ @9 o% L8 A
8 T& t9 G0 H/ F theSession->ListingWindow()->Open();
) q! I& T. c- h7 g6 M P/ V$ Y* Y( n1 K
9 V1 [8 d2 C/ ?* O! m* `0 a, D+ w theSession->ListingWindow()->WriteLine("Current Group: ");9 W& j0 P5 o" y% z& D0 N4 j
theSession->ListingWindow()->WriteLine(CurrentGroup);- P: K u `1 M8 p
% B" g9 `; L" e: X! x; }1 k
theSession->ListingWindow()->WriteLine("Current Role: ");
, u* ^+ R( o: | theSession->ListingWindow()->WriteLine(CurrentRole);
* [5 E9 i2 d* m9 }/ X+ e' d0 v/ l, {2 T
}
% k4 M" E6 b# [4 W, l+ V4 @5 f# ]
. F X1 | g4 a3 e- R. j Y: u7 o
$ U. M+ |6 I. b; a0 H" ]8 T9 w; E4 W1 K4 S
|
|