查看: 3628|回复: 0

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

[复制链接]

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

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

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

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

×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组: m& _( f$ f! @7 g. V8 ]8 h. z
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
; |- u( ^8 K% P这个类也可以实现设置组,角色,获取卷等操作!! _+ O6 a6 g7 {6 A7 l1 E

3 q$ Y5 m( f' \: e5 \
  g2 ]3 X' {. y4 T( ]& w1 F: mstd::vector< NXString >  GetGroups () , u5 k7 `7 F0 w
  Gets the names of the Teamcenter groups to which the user belongs.
% a# x. v7 J$ ]; a/ r' g0 i% i
/ g+ A) _* \' e8 v3 h$ T6 w5 E  2 L/ J) ~. [; m( Z8 [: t2 r
std::vector< NXString >  GetProjects () $ o. P5 {: f6 v; f
  Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
  h+ o# A6 R% W 3 ~' T7 b, g* M# W
  % U$ }1 W$ u6 r
std::vector< NXString >  GetRoles ()
! W( m9 n0 O5 b2 ^4 w3 S  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . ' O9 {% Z9 x/ b% o8 Y
& ^, c$ b; Y1 X7 t5 g6 J; j
  8 @  m9 }7 E6 k+ J# z  M
std::vector< NXString >  GetVolumes ()
, `4 P% I7 f7 r, U: l  M- w3 H  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  6 P# I6 k; p' P' v

# p6 K& ~$ e& V0 y. P1 m- b1 R9 x
& u9 U4 z! `; V) _
, f, `; {: X& `1 s- ~static void do_it(void)  o4 o( J! f% s, p  H* c
{1 P" h2 g- }0 |7 h$ B
    Session *theSession = Session::GetSession();- U5 {1 E0 A  _; P. n$ n2 h
    Part *workPart(theSession->Parts()->Work());: i+ o9 X  Q' s* u8 D
    Part *displayPart(theSession->Parts()->Display());  G! O% [* s+ h3 Q& J4 G+ }; J4 M
   
5 E4 U' l1 x# c( w* ]. G    PDM::SessionSettings *sessionSettings1;5 Y6 w$ X% K/ B- ~6 k: f. J( K+ s9 L
    sessionSettings1 = theSession->NewDatabaseSessionOptions();
% ~0 b7 x* J% G    " l7 G3 n* c$ U. V# j
    NXString CurrentGroup;( l7 O1 j& l+ K2 Q! x" I, |( c1 O5 h
    CurrentGroup = sessionSettings1->Group();9 x& c4 Y- R# ?9 o
   
5 ~" |  j' P) m* p    NXString CurrentRole;
( k$ P( p! I4 K9 f* R: u    CurrentRole = sessionSettings1->Role();# K! O2 I" ]7 f$ l
' [: @4 X6 ^4 q& D/ u( T8 A
    theSession->ListingWindow()->Open();7 H# G, d2 q& ?# I$ N4 d
   
0 w+ D; K8 d& W3 w0 e' \    theSession->ListingWindow()->WriteLine("Current Group: ");) L$ e3 U$ u0 L
    theSession->ListingWindow()->WriteLine(CurrentGroup);
* \% K5 s6 V3 @8 u$ H7 Q; G% j        5 g- h7 M: Y. P6 b+ ?
    theSession->ListingWindow()->WriteLine("Current Role: ");   
/ U0 E: o2 V  `  t+ N    theSession->ListingWindow()->WriteLine(CurrentRole);- s9 ~0 }. n1 g- w

1 l5 y- \+ V7 d* K0 w}
" n0 o2 e, g( p- z! M* W4 I
% F+ ~& J1 M7 k; b* G
' b6 U! J5 i# j# i8 @( R. ~9 I2 O2 Z* x3 L' I, v2 D$ |$ \/ h
该会员没有填写今日想说内容.
回复

使用道具 举报

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

本版积分规则

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