|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
1 d0 Y: q. `8 w% ], W: s通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
5 R5 v1 q6 S, }- K9 Z4 }这个类也可以实现设置组,角色,获取卷等操作!, g( M6 Q! |0 Z3 ^5 h, _0 _6 o
* R# l: P% G* Y5 U+ r9 y% R e
& {3 T& i5 H: zstd::vector< NXString > GetGroups () 9 O ~$ i. h( t, t4 \
Gets the names of the Teamcenter groups to which the user belongs.
, r3 l/ B' i7 D+ B) s# r " M7 w Y% j. U) ?( L. \6 B
5 p0 [) e$ N4 W ~, L/ astd::vector< NXString > GetProjects () ( T- C) ~) v( |+ G0 ]6 K
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. + D* L& }+ @0 y6 m
, v b$ I' a/ N# h 2 L/ G' F6 n) t1 W B1 {9 o
std::vector< NXString > GetRoles ()
' Y& i( d; X2 W" z" u2 c. n U$ d Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . " n+ a4 f" } o M
: `; U' c( X( {5 n; ]+ A
0 f7 R! _0 C; ~- a9 K) F2 r- |
std::vector< NXString > GetVolumes ()
% j. U# N1 Q# d2 L" t' ~ Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
* j0 [2 \! C' P. n! L- q7 O0 E, H* ?9 o9 c, x
- K( ^- L2 X) p7 t0 _* s( E& C: T
2 n7 T% F7 f4 gstatic void do_it(void); M9 j. D4 z5 r( z" V1 B
{
% S. O$ i0 @3 |% C, t. _, g9 W Session *theSession = Session::GetSession();
" P5 v" {6 a4 c" B/ v, D4 ~ Part *workPart(theSession->Parts()->Work());2 H# V6 P2 V D, p! ]
Part *displayPart(theSession->Parts()->Display());
& V" X ~ S- D# N1 e+ K0 h
# I0 q7 m1 u& ^ d PDM::SessionSettings *sessionSettings1;# w1 w) Q6 q6 q
sessionSettings1 = theSession->NewDatabaseSessionOptions();9 x( m: u9 T$ Q' G# X- A6 P1 |
; |3 a' P" `- f, b NXString CurrentGroup;4 m0 m" I( U2 i" q. P
CurrentGroup = sessionSettings1->Group();( t" b( u( o5 z* X9 q) ~0 Y8 R+ J* s
5 h" H; t. L- j/ M. Z& q NXString CurrentRole;
( v, d/ q& m' H* J- J CurrentRole = sessionSettings1->Role();
( m$ I, Y' ]; U" t9 b
6 P! U9 P" w: T( z theSession->ListingWindow()->Open();* C) s, j/ _ j( n" G7 s
* }! Y/ V; n% D2 w) Z6 B! { theSession->ListingWindow()->WriteLine("Current Group: ");
# _+ a7 ` Q9 _* ~# v6 s1 p theSession->ListingWindow()->WriteLine(CurrentGroup);% w6 M4 K8 {& _, I9 \
# J! ]0 G r- l theSession->ListingWindow()->WriteLine("Current Role: "); # j" Y1 C2 o2 W7 _7 R# ^4 R! @# c& k
theSession->ListingWindow()->WriteLine(CurrentRole);% M0 ]% i% f }+ B, j) r) M- R5 G
* G: I% N$ D! R}
. w& S/ o+ \/ G$ p1 f7 `- A. G, D
6 X6 Y* x$ g, E3 p0 q5 [
H. w" D+ d3 m* b5 e
" S( y0 f0 W- u, K" T, m* Q2 g |
|