查看: 3626|回复: 0

[二次开发源码] UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组

[复制链接]

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

积分
9784
发表于 2014-9-27 21:10:30 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组/ s. D4 x/ _( O. j0 |8 j
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
: e: R: z; ^- l, ?& }2 j这个类也可以实现设置组,角色,获取卷等操作!" g7 c* Q0 c. G" T( Q

' i# Q- I  F) U( r # J( V# f+ e9 N" U- B6 r* B' a, @: w' S6 A
std::vector< NXString >  GetGroups ()
- N. K. U1 P* _% K' s* B  Gets the names of the Teamcenter groups to which the user belongs. & o/ I  ~% Z( |5 Q# {+ A
  ^7 k+ j" X: w2 c$ k) X
  * v; M, _5 @2 P( y! n
std::vector< NXString >  GetProjects ()
( S: N5 ?0 U9 M" B  i; d  Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. 8 n, S! U# J2 K$ T7 B! b  X
( g/ a% i# T- W: _! f" Y
  
7 v  C3 }" Z$ U+ Y7 k0 {( X* Fstd::vector< NXString >  GetRoles () 5 ?: I2 _# \$ E4 [9 `
  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . . S  E9 q. M+ |0 w+ n4 e  I
7 p" a0 v" t& M: B7 t' z1 H
  
$ p* V; Q5 u* A- lstd::vector< NXString >  GetVolumes () 5 s8 Z; a5 g" A( q, E/ a3 I: J; \! U
  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  ' q3 x, I6 x& y2 M! w3 j/ {' g0 D& J

2 k7 G. ?0 \% E( n: T8 q5 ~7 z. k) A/ X8 v$ n. l

1 f5 \: V, f# d& ?static void do_it(void)
7 ?& w. P5 g5 j4 N{4 D) ^" H2 q! Q/ ]
    Session *theSession = Session::GetSession();
8 g8 X" {% C% |# Q% a; Z+ T    Part *workPart(theSession->Parts()->Work());
$ }8 P0 l+ G, k7 S! P" @    Part *displayPart(theSession->Parts()->Display());. u5 m# k) {! Y6 k6 I. q: c
   
6 i" c: \# y: S  w8 R2 u" F: e& m1 o    PDM::SessionSettings *sessionSettings1;5 R: g& @% r: s: p# U& {
    sessionSettings1 = theSession->NewDatabaseSessionOptions();
% p1 A. g- `' u* C9 c4 l    1 p% @8 `0 e# W" K6 N+ o2 l* F
    NXString CurrentGroup;* j' }, D7 t( x! w
    CurrentGroup = sessionSettings1->Group();
) ]2 J1 ]/ B- k- n    + }! L: D$ @1 J4 d+ F; B
    NXString CurrentRole;. Q: k1 S7 x7 g+ w5 ~
    CurrentRole = sessionSettings1->Role();- ]) |# g2 P! g$ D
4 o2 _1 z) C% p, @! W& W
    theSession->ListingWindow()->Open();
: S6 S2 Q# K& j7 K8 Q7 V   
  x4 n/ T  _5 ]    theSession->ListingWindow()->WriteLine("Current Group: ");
, J; |3 f7 b" {, v8 ]! A    theSession->ListingWindow()->WriteLine(CurrentGroup);
" S  @) J1 i0 w  Z2 e9 J' i        ' E" [1 \! D# x3 l1 f
    theSession->ListingWindow()->WriteLine("Current Role: ");    ( t+ n# |  T# l' K: s
    theSession->ListingWindow()->WriteLine(CurrentRole);! f5 }7 a/ f! l4 q, v% g
  n4 L5 I" f& n, O9 l
}; [3 u3 j5 ]( |# T# ?
3 ~$ R3 v! M- ^, a! ~( Q( n

9 v0 g4 ~$ t4 c. A# f
- O' J; b* d& U
该会员没有填写今日想说内容.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部