|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组/ V* T6 g" U9 y
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
s/ X; `: L$ W- o' y这个类也可以实现设置组,角色,获取卷等操作!
2 e _( W* C2 z4 ~$ y7 n% ^, G. _0 w0 n! v7 h! s
) O3 d* Z" Q( ~( ]std::vector< NXString > GetGroups () ' O' o# T* v6 C6 i
Gets the names of the Teamcenter groups to which the user belongs. ! g- Y* q. m/ N( k7 V" I/ M. }) [4 M
3 H; |- }- e9 F6 N3 @ n* m7 {
5 I6 H% f+ b3 N. k8 ]
std::vector< NXString > GetProjects () : A; Y' R8 G1 g r6 i V2 e2 V7 T$ e
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
2 y# T' s( M3 q0 n
+ x9 V* z/ V- f. ~8 B3 M
& b5 q6 b. c9 S% H7 Ostd::vector< NXString > GetRoles ()
% }% H* C5 ]" Y' n" n Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
7 {8 O A* o0 ^9 C& j# }5 z : T `4 b+ Y) B5 `* k, o; ?
' `$ |% J( E) x# J& D0 o
std::vector< NXString > GetVolumes () $ w/ m5 r( H: j# |
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
( U' u/ W+ x( H; c2 [+ i# q$ u, z) ~
8 _( f9 S& w: H) k; B
3 f/ l' h9 q: X4 I. T; _& T" y5 e$ T: O* }* q: e
static void do_it(void)
% G, R: v& d. b( p8 I5 l" X{
. |9 |* E6 I9 { Session *theSession = Session::GetSession(); F" R9 d) {; ^$ L; I! b* T9 u
Part *workPart(theSession->Parts()->Work());
7 B% F1 e& g: g1 i- `/ S Part *displayPart(theSession->Parts()->Display());
4 t/ Y! f+ {6 c, { 8 e" N9 {' E5 @3 S8 t- P, v/ E5 h! \
PDM::SessionSettings *sessionSettings1;
( i0 L1 k: I6 }, g sessionSettings1 = theSession->NewDatabaseSessionOptions();; u; L6 ]5 v# D) B" [$ \9 X
3 v7 r" @6 Z" s0 q
NXString CurrentGroup;
+ V' n; ^' Z# H6 u0 U CurrentGroup = sessionSettings1->Group();
4 ?3 x5 L: F) l# l$ V( b+ ]7 R5 v; ?) G
5 l5 a* d/ e0 g C3 l NXString CurrentRole;% Z; V# n! I) [0 w5 v! T9 s2 q+ |
CurrentRole = sessionSettings1->Role();
, y4 ~% B- x6 M
( I, Q$ a6 E1 k. n8 o theSession->ListingWindow()->Open();
0 F: M) O% B5 [3 V) l& w* X; q
* f) C7 t5 f* Q theSession->ListingWindow()->WriteLine("Current Group: ");
+ {6 A) B( q1 _4 @1 ?( s0 P theSession->ListingWindow()->WriteLine(CurrentGroup);
8 q( z4 o4 U g: o
1 C5 H4 s( h0 C9 r( k4 ~ theSession->ListingWindow()->WriteLine("Current Role: "); $ I& q: e( G; K) H7 H" O
theSession->ListingWindow()->WriteLine(CurrentRole);
" l9 v1 { M1 O" S% n! h+ t* p& U }/ I
}
2 x! s9 M5 t9 t0 L- |/ B& C% B5 E7 O: k, r( j+ @
# |0 s1 g1 p1 L4 r) c% R' \' v* X, l4 Q' F6 p
|
|