查看: 3922|回复: 0

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

[复制链接]

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

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

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

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

×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组0 z# R5 D1 Q0 k+ A5 {
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!/ ?! N1 D2 W6 e0 e
这个类也可以实现设置组,角色,获取卷等操作!3 u4 d; B% m$ f+ x. c  W
8 ~* y' x) _3 e! S

4 A3 ^) D: `$ B2 V+ Mstd::vector< NXString >  GetGroups () 8 _/ _; |8 i6 y( v4 v  v) U/ W5 ?6 f9 A
  Gets the names of the Teamcenter groups to which the user belongs.
& C' W1 [$ ?+ K. [ . s; N: f$ ?% L2 n( v( e  a2 s
  6 l9 U2 N( v$ r; J
std::vector< NXString >  GetProjects ()
) r: o5 U# X+ v  r( C) 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.
, i& ]0 z5 W# j9 v2 I+ { ! X+ `0 \, x1 E$ q1 H+ F; O
  
' L; K6 c, p4 _1 _+ gstd::vector< NXString >  GetRoles ()
& v$ |; M  ^& Y* [$ l  e( ?  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . , Q) x$ ?3 s& B
5 k+ B6 p. Q& W% {; Y. Y9 ^( O
  1 m- N+ G. n4 _8 I# ^/ R$ j
std::vector< NXString >  GetVolumes ()
1 t0 g& c+ F6 }; B/ ~  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  2 E" I- a4 W( t9 o* Y2 U5 I% b
2 J; u% n: i% X) h8 N) f
/ z) E+ a7 d) a; B$ A
# _7 X2 I) h9 V! l
static void do_it(void)
( w; ?0 l- D# K{$ Z/ u& y0 [4 ~0 I+ _
    Session *theSession = Session::GetSession();8 C  E1 W' c6 i, @. ^0 }
    Part *workPart(theSession->Parts()->Work());
. L* W. [  F1 s6 V/ e, D+ p    Part *displayPart(theSession->Parts()->Display());
: D3 _" S- T, r: F! ?9 r) \5 Y1 t   
/ t# Y/ m: P/ g6 Z% ]8 A( z$ A3 e    PDM::SessionSettings *sessionSettings1;3 B3 P! A( h1 x6 l* z/ m
    sessionSettings1 = theSession->NewDatabaseSessionOptions();% e5 p5 H: a; R) [( ^4 B( B7 M$ P
      [, `" x6 K/ j
    NXString CurrentGroup;
2 n( X* Z7 o" C1 M( _; r- P2 v    CurrentGroup = sessionSettings1->Group();
& u. f/ C, L$ @; G' ^+ [   
5 D; o6 t1 {2 O3 {3 A5 r    NXString CurrentRole;7 {- H5 s$ B  y# ?6 Q9 \
    CurrentRole = sessionSettings1->Role();
% U; r7 z% v& g
) {. t. V5 x  o" ]    theSession->ListingWindow()->Open();5 @4 v3 G' z& |! W, V
    . Q6 d  ~4 G9 _
    theSession->ListingWindow()->WriteLine("Current Group: ");
1 K: w) s/ p1 n( `- m$ D    theSession->ListingWindow()->WriteLine(CurrentGroup);
- ?6 g: j: B. [% Z& x; T' C        6 q. c# S  {- F
    theSession->ListingWindow()->WriteLine("Current Role: ");   
" r% N" x: q1 W    theSession->ListingWindow()->WriteLine(CurrentRole);0 B% g4 t# T" o7 K- Q

5 n/ k$ K' @7 o8 U, _) B}; ~' E* C) V8 ~" l/ Z, ?+ o- S! K
9 d- ?4 ~! T  m0 b

- x; k# ^2 R' a( D/ f4 s8 C' C9 d
该会员没有填写今日想说内容.
回复

使用道具 举报

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

本版积分规则

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