|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组4 l+ c* {+ b) M. M$ l6 [
通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!+ \- K$ `& d1 n+ ~+ L" B
这个类也可以实现设置组,角色,获取卷等操作!) r& @# X; `# J! u' o7 m% v
, F3 n# }5 R* a! G$ ?9 I" k
$ B% C8 h0 P$ h! g2 J x2 j" W- \
std::vector< NXString > GetGroups ()
3 E2 k% n) ]( n* \8 M2 r Gets the names of the Teamcenter groups to which the user belongs. 6 u8 x) R+ m, ^6 H8 N! Y; S
0 Z: v: H1 c+ U1 s5 _) M, w7 N : K. A% k& R) T6 q
std::vector< NXString > GetProjects ()
( J( w/ _( q* P$ f Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty. : a5 j6 p# y$ l; F
6 U+ c& I$ N7 ~3 _! n
' ~0 r7 s% e1 d+ `$ estd::vector< NXString > GetRoles ()
: L. m8 G% I# a1 Y: c! ^ Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group . - l1 O) [2 w, y* u
- w% T6 F5 y9 ~7 Q
3 T: q. f3 U( o; i6 R' Vstd::vector< NXString > GetVolumes ()
, h! y6 O+ O& x8 W5 g2 K Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
% |/ `6 |& w% b2 o6 B/ c0 i R3 a" x8 r5 t# t! o* ^" {' Z6 z* ?
% |( h6 X `3 T7 | j
7 W; b$ M: |( d0 n6 {static void do_it(void). `% d9 p9 c6 ] k" D. j
{9 s# a8 y6 A, s# S ]" t' b
Session *theSession = Session::GetSession();' P/ j$ C! B" d0 U/ v8 b! T
Part *workPart(theSession->Parts()->Work());* o3 e% k; L; h4 a; r% \0 Z
Part *displayPart(theSession->Parts()->Display());4 S* A$ o: B% K5 m0 R! E; E
6 a, \9 c8 \$ P# |& w. x
PDM::SessionSettings *sessionSettings1; X1 j+ l; E+ O1 h( O! q
sessionSettings1 = theSession->NewDatabaseSessionOptions();5 {& p# ], P# m3 P7 P/ ~; T
- U4 k& f5 e, B
NXString CurrentGroup;
) _* w& B; u9 P2 S. y0 t$ { CurrentGroup = sessionSettings1->Group();
v/ u0 [6 {8 |! ^3 A
& ~ ^' W) E1 |& y1 V! I NXString CurrentRole;5 E G. X$ `1 R( F% e
CurrentRole = sessionSettings1->Role();
" Y' f8 K: ]6 C! c7 {8 b# m* f" c1 V4 D' Q: I1 J Q
theSession->ListingWindow()->Open();2 j: \, w. U/ y8 F5 Y; Q4 s# Y
_- c1 r1 i, t) \3 m: O
theSession->ListingWindow()->WriteLine("Current Group: ");. r# j, o0 x9 p4 s
theSession->ListingWindow()->WriteLine(CurrentGroup);
3 j# H! P6 }+ j0 p% } ) e0 t! D5 q3 R U# O: Q; Y0 e
theSession->ListingWindow()->WriteLine("Current Role: "); $ r w5 y/ R& G& I, N7 L
theSession->ListingWindow()->WriteLine(CurrentRole);& z( C6 [' I4 E g$ F2 Y5 O
5 S3 G8 R* M" g" Y}: {, B, [1 y$ x5 C
& {) Y2 l" b3 P/ M0 x0 T! R, M
* {, @, i$ `0 G2 C v3 h2 y' j7 s, o- M; A* H' p, h0 a1 `% _' w
|
|