|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
L# s0 ^3 i/ z% e6 K' o6 j( w通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!) v& K8 V+ N4 ~7 G
这个类也可以实现设置组,角色,获取卷等操作! q: j6 S/ b4 \5 G5 h
$ W0 ]6 e3 {9 o& S+ p
# A( r9 @/ r$ ]/ m0 S6 P
std::vector< NXString > GetGroups () 5 ^$ [6 }5 P8 C1 b
Gets the names of the Teamcenter groups to which the user belongs. - X1 ^3 ~' c7 P' S5 v3 M* V, X' E+ ^
. i. Z, u% w/ D/ Q6 c
$ q# }+ L" ]3 z" l! Jstd::vector< NXString > GetProjects () ( c5 Z6 _, M* \- W
Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. % X6 B0 ~; B5 e* h" [* }
8 _/ w2 V j. g
6 R6 e ], F; y" y- s* ostd::vector< NXString > GetRoles () 8 u: ^) n1 q+ g, n' x
Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
% v! C2 q$ t7 J
# p8 w2 e# B( O% b" T! R z5 C
* c$ B8 e+ \2 Astd::vector< NXString > GetVolumes () 5 U, S* D# ^ Q& P6 h0 s, l
Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group . 2 U! D& w, e* Y( e
* S1 t; t; G" H9 F& E6 P
% w. I# S7 y* Y9 y
4 E+ h) }) w- r' M
static void do_it(void)
3 H; n0 l. z1 f8 f{8 d9 h- V' c7 a
Session *theSession = Session::GetSession();
% u7 m- @* `/ `/ v% q# q Part *workPart(theSession->Parts()->Work());
6 w Z) `; i* L1 w! O8 {% m Part *displayPart(theSession->Parts()->Display());5 O9 \+ V* z' Y& u" F3 M* Y
/ x5 {9 V% u" y3 _4 M+ _) h, U
PDM::SessionSettings *sessionSettings1;6 _5 A8 x+ P I# o. G4 [
sessionSettings1 = theSession->NewDatabaseSessionOptions();0 {: Y7 `# b0 M3 V
. |6 M. F$ f0 c) ~# W! y
NXString CurrentGroup;8 `: ~7 z4 q* J7 Q
CurrentGroup = sessionSettings1->Group();! M5 s @/ X5 ]. Y
8 o: j! f& d6 f* x: |
NXString CurrentRole;: l! P6 w0 f5 p
CurrentRole = sessionSettings1->Role();
7 r: ]' D& y/ T; r% U+ Y2 p- d# M' m7 n1 X
theSession->ListingWindow()->Open();
: B l7 Z, N& g2 N 0 v7 k0 l# [0 x" z, h7 c/ e& u
theSession->ListingWindow()->WriteLine("Current Group: ");
- B" X7 }1 s. ^! K2 H theSession->ListingWindow()->WriteLine(CurrentGroup);1 G! r) F9 i {/ W' v
; g' i; V9 `% F- s; ^
theSession->ListingWindow()->WriteLine("Current Role: "); 9 I) ^! ^! l! Q6 h
theSession->ListingWindow()->WriteLine(CurrentRole);' ?2 B" J* G7 d: r0 S
; Y1 E3 s# @8 c, ~5 O8 {9 Y}
- N0 h/ @) G, b$ M. h1 h4 T
4 \( w4 U8 D; B$ k# J4 ?" l3 F* @' A7 x4 y2 h$ E* B; k4 H% N
T6 g5 u* S8 ?' j5 F |
|