查看: 3621|回复: 0

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

[复制链接]

320

主题

226

回帖

9784

积分

管理员

PLM之家NX|TC专家

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

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

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

×
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
. K+ O3 o2 ?5 k7 E+ @8 p: k" o通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!4 \- q9 x' L" U( ?9 E
这个类也可以实现设置组,角色,获取卷等操作!; T$ X1 v" c8 @, \7 Q5 K
) G9 o+ G* w. |9 L

; M2 q! j4 |9 _: D5 I' e* [' A2 l. bstd::vector< NXString >  GetGroups ()
1 C& N8 E" ~- l8 w, G  Gets the names of the Teamcenter groups to which the user belongs. 0 u* H" x, D& p6 U- _

, v, `8 O7 u1 h+ K0 J1 K6 @  
4 I0 C& j* N! v9 j, }std::vector< NXString >  GetProjects ()
2 \: }) f2 M) f+ I" s8 a" [  Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. ! _' n' I( n: J- [& z5 l4 e& x- p

; J4 r6 e, n, S9 t  0 r, |8 x) j* C% B' o
std::vector< NXString >  GetRoles ()
( J/ \1 f# U3 F  Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . # a% I+ m! b1 ]0 \, D$ @

6 H0 e& V6 h2 }# z  8 N) y8 _1 L! y- _
std::vector< NXString >  GetVolumes ()
* A4 A2 i' j% Q, q* q3 d  Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .  0 r# o4 C3 G. Y- J5 r' l& `

# Z5 J( p  `' R: m6 b5 D+ V' R3 X4 G% K# {% Z7 s
$ b( K5 c7 z8 `8 V! p& q
static void do_it(void)) N5 L; y  D$ E5 B/ P2 u
{
  ^( G5 z1 R" |% V: [4 k7 G    Session *theSession = Session::GetSession();1 a+ z$ H' ]2 t0 i: B+ g, p8 R
    Part *workPart(theSession->Parts()->Work());* P# T( C! g3 D" `- M4 G
    Part *displayPart(theSession->Parts()->Display());
" G* E- c8 x8 ]+ H! H4 @    6 @4 x: y# ^. Z( E( j! G
    PDM::SessionSettings *sessionSettings1;( r; k- E" u, d1 @, v- u: X8 r
    sessionSettings1 = theSession->NewDatabaseSessionOptions();  n+ k7 H0 _' e2 \
    6 s, |/ U: r5 ?
    NXString CurrentGroup;- P  s& x# l7 J* c  b/ J, j
    CurrentGroup = sessionSettings1->Group();4 X3 H+ @( ]. p( @
    ; _0 F7 j8 h8 ]/ G
    NXString CurrentRole;
$ v5 i3 s% z2 U    CurrentRole = sessionSettings1->Role();
$ t# K, ~1 t+ Q6 b8 E: K. Y
2 T2 ?  e/ ~4 d# T    theSession->ListingWindow()->Open();1 r9 C0 x- W8 e( I
   
, w6 r# a% F6 w3 I. ?4 ^    theSession->ListingWindow()->WriteLine("Current Group: ");- \, {7 R0 M, V" e# x4 V7 b
    theSession->ListingWindow()->WriteLine(CurrentGroup);
+ p+ v" }& ^" t3 v1 i. F" p        
, L: N2 j! G3 e; _6 t    theSession->ListingWindow()->WriteLine("Current Role: ");   
& W: H8 V7 z) v  [' L; {    theSession->ListingWindow()->WriteLine(CurrentRole);
$ n5 x+ N/ V6 Y5 U
8 `4 j1 v, p6 ~( d: Q6 z}% s2 V% B5 e$ g# S2 f6 u
* l7 e/ y/ f  j5 V

8 ]) H. y6 Y' x4 j% m9 v( l6 G0 [# S# T/ l1 Q
该会员没有填写今日想说内容.
回复

使用道具 举报

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

本版积分规则

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