UGNX二次开发源码分享:Teamcenter集成环境下,报告角色和组 / ]7 A2 ?4 y, z4 f9 M通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色! / F" s2 D" W$ X3 |这个类也可以实现设置组,角色,获取卷等操作! 1 ?$ C5 Q! @% U) B0 h , K+ H! e* C# ~5 w 2 \+ h' ]& A2 f& k4 _, _: Ustd::vector< NXString > GetGroups () # L, T8 B5 T1 y) `$ S
Gets the names of the Teamcenter groups to which the user belongs. + u. i* u! t; E1 u; c1 ^
. }- t6 O9 `% r4 x( \2 M
1 L3 x) {( V; X# M: Z0 tstd::vector< NXString > GetProjects () & J. H1 _7 B# j" ^
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. 0 d$ f3 `8 y8 _2 Z. |
9 }4 o. Z$ M# v, C/ [ " p. h* f- c3 {; c& Y0 V) A( i3 [, bstd::vector< NXString > GetRoles () / J- g( Z) H% {+ \5 w: ?/ D, i) K Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 6 _2 z1 {9 l# D
! @1 L# K* ~- x6 b) e+ D4 G
$ }1 I+ O. B) ^1 n7 Z
std::vector< NXString > GetVolumes () . E a: z$ r6 x# N( K
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . 7 D0 U- f6 a- q% }
/ ?, o! m7 `( S
9 K# D+ q% ?9 X) D9 ?( p P/ L1 n! X2 n9 U5 Y
static void do_it(void) 3 w3 V+ H* ?/ }6 j1 F; g- ?{ i |9 d% d- b# f Session *theSession = Session::GetSession();" j, f' b5 g! M6 m* n
Part *workPart(theSession->Parts()->Work());, H7 ?* |; F3 k! A
Part *displayPart(theSession->Parts()->Display()); # p' p- @5 s. o/ [ 7 k, ]8 l3 z; T# q' N! |& R
PDM::SessionSettings *sessionSettings1;0 r) u5 M D6 f% \9 v( i* ]
sessionSettings1 = theSession->NewDatabaseSessionOptions(); 0 k/ W. k' W' K4 |& l4 p J- x) B& K4 P1 y NXString CurrentGroup; - B' F+ k% a! `; T CurrentGroup = sessionSettings1->Group();. g# p* Y# i4 N5 A
8 Y. _; @5 |; v- F NXString CurrentRole; 9 f1 J5 I4 R& c( m% b CurrentRole = sessionSettings1->Role(); 4 ^6 w3 S6 L+ g9 z1 n 8 @4 ]6 _# H( ]! |9 w: E& ^ theSession->ListingWindow()->Open(); ! h o- N1 x$ a; P& ` ! R4 `7 w4 p/ K6 ]' e- r4 e
theSession->ListingWindow()->WriteLine("Current Group: ");. T: w8 w8 \ Q
theSession->ListingWindow()->WriteLine(CurrentGroup);# A( {! h# ~1 b" [; x4 D
( X Z( f0 G0 a' d% S theSession->ListingWindow()->WriteLine("Current Role: "); 0 g9 |) Q$ C0 f, K' G& J- n
theSession->ListingWindow()->WriteLine(CurrentRole);1 v! J5 }$ H. R
$ I- L( h! Q( v" E
} 8 |1 s* n5 U5 U( X; K' Q5 D4 F- Y( c1 [: {3 w