|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
9 m& y k0 v, M1 d/ h1 {通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
) w$ B! ?0 A8 Y这个类也可以实现设置组,角色,获取卷等操作!+ ]+ i9 @1 n' ^
5 D/ |! u5 Y8 f5 d
& f: y+ u- Q- W+ C5 C; G! w" D; _std::vector< NXString > GetGroups () 3 ]- e4 g* O" ^" W8 \) y3 Q2 K
Gets the names of the Teamcenter groups to which the user belongs.
5 R$ M% W8 z( l& S0 O8 d" [2 t ! a2 C% B4 ]$ y/ } l0 M3 ~( q
0 |/ y& ^3 d6 E/ @- a4 V
std::vector< NXString > GetProjects () - N: ~! Q2 G/ x5 L- l
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
. |6 M0 e3 Z3 |7 V1 n/ n
7 U& `4 V, U/ l# p* ?% p; u 4 w/ J- G$ ~5 v3 X
std::vector< NXString > GetRoles () ) H+ G* z/ N+ X, C4 ]2 w6 T
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . ( a5 l5 E1 z C* n
1 [- P) c6 \+ p7 j6 J Z
: G2 F; @2 Q6 v1 _. |std::vector< NXString > GetVolumes ()
0 u3 E L) x7 e/ j$ O; m6 E Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
: n3 t8 {% Q! w* l+ q5 G9 h3 z5 H( {# U8 I$ {+ B! A+ `
% y6 u* F4 K, c4 t0 i! z
% z+ }6 _2 i* S/ i' q8 D& Estatic void do_it(void)
/ [9 m6 ]2 ~9 T, r{
0 i3 b K+ h) \ Session *theSession = Session::GetSession();
: H6 i: \+ x1 k' C2 N Part *workPart(theSession->Parts()->Work());
" c7 ^& U" D( q, f% g4 V( V Part *displayPart(theSession->Parts()->Display());* x5 @% z, y3 a5 p+ R
; x* }( L" l0 [- n& D PDM::SessionSettings *sessionSettings1;7 s4 u: b/ n. m! t" _6 r
sessionSettings1 = theSession->NewDatabaseSessionOptions();
0 _$ k6 T4 a% Q: d# C) p; a- I 7 h/ ]. _+ W, d6 j* D/ I
NXString CurrentGroup;
0 E0 ?2 f K s6 [: s CurrentGroup = sessionSettings1->Group();
; I- [% ?8 W0 [) V' V
( I7 ~( K& E1 C, K5 f NXString CurrentRole;
9 }$ U0 r* R. E0 T# D CurrentRole = sessionSettings1->Role();9 j9 q3 G; T; P- G/ }( p7 h" }/ Y( i
' C# G( O" |! H: O. T
theSession->ListingWindow()->Open();2 b! L3 C; V5 N5 _
: I( J, {+ `+ C3 ? a& z
theSession->ListingWindow()->WriteLine("Current Group: ");
2 ~1 z$ g- B" [ theSession->ListingWindow()->WriteLine(CurrentGroup);% l1 A8 Q3 Q- q. g* g9 ^$ M5 Z$ T
2 F `; R3 N9 r4 A theSession->ListingWindow()->WriteLine("Current Role: ");
0 F, J9 @( v+ P' B& W G& a theSession->ListingWindow()->WriteLine(CurrentRole);0 ?/ c1 N9 W; O- r' w7 w
8 `5 ^; `: D6 {! A% h C6 B}
) {" K+ _3 _! Z3 B4 {
* m9 C- v W+ M3 k6 P# ~1 E: y& \6 l
4 \ O& b" h M7 O T' \) Q' X
|
|