|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组4 L5 v; l1 |5 x5 S
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!9 S' K: |* ~# ^( j q+ c7 X- d
这个类也可以实现设置组,角色,获取卷等操作!
/ d1 A% r3 x# v7 G* ^4 @2 _" s' N0 F( Z0 v6 m
1 H& Q8 F% N$ t2 @
std::vector< NXString > GetGroups () % Z2 _6 D; ~# `# f
Gets the names of the Teamcenter groups to which the user belongs.
/ Y* m% Y# C2 P- X- N8 Q$ S 9 D- j" P) Y5 i) ^
0 m6 d& B0 @" c4 k* b8 Hstd::vector< NXString > GetProjects ()
( A: ]' ]4 ]2 q3 l' N6 ] Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. * m3 `9 t ~0 {7 |8 m6 {
* D8 P8 F9 w* L1 U0 v
5 t7 k) ]: l; B7 U. |3 K
std::vector< NXString > GetRoles () 3 d: Q2 ]+ k* F- r9 J5 H- D
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
! b" G1 {/ u3 d& h N! b. s- x- x, C, D
6 o# N4 Y1 k" ?7 ~ B
% N' @, w& p: L( z$ E' N, t& I% @' mstd::vector< NXString > GetVolumes ()
% M* W- @+ r' m. {& {$ B) Z) b Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
4 V+ \3 @1 V$ f# ~$ ^
) D! N! q# h6 k _4 R5 X$ a. R5 I9 L5 J% A
! s3 I) T4 N: M
static void do_it(void)! P" P( u0 @# T! h9 f+ e3 N
{
2 D& E J( m* T7 ] Session *theSession = Session::GetSession();, C9 G" u7 k% l) R0 K
Part *workPart(theSession->Parts()->Work());
. t D& r. W! K1 t0 b2 x0 E0 W Part *displayPart(theSession->Parts()->Display());) r7 q. M0 k5 j. S: t; ]' W7 H
: k3 Q: v- q4 ]5 I! Y
PDM::SessionSettings *sessionSettings1;
' U$ Q; _- N3 H sessionSettings1 = theSession->NewDatabaseSessionOptions();
. G# k, R" K, t
: _3 g6 \4 a, K6 h/ Q2 h( `7 g NXString CurrentGroup;( q! @& ~6 w6 Q+ N: p
CurrentGroup = sessionSettings1->Group();7 ]8 d" w5 R% w
7 I' P) r* I* {
NXString CurrentRole;
: V2 I9 X2 B. S( C0 E8 | CurrentRole = sessionSettings1->Role();
7 l1 ^! _- d' N X7 Q, B( b
0 T" ^5 U. h! D& P# X: W/ ?$ g2 U theSession->ListingWindow()->Open();
1 G8 y8 X# P$ X$ `# g* r2 Z0 O 4 |! f4 h! ~9 i1 Y7 x: e* j
theSession->ListingWindow()->WriteLine("Current Group: ");% t2 c" a! j4 Z6 ^, r) Q
theSession->ListingWindow()->WriteLine(CurrentGroup);5 u3 V# S' q% Z" S' b: u) M3 C
% q- P% n1 y7 q; ]
theSession->ListingWindow()->WriteLine("Current Role: ");
2 m5 r( D. k/ X% k5 w' k9 Q theSession->ListingWindow()->WriteLine(CurrentRole);
$ s/ u& L: S' J G6 [8 `4 {& ?
9 B8 r( \3 y& s8 j8 E& M6 H4 a}
8 E: J0 }$ w1 P) N U/ c. g/ G; P( g, d c. k# s- y! w
9 @8 B6 t0 T. d6 U; C' L. N
4 `. o* a) r* i" Q, ]0 n7 j |
|