|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
$ `+ r2 X2 J* O% l. d通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!
% p! B$ ?8 z( R7 n( l( l Y这个类也可以实现设置组,角色,获取卷等操作!
1 R1 M0 F; j$ p& D8 L
, O; L, ]# U1 N! U* O& E4 ? + R4 @; c2 ?1 G/ s7 L+ f
std::vector< NXString > GetGroups () 4 h6 i0 A B, F% L* `, G. b" |
Gets the names of the Teamcenter groups to which the user belongs.
6 e$ m. p4 G5 i! w* U; Y, A
( S8 q- _; v6 ?. H3 N$ ?$ B! {; a0 R $ a/ F4 {6 x: M, }# ~2 Q
std::vector< NXString > GetProjects () # O" G& T$ Q9 U% @- b( p$ }
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
) f4 a3 }1 Y, `* B& k $ \: _4 g. a' ?" P
* D- D8 `( y% V+ R' i+ s
std::vector< NXString > GetRoles ()
7 f- b. `8 l0 l: B6 s0 z Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
3 F0 B! H9 d- F7 \7 l' b $ o) D: Z% C; d( W% B$ W# P
2 u6 I. }3 \* Pstd::vector< NXString > GetVolumes () . U8 ~9 S. E+ a& k3 \3 E
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . 9 M: ~2 w( o% U$ c" d
0 ~2 G$ y& Z6 G
4 B" V3 ]+ v0 ^9 c
+ P# ]8 _* h- e2 d" qstatic void do_it(void)' N* X" \/ A3 @8 M8 M3 d
{
. _6 Y, x3 M, d3 B4 h Session *theSession = Session::GetSession();
2 K; O0 ?' O' L) q! C, o5 h: ~! O Part *workPart(theSession->Parts()->Work());8 F3 `& w7 O3 g* t6 h) o! n
Part *displayPart(theSession->Parts()->Display()); I* l' X+ _& r4 |7 D6 \8 p/ S
9 U/ `9 W' ]( S, q% p3 j PDM::SessionSettings *sessionSettings1;
) Z5 T! x" d0 \# @ sessionSettings1 = theSession->NewDatabaseSessionOptions();
) y1 D9 t! x( u" w) o 7 o; Y1 j- b2 j- v' A9 I
NXString CurrentGroup;" A2 D$ ~9 W% X7 \2 N. B
CurrentGroup = sessionSettings1->Group();
5 P8 I, } l+ l- ?, q q4 X, K * l; m/ _- Q3 q' t9 x) m+ o: t* y
NXString CurrentRole;8 f( u! y2 g" ?, R$ [ @
CurrentRole = sessionSettings1->Role();. j: B* q6 s- j/ u( p' w
4 e# y4 B9 }6 X8 S theSession->ListingWindow()->Open();
" V1 \1 g& j6 [9 x1 g - X% D! U) L) j) ?- ^% J' k
theSession->ListingWindow()->WriteLine("Current Group: ");
" i* o) m9 h/ S3 A. K* l: M0 W theSession->ListingWindow()->WriteLine(CurrentGroup);1 r3 A0 J, t, J' s- P4 `$ y5 u
6 T* a1 l0 I8 D) E/ Q
theSession->ListingWindow()->WriteLine("Current Role: "); / z: ]) H6 u# {/ b% |4 `. f
theSession->ListingWindow()->WriteLine(CurrentRole);; B" ` P# b' Q8 B
. w5 u" U! I: Z- O7 B9 k/ Q}
4 A8 }0 ^ j# ~, |% D# K6 ^" r% [& _" ]: ^
# X1 h3 X# [/ g7 o. c$ N' M: u8 t& K+ N& j/ J8 ]
|
|