PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

mildcat 发表于 2014-9-27 21:10:30 |阅读模式

mildcat 楼主

2014-9-27 21:10:30

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

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

x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组; @+ l* L, X1 }6 R8 N! v
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
( o3 c) h& q0 ], j$ q这个类也可以实现设置组,角色,获取卷等操作!
7 n0 K5 ~: K, v+ v, G4 I; O9 g
$ j8 B. ^# _) l6 M  B0 V
3 }0 a' l( {  N( C& estd::vector< NXString >  GetGroups () ' v8 \3 n' y( `1 X4 P
  Gets the names of the Teamcenter groups to which the user belongs.
* v, S- o/ t7 D4 K9 R  X/ j
) R  g, ~% D, Z6 Y  
, K5 c/ V% W, U! Y/ ]. {) y  a5 z2 c( Dstd::vector< NXString >  GetProjects () 8 u1 d" e; N# [8 z7 _+ |  m/ 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. 5 u$ b' Y2 E- k( k% _

8 T; A6 O* B& k- \- b5 J7 {  3 W6 H! C0 E+ _: Z! A: m8 _
std::vector< NXString >  GetRoles ()
$ N0 Y% N- z1 \# `( m8 p; V3 r  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . ; f4 [4 U; v. u. C
5 B) v3 e* {% C* j4 K$ N
  " J. K7 w/ a6 L4 d9 b& E. p6 W
std::vector< NXString >  GetVolumes () 3 s0 i9 _# f' @. H& A& k9 c
  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  
/ @: B9 R, T0 C! K" J

2 D4 y8 E, J0 C5 U% P* I1 _- F' ~7 j8 T! M! R0 d
1 ?) I6 E0 y# b( U& X! O7 g
static void do_it(void)
+ t% b) f$ s  x{' Q2 b3 ?, ?- U: _0 ~- p, K
    Session *theSession = Session::GetSession();
2 w, h6 g  o/ B7 q5 y    Part *workPart(theSession->Parts()->Work());
' k: S' H1 e/ U1 {  x" [+ o, i    Part *displayPart(theSession->Parts()->Display());
6 q: h: F3 G: X# a' W( o   
" v% ~2 \8 t% s" `" P1 b    PDM::SessionSettings *sessionSettings1;
2 L7 _* D6 T+ [    sessionSettings1 = theSession->NewDatabaseSessionOptions();
, r3 \- t6 n$ u( V8 \# V" h    0 t! A: v7 L0 e. z: V- T/ `) F
    NXString CurrentGroup;
; z6 T' l( v* N* s& j4 P    CurrentGroup = sessionSettings1->Group();! Q% T- `5 I. v' D6 v
    " @' m1 y8 t4 n' n
    NXString CurrentRole;
" p+ i2 F5 ^6 U    CurrentRole = sessionSettings1->Role();
8 k- W) g+ y% i: k4 O8 Z. K/ q% C$ q  }7 y- d& ?! i
    theSession->ListingWindow()->Open();
4 c; S1 L2 i! K, w; G( |, j5 i   
2 C/ q. O% r, F0 Y0 J2 b    theSession->ListingWindow()->WriteLine("Current Group: ");: U( _" ]8 Y3 l
    theSession->ListingWindow()->WriteLine(CurrentGroup);" X( r1 o5 p' ?+ p8 E- T
        
" P) r4 S5 N6 i# I+ _! ]4 \# O+ W( @    theSession->ListingWindow()->WriteLine("Current Role: ");   
7 q- a% d: \# t9 |    theSession->ListingWindow()->WriteLine(CurrentRole);# f6 `+ {) X9 x8 @7 o

0 c" V) }+ X3 G0 x1 D}0 N1 f+ j# X  P) ]' N2 a" v
# Y4 @9 j0 g' r) _1 V
5 F& v; A' d! R) S- N, A2 |6 O& A
- B" ^0 W, @$ W3 Y9 {
该会员没有填写今日想说内容.
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了