|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
8 g) \# A) J- _+ G通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!: p9 V( M+ M- H+ Z& @
这个类也可以实现设置组,角色,获取卷等操作!! @& g% O5 i, v: Q) d
* e& O: |+ K* }8 D
G; ~# G4 X0 H, O2 X" z$ X
std::vector< NXString > GetGroups () 4 L" L/ r! V: i5 t" j' N1 z
Gets the names of the Teamcenter groups to which the user belongs. 6 k( Z' O6 ?# F2 S2 _
: N3 K1 _, l; D( f1 \3 Y* X
1 @& H; }1 [2 s3 u9 C$ qstd::vector< NXString > GetProjects ()
% G N9 X3 v* 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.
, M0 T& k0 L v8 ?" ?( i
) T% f: w1 |6 t/ {9 O8 K " |1 Q9 K. X% K$ t' \
std::vector< NXString > GetRoles () 5 L3 h$ j) |* \2 C. C2 p
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
6 v0 r1 E% S" w [ - M8 z, E) f6 r X- [3 d. K
- A+ I2 T5 [3 _. N
std::vector< NXString > GetVolumes ()
. {2 o2 a/ G1 l- V Z; G Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . * ~- p9 J, }% s9 A
9 j" a/ y6 T1 P2 ]2 e( H- y/ [' G
* U3 X) y" `& S6 Vstatic void do_it(void)
% x- u3 ^1 d3 O* T' i: w# N{6 i$ w; y# k' C! j
Session *theSession = Session::GetSession();3 i4 `+ v; U" o# L0 J
Part *workPart(theSession->Parts()->Work());
" C+ S& J7 @9 [, ]0 Z4 n; X! T Part *displayPart(theSession->Parts()->Display());
0 S( e6 q- ]: W2 L: Y1 M0 D, Z
- f; ^$ M c' {0 | PDM::SessionSettings *sessionSettings1;
$ r! P. }) n* m" `% r1 ~7 W sessionSettings1 = theSession->NewDatabaseSessionOptions();
- G9 f. u0 O7 Y: D " |' e1 x, A( t# n( W- b! _0 D U
NXString CurrentGroup;
8 O% `- \" p5 x' E CurrentGroup = sessionSettings1->Group();
5 w" s% K" J- [# ~' m u, w9 x+ y# K5 ^; T8 w' o$ t6 `; o
NXString CurrentRole;
5 A8 i+ r. b7 h$ n0 k( e4 t5 E CurrentRole = sessionSettings1->Role();* d5 d2 Y* S1 [8 d3 i
3 }1 M- I3 O- ?( ~1 D5 J theSession->ListingWindow()->Open();
( ^; R0 e/ K3 N- i1 Z: { - o- F6 K) x; |) ~# ?) y6 j! p
theSession->ListingWindow()->WriteLine("Current Group: ");/ S! W8 T; G- V
theSession->ListingWindow()->WriteLine(CurrentGroup);
" w( z3 i3 m a1 m) L& J- } ! [3 C8 Z2 Z# {% s& U
theSession->ListingWindow()->WriteLine("Current Role: ");
8 q; l" ` D7 v4 w' B- ^; m theSession->ListingWindow()->WriteLine(CurrentRole);# Y7 ? N7 g6 q+ R7 c' v+ O1 K
! ]3 K2 A9 v9 M2 t6 y: M- k. T}6 S4 M( A& x/ _/ e9 {3 g
" Q' R! V4 Z1 B" w. f1 A
* D1 g* L3 I: b
& t4 L4 k7 N( N
|
|