查看: 3795|回复: 0

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

[复制链接]

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

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

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

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

×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组9 ~! ?& B' C% h1 T
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!  b8 Y- ]* p/ L
这个类也可以实现设置组,角色,获取卷等操作!
8 s: a6 L# p0 V' o. @* U2 t* z
, G) [* ~( X0 w
+ S6 I$ T5 @! A2 u6 y- Lstd::vector< NXString >  GetGroups () % o* c# i# s5 H! T! H4 v
  Gets the names of the Teamcenter groups to which the user belongs. " }3 j0 S) P" W

) A7 o* V/ i  P7 S7 y7 ?' W  
# q& F) b# [9 `) L1 }std::vector< NXString >  GetProjects ()
5 ~3 C4 ?/ _% h  m2 ?  Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
, V) ~& S6 o: a
% D1 C% }5 ~; I$ Y) Z, y) W  
) X7 {( [. B" E$ {; A- Fstd::vector< NXString >  GetRoles ()
. {* {  O+ v7 D% ~  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
& F" {( G' Z- b- }
: `- C/ |* Y4 U  
, W. R- X. q, Q9 B- v& gstd::vector< NXString >  GetVolumes ()
0 D, _, o4 F6 h' S3 d  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  - [0 l$ j6 ?! d
2 v% P. U9 p* m/ k0 Z7 R* t' y
1 b) d3 M3 t+ [

- o/ C! k, J" A: }static void do_it(void)) K" j* J9 M) |" c- q
{$ h! q- i! V) h
    Session *theSession = Session::GetSession();& X7 Q3 @; F5 F: A, {$ _. p
    Part *workPart(theSession->Parts()->Work());, a( P) d( T3 ]; f: E
    Part *displayPart(theSession->Parts()->Display());3 A4 |1 {1 b6 y7 w+ v: B" X
    8 M8 z) f7 |4 @8 g$ X
    PDM::SessionSettings *sessionSettings1;' m  R: O; r9 J+ t, o; L* h
    sessionSettings1 = theSession->NewDatabaseSessionOptions();; ?( Q9 |. |2 ?* ~/ W; U
    ( u& p3 E& X8 D4 @5 n8 D
    NXString CurrentGroup;' X( W# l3 A) I0 [+ R& y' ~3 p2 I
    CurrentGroup = sessionSettings1->Group();3 Z( P% V3 [# o6 D& [$ b
    ( ]- ]; u! s* B' e/ l% [
    NXString CurrentRole;
/ p. [: N! w) r7 u" y8 _    CurrentRole = sessionSettings1->Role();  @# S) R( N. e/ `4 ^
2 ?" ?/ r# N6 E+ ^! J
    theSession->ListingWindow()->Open();
( Q. G6 @/ B* y4 D7 U   
2 p6 V8 x& F5 d1 I    theSession->ListingWindow()->WriteLine("Current Group: ");9 H( w# ^5 |8 l8 |7 y- ^8 u
    theSession->ListingWindow()->WriteLine(CurrentGroup);
5 V8 W7 G  E' Y) L7 a& i        ; l3 q, B5 y6 {' F
    theSession->ListingWindow()->WriteLine("Current Role: ");    / f& N8 m6 ~: P; h7 R
    theSession->ListingWindow()->WriteLine(CurrentRole);0 k5 f$ l" f+ P6 u5 ]3 {6 o
- a  A2 M( }$ T  ^! u
}
" l" z# w4 `, T& E9 y  k8 H# s' n! I3 K  p8 _
$ |% d0 i; R. I( I% m1 E5 F7 _9 ^. f
* b% s1 q" p8 [/ ]$ B+ W- J  ]
该会员没有填写今日想说内容.
回复

使用道具 举报

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

本版积分规则

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