|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组+ T6 X; y, p- A
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!( C3 _7 s5 X6 C5 n6 O$ ?
这个类也可以实现设置组,角色,获取卷等操作!' H4 J- M6 |5 s+ R) l/ W6 A6 e0 M
7 `- M4 j+ F3 `9 p
j0 J8 D. l3 m# |3 a5 ]- d7 lstd::vector< NXString > GetGroups () + o3 j0 J$ T3 i% H8 I
Gets the names of the Teamcenter groups to which the user belongs. . c+ r) B$ a) C- A4 ^+ @
, S" l) Z- |4 ~+ `0 g$ N " C7 W S3 @, c, g2 {1 g' b
std::vector< NXString > GetProjects () 6 d( X1 m- F( B0 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.
" U! a: x! y" {4 S# N. n1 ` 6 Q& m6 g1 v v$ E5 X6 _, d& M
# q9 Y4 P: ~: b) f# n6 G2 M
std::vector< NXString > GetRoles () + g7 D G' ]2 I+ i0 b1 H& A
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 3 A" V9 K" Z( ]) t7 _
, S4 e* S! q2 W
, U* \: d) b" \$ [. l& n! Q
std::vector< NXString > GetVolumes () 0 b8 `: a: ]8 W `2 h! E& \- B
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . ! z& M, p% p* b, h9 a7 Y9 `6 w
, D$ I* Z7 @9 H0 K
5 ~4 p2 d7 U1 D) U
7 C( B `- ^. I* {4 T2 l
static void do_it(void)
+ Z6 l' |6 P. s9 v8 x! _2 U{
/ l& x1 i1 R g Session *theSession = Session::GetSession();
! O$ n3 [; K. L$ E8 \ Part *workPart(theSession->Parts()->Work());
* K7 w3 p8 a& x% c$ ?7 ^. s" v$ h Part *displayPart(theSession->Parts()->Display());6 y D4 ^8 f# l3 E( K
$ X: r! r7 _: n( c PDM::SessionSettings *sessionSettings1;& P5 [& x+ O# }
sessionSettings1 = theSession->NewDatabaseSessionOptions();
% L% E! D% V6 q }" ^5 X% n * R4 F; _( Q3 v* ~" O
NXString CurrentGroup;
; y" F% J3 L$ p9 J' K' r, r/ w CurrentGroup = sessionSettings1->Group();) `$ S5 p/ h* s+ v6 v& |
# W6 ?& n( f, z$ l/ N+ @
NXString CurrentRole;
9 i" |9 ~8 N% [" ]: q CurrentRole = sessionSettings1->Role();2 o: p. \9 S$ \( q% Y; d1 {# B- \4 r0 ]
+ B' f P3 l g: J- f
theSession->ListingWindow()->Open();$ R4 {/ M* l+ K8 p# R7 M5 B! |
4 b* h6 C( A; Q( N; O& A
theSession->ListingWindow()->WriteLine("Current Group: ");
$ K. U: ^! G# k. E% A) i0 t, h& Z theSession->ListingWindow()->WriteLine(CurrentGroup);# ^) L4 [9 U4 |. `; F
. L% m2 C1 s" v. z# O& K
theSession->ListingWindow()->WriteLine("Current Role: ");
" p) l, E7 R8 n5 g- g; n* @ theSession->ListingWindow()->WriteLine(CurrentRole);
9 c: N' h9 m9 B8 K
2 k; @; ~1 b0 Q% J, g5 F}# P. E; }8 ]9 M1 i: @; j# u$ a
7 P3 R% E" X' L" U) v6 `# {/ m; x# B4 I3 {8 H; A; k
, s/ {* u7 h# N! Z. k/ x |
|