|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
8 I0 B- L3 p* {1 r" ]通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
9 Q/ c7 z% g# v3 \& ?) ~$ [这个类也可以实现设置组,角色,获取卷等操作!
4 ? v/ A) N* L7 G: d9 p/ |
2 u7 J1 c! M* Q" y, l1 u% e& f
& v' `$ z) x7 a( ?# `& P1 ?std::vector< NXString > GetGroups () ' f& m3 V* ?, S0 Y9 U& P0 n: a
Gets the names of the Teamcenter groups to which the user belongs.
9 F3 c' C- e6 H x) N+ J
5 H# o' I2 s* |8 \- |& }7 X+ @
) i9 D* G! m& g. | w* o( U' |' Astd::vector< NXString > GetProjects () $ N- U# j" N* K S7 w. d
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
- R7 C' {$ ?5 ^8 o9 i) o C3 P- p6 d1 G, ^, x2 }4 v5 j
~- b5 P t% {' ` D( w- mstd::vector< NXString > GetRoles () ' F/ Z% E4 w* w" h L/ O P. d
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . % |5 S% z# V! ^3 y4 ]7 M
9 E' E7 S' N2 F 8 @% g/ Q" A9 f5 [: r6 b
std::vector< NXString > GetVolumes () X S# p- B2 I) h& \
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . ' T: n8 s. ^' X7 A T+ h
; E, x: g* I* `4 D8 |' r3 c; e
! D, i" n$ u/ s( z2 @# C
5 W% V2 \2 S* W, R3 Nstatic void do_it(void)
* j" B, |) u3 \ r/ V! Q4 P# y& C{6 F: L6 b7 K1 r( e8 b
Session *theSession = Session::GetSession();1 `. N- v. U% I. k# H
Part *workPart(theSession->Parts()->Work());: \8 {% K" T( }+ ^( p
Part *displayPart(theSession->Parts()->Display());# R1 x. Y- m- z( w+ [, \
- M4 `8 H8 ?9 l* S5 ? PDM::SessionSettings *sessionSettings1;
& V0 W5 a' ~; _3 z' H# S sessionSettings1 = theSession->NewDatabaseSessionOptions();0 l4 I) O+ k4 c* u, d3 S
2 Q) z+ h- M* ?& e3 I" B
NXString CurrentGroup;
/ n! Y- r9 K } CurrentGroup = sessionSettings1->Group();
9 d! c* j; m# B5 ?! e1 p
& @, s$ o' p7 n y3 o4 ` NXString CurrentRole;0 @2 Q2 [- [: l# a% b
CurrentRole = sessionSettings1->Role();) r& a6 O) n, E; _4 u
" ~" _; m! Y9 g8 p3 V8 v7 |; L' t theSession->ListingWindow()->Open();5 F" |) W q: l$ t% W' g0 W- B. k
0 ^* j/ c# x4 r0 w5 |$ \. N) q5 } theSession->ListingWindow()->WriteLine("Current Group: ");
5 r0 O' ~1 |, |& h theSession->ListingWindow()->WriteLine(CurrentGroup);
% N$ f/ X/ Q, y
& p" H1 s) K! t+ ~ theSession->ListingWindow()->WriteLine("Current Role: ");
1 R! x5 ~* H- Z, p( p, F, ~ theSession->ListingWindow()->WriteLine(CurrentRole);# N) E5 f! V& V* m
% ~6 i" s2 ?' P" w}6 \3 l* w: N T9 |; o& h3 O
' S9 k% h& a% g: K
+ u; I2 A: c) t# a. F
& \4 T) s2 I/ R- I& g# x
|
|