|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组0 c4 K: c0 z) M, O. J
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!2 L2 ~8 E* @6 f5 E
这个类也可以实现设置组,角色,获取卷等操作!
! K3 Z/ G' t2 d) n$ `
) {" s" j) |) h
7 M% N/ Z$ h, P0 x4 Zstd::vector< NXString > GetGroups ()
0 p( q! X8 k. b1 U" z5 C: j9 {! f Gets the names of the Teamcenter groups to which the user belongs.
# Y j# P. X) k5 j7 ^2 L n* K" p 0 ]7 I7 F7 d9 O3 r p" h- O4 b
) S0 o0 w, ?/ ^! xstd::vector< NXString > GetProjects () 7 \7 H' B) `; P7 i- M
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% h, m9 Z* E T& a" S! d
' [* K' M7 C' s6 ?6 L7 I' E+ s- ?
; C( ?6 W) C: D% H- ]
std::vector< NXString > GetRoles () + T) `; h* w! X9 U9 F
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 2 l; I" _7 v A
" P% W: H G5 J% D8 m 5 L* H& j9 _& Q# P* r+ O5 U/ o! F% J
std::vector< NXString > GetVolumes () . N% Z7 g3 V# Q1 h! r+ |
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . ( w: s6 t) N$ a" o
% c. X# { w g1 M/ S3 r% w
& ? l' |; l. |) w# d" z6 r
2 `& w) \# j6 O" W. x4 hstatic void do_it(void)# {9 |9 s$ V' g
{
# A0 U" Z' f3 i) A/ M. a Session *theSession = Session::GetSession();+ _4 C% |6 x: d7 p6 B
Part *workPart(theSession->Parts()->Work());
( o/ e5 a3 L& V; v: B( @! { Part *displayPart(theSession->Parts()->Display());$ `: n' R" Z8 _/ S$ a5 b! o; f9 a
' m1 {0 q2 l0 T$ G- Y5 w/ X$ Z PDM::SessionSettings *sessionSettings1;
# N) D" t, S/ t. o9 s, Q9 [ sessionSettings1 = theSession->NewDatabaseSessionOptions();
- p V, w( w2 m9 _
# [" |' m& ]6 ? NXString CurrentGroup;" H4 j, b# D! T9 r+ C2 j
CurrentGroup = sessionSettings1->Group(); y. @' ^5 _5 m% I- k$ D% Q! J/ M* `
# c h3 ]0 E9 X: G+ b NXString CurrentRole; Q5 c/ e+ h$ p6 {: T
CurrentRole = sessionSettings1->Role();; k% U# k. t3 N
; i7 }/ F! | ^. z; T: ?5 X4 M theSession->ListingWindow()->Open();3 i! @) A' ?9 p& G9 j
+ p7 M( o% _* d
theSession->ListingWindow()->WriteLine("Current Group: ");+ q) E/ r, V: T4 f
theSession->ListingWindow()->WriteLine(CurrentGroup);# f4 Q0 l- F+ S2 ~& W0 k) A
& i# t5 ]6 l. H8 y t theSession->ListingWindow()->WriteLine("Current Role: "); - C# }' M* w* y! x( C. g* b+ L6 F2 Q
theSession->ListingWindow()->WriteLine(CurrentRole);
% v5 [9 x1 M; C
( g) _, W' J4 T' B7 a}
8 y8 T" K7 R- p- i1 k
! O, i5 i, W8 u$ a! G, s! l
. ^: e* X& e. Z. ?# g3 R3 t; a, Y: @* M+ S2 _
|
|