PLM之家PLMHome-工业软件践行者

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

[复制链接]

2014-9-27 21:10:30 3550 0

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

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

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

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

x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组, p: d/ _  j* y( ?6 u
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!$ p* x7 o/ H' \- u+ ^* g9 P1 u' t
这个类也可以实现设置组,角色,获取卷等操作!- a) D* y& U7 O" B
0 a, H, }0 z0 g6 C, p' G
4 `* ]& I4 h5 k% R4 Q2 D
std::vector< NXString >  GetGroups () * W$ e4 R* X8 f) v6 I
  Gets the names of the Teamcenter groups to which the user belongs.
, d/ x3 H, o7 a9 {5 q + \: ~& F- I5 u5 u2 d* w
  
' z3 \. w6 P1 hstd::vector< NXString >  GetProjects ()
3 m/ E. K. f/ ^; N  Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. / k( X$ }0 P7 J. C! ]: c9 Z

: _4 ]: x( r+ f* u  ; L3 @2 X& J% m( Y/ G( z
std::vector< NXString >  GetRoles ()
2 j3 U* f4 V6 T0 N; V  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
& a, B/ S- w/ e5 b 4 R' p* X9 A# N& p2 h
  0 y) X: v+ {0 B# F' O/ M
std::vector< NXString >  GetVolumes () . z! b1 R3 _) X$ P/ W( o
  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  4 D1 a7 F: F5 @6 n

! ~3 O, ~, g7 \- y+ @' j. `: o
2 P* c3 v9 u+ B
2 A1 d3 h8 ^" b. j1 i: K, Astatic void do_it(void)7 f" p$ m, M/ s9 ~# ~
{: ^# ?) h1 y) i9 [9 e4 @- a
    Session *theSession = Session::GetSession();
5 J* c" p8 H6 q5 W4 [6 R. A    Part *workPart(theSession->Parts()->Work());: O; g+ U- O  G0 V8 u0 ^# u, ^: t
    Part *displayPart(theSession->Parts()->Display());
8 l. ]( Z& K, a    $ X2 `" l# {& x
    PDM::SessionSettings *sessionSettings1;
& J$ p$ L  G" L) K% K0 y    sessionSettings1 = theSession->NewDatabaseSessionOptions();- V; B( \+ f9 u+ Q
    ; D$ h7 c; D! h* b" T& n
    NXString CurrentGroup;0 c, A1 d" U' R4 t0 n" J
    CurrentGroup = sessionSettings1->Group();
* @# c- C' R* W3 d6 |4 h! q% N3 ~4 S    6 N( l; f" ^; C6 ~9 E, E* Y6 s) I% o
    NXString CurrentRole;
; S$ R; D$ @9 {/ z: k# K# d; ]1 c    CurrentRole = sessionSettings1->Role();, ^; J7 w( ]; |) z

  b. d8 w; P- W* A6 b! W    theSession->ListingWindow()->Open();
+ \2 ]9 Q2 ]6 S! i      T" D. j  H; }! w9 ^$ Q
    theSession->ListingWindow()->WriteLine("Current Group: ");
8 b  W7 m2 t2 E" R4 D, T! e    theSession->ListingWindow()->WriteLine(CurrentGroup);
: Z1 Z2 M7 _! X2 c        
# m$ n& F! ?0 t2 I2 G; p5 F    theSession->ListingWindow()->WriteLine("Current Role: ");   
  g2 [( a9 k, G- _    theSession->ListingWindow()->WriteLine(CurrentRole);
/ Y3 a; k2 v9 `- _6 m! r
3 O% W' T+ P9 J1 Z. T}" V1 r# _) y/ ~. W! H# g6 h2 c4 J2 j
4 o9 [) F4 b# G% A
; D+ K/ h% h$ \$ _3 q3 Q7 @* t* Q8 e
* @  Z9 ~4 z" @2 b* }- r
该会员没有填写今日想说内容.
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了