查看: 3704|回复: 0

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

[复制链接]

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

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

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

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

×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
* J' j- Y7 e" B通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
0 E5 Q  q& A, D6 u7 B9 E这个类也可以实现设置组,角色,获取卷等操作!
9 y7 x  Q  k0 j6 |) T/ P
, i9 ?- {, T7 q- h
6 J. K, e2 q5 ~std::vector< NXString >  GetGroups ()
; P7 D) W# F* A; x( l3 P  Gets the names of the Teamcenter groups to which the user belongs.
! z* @/ f) w' j* U3 k0 I0 Q + J- P( Y7 W: |, \' J# |4 `
  7 w# q) L2 G( t+ n
std::vector< NXString >  GetProjects ()
% C6 Y) O1 f0 C. p" b6 r  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 y% T: S- G9 Y% e7 u- F# v

+ i3 r+ l8 T( N" J. h  
# E2 y1 H) G2 j8 xstd::vector< NXString >  GetRoles () & Y: G0 y! P4 B  v+ U+ g4 r. b$ s& U
  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . 3 J+ S1 y3 x2 r! d' {- K) w
) j( ?0 P: P: h" v
  ; }7 L1 C$ N: l1 _& E# @. t
std::vector< NXString >  GetVolumes ()
% e1 n; [! \" ]+ w  j; Y  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  
5 n3 W( Q" ~# C* ]1 v2 K8 D
; N8 B" F/ J* h% V0 A
& P$ N* G1 o9 s% b( r, P) z  I

! g4 z. b2 s8 ]) C# R- M3 s, H! Sstatic void do_it(void)
$ i3 g+ r: e9 w, A6 m{
1 h! e2 D" X: d- W2 S: X    Session *theSession = Session::GetSession();; @  h) f' {  z' u6 L' z
    Part *workPart(theSession->Parts()->Work());3 b# v8 q. v% M/ N
    Part *displayPart(theSession->Parts()->Display());/ j8 v0 i* i; f+ v0 f- S- c, \: l
   
: Q1 a1 \' V! V3 ^( S    PDM::SessionSettings *sessionSettings1;4 q, a. r- ~4 C6 y6 U/ l" i* z
    sessionSettings1 = theSession->NewDatabaseSessionOptions();3 v) W/ U; |7 V- T3 H1 C% k0 g
    ! |/ w* ^" J/ g  a+ ?  E
    NXString CurrentGroup;# A/ S* X7 }8 d6 i+ g
    CurrentGroup = sessionSettings1->Group();# e& `8 R: E+ |  ~
   
8 d& k+ Z; F- P2 C3 }  d2 j    NXString CurrentRole;
. F6 d- Y9 n8 k" e6 _    CurrentRole = sessionSettings1->Role();
6 d* {" b& K4 |; b' P+ i1 n5 d
; _- x& ?; Z; c  r6 C    theSession->ListingWindow()->Open();6 J, O, @/ ~% ]1 S$ l) h; A' g
   
) S2 q: D8 Q% m; E    theSession->ListingWindow()->WriteLine("Current Group: ");
5 Q% s4 y+ r8 }9 J9 T" x    theSession->ListingWindow()->WriteLine(CurrentGroup);
0 u5 @  p2 G& e6 M        
; Y5 p0 G" m$ F/ o7 G    theSession->ListingWindow()->WriteLine("Current Role: ");   
# A  ~7 w2 N2 T! p3 J    theSession->ListingWindow()->WriteLine(CurrentRole);/ I8 G6 X7 j* a0 [  o: k7 x
3 l. B9 o+ M8 V' A# r) i$ B
}$ E* X! R8 f: F5 ^# w: c+ Q3 w
6 K, h7 W+ \* ~8 r5 h! r1 e

3 Q- B/ v; \3 U7 K8 U+ r6 a: _' o8 r% A4 a7 c9 ]0 h
该会员没有填写今日想说内容.
回复

使用道具 举报

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

本版积分规则

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