|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
" G) y6 f% `$ p6 f" ?通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!! d; A+ e7 Y; v0 H
这个类也可以实现设置组,角色,获取卷等操作!
. ^+ ^& K1 K, E0 H# c. C0 b* G% K
$ P2 B8 i9 \/ k) V" K/ y) E4 S9 T
std::vector< NXString > GetGroups () 5 O$ c) e# ?, G" A8 \
Gets the names of the Teamcenter groups to which the user belongs.
5 [6 h- r) o5 H7 M - x" M; H8 [( H( }
, n; `# C, ~4 d# b2 rstd::vector< NXString > GetProjects ()
/ b6 ?# `0 N( i9 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.
+ s1 i g' l; q9 \# D% j/ l( ^
& `. O! T: T6 l/ J/ r 9 {* L! }* I& F5 f: p2 P
std::vector< NXString > GetRoles ()
; Q, m5 L4 J- A1 i/ H6 H) ^ Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
/ M5 ^. K/ L- J' a" M ; T5 z7 O2 }8 \
& R! O$ X( F5 t% C' istd::vector< NXString > GetVolumes ()
$ S* Q3 |/ S3 T( o7 H3 B Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . 4 N- ]* ?8 d ^1 z5 u% V
: Z, m) \; l7 p2 g
0 ^8 ?. r2 w1 z* f6 K1 M
; ^' M3 w+ j+ u8 ?$ Estatic void do_it(void)
0 W$ t% E0 a9 F+ R4 b5 R{# e7 m' t6 V7 u3 y9 d; \
Session *theSession = Session::GetSession();
% g- r$ v# l! L6 p Part *workPart(theSession->Parts()->Work());
: {: z0 J2 M) _" r$ s Part *displayPart(theSession->Parts()->Display());
2 V; B" b/ c- C! U1 u
& r. \+ `! d" b& u. G2 ^ PDM::SessionSettings *sessionSettings1;7 ?0 O% C! W. p
sessionSettings1 = theSession->NewDatabaseSessionOptions();
0 T4 g: z+ A" ~1 t ) v2 r: g7 F3 z
NXString CurrentGroup;
% o0 d B- L4 z, K8 p CurrentGroup = sessionSettings1->Group();
6 ^! v6 N# d! K- ~5 ]
. V$ d2 j7 n% o7 ~. b NXString CurrentRole;4 I& t; y' [( [; [8 |4 S2 Y: E9 x/ q
CurrentRole = sessionSettings1->Role();
0 I3 ?; W; y. w3 B5 w! I7 b" n9 q* P' m6 s9 R5 [' q& j
theSession->ListingWindow()->Open();( {( T# U" w' r$ u3 i% I9 ?
7 b8 P/ A1 C0 |2 q
theSession->ListingWindow()->WriteLine("Current Group: ");$ K! |6 @( T; D5 S0 k, x- \8 T
theSession->ListingWindow()->WriteLine(CurrentGroup);
% f% T( A6 m9 B
( [0 ]- S9 @( ~( E. Q theSession->ListingWindow()->WriteLine("Current Role: "); 4 k8 c/ b& Z, d/ H/ `' f
theSession->ListingWindow()->WriteLine(CurrentRole);- D4 r/ H) v7 [
+ Q' V& `- D1 X3 v8 x- ~! ^}" k! @) L7 T1 ?' G4 d" w
3 l6 x0 V! q; A5 H
, o# N7 Y* F) { M E2 j
0 l* T$ l# {/ M8 O* M" j
|
|