|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
UG NX二次开发源码分享:Teamcenter集成环境下,报告角色和组
- l$ p* u' t* {9 O: B v0 z通过NewDatabaseSessionOptions,可以获取teamcenter当前账号的组合角色!2 u4 Y+ e: |; B, A; A. J0 c3 Z
这个类也可以实现设置组,角色,获取卷等操作!
( k9 I+ o' V- s, y8 T0 G9 f# q) u% p) U$ c$ b: A$ T: h1 C3 U9 A
* {5 \+ [' s/ f# j8 Z3 B
std::vector< NXString > GetGroups ()
P# O* [7 ~( g7 @( E/ ^ Gets the names of the Teamcenter groups to which the user belongs.
( t- u- C3 S$ s! d" i2 i$ g ' E, K- [' F- \$ D- t: h
- G, ]- m2 O; M+ a7 v7 ?/ a
std::vector< NXString > GetProjects ()
( A* f) J+ n8 L6 d1 A5 _: s. ~ Gets the names of the Teamcenter projects to which the user belongs also the first entry of the returned projects list is always empty.
& h, \! o' u# y9 \6 Q8 y3 A + g2 S1 t/ O# s0 _) b& p( a% t
- ]# S6 C3 c% v0 s0 P+ Xstd::vector< NXString > GetRoles ()
2 L2 ~; R8 x3 L* J3 o/ G Gets the names of the Teamcenter roles in which the user may act, given the current group returned by PDM::SessionSettings::Group .
, y3 P2 m5 l2 X $ z6 r' r V2 _( O
8 U1 R; `' \2 ]& m0 Lstd::vector< NXString > GetVolumes ()
L9 Z. x6 D, F W2 V" e- ~; Q3 ` Gets the names of the Teamcenter volumes which the user may use, given the current group returned by PDM::SessionSettings::Group .
; R, K0 _" ~1 F- K
* f1 T- r/ l% N& _/ X. N1 e# _! J9 e
/ G) V/ j! ~) ]5 r( `, f6 C. B7 M! U$ x! M
static void do_it(void)
. h7 K1 D- X8 c! p% I' j{" ]. I+ b5 ^8 O1 C' S9 y6 S
Session *theSession = Session::GetSession();
4 ~3 F4 k( O u4 E( ~' q7 Z. s, q3 j Part *workPart(theSession->Parts()->Work());
5 Z' r0 j+ R$ _ Part *displayPart(theSession->Parts()->Display());/ R9 Q; Y# [7 I3 `/ p
7 [& z# I3 i8 ]7 C* y
PDM::SessionSettings *sessionSettings1;
{: `2 ^$ `; ~# @$ [ sessionSettings1 = theSession->NewDatabaseSessionOptions();
% \' w( n4 Z, C3 K' M/ U" E' p % P5 h3 }4 o: I5 g
NXString CurrentGroup;1 r: t/ z! M# B2 }" S
CurrentGroup = sessionSettings1->Group();- W9 t. v! ?3 j
. Z! C0 S0 y; \/ I" p+ K( F' y* r* `6 Q7 r NXString CurrentRole;
7 W/ b" n2 D# v6 Y9 g9 f CurrentRole = sessionSettings1->Role();4 \; a' z2 \ h7 e E _: g
/ @. M! w1 V3 i+ @# {' w theSession->ListingWindow()->Open();0 z5 J6 ]% _3 D6 \
7 F2 Z( z A% q' ?# e3 h theSession->ListingWindow()->WriteLine("Current Group: ");
! j, p( D: o2 Z: R$ g/ v theSession->ListingWindow()->WriteLine(CurrentGroup);2 y: g8 O) q% d
' i [4 a9 i; Y' a: p- b# O) a
theSession->ListingWindow()->WriteLine("Current Role: ");
1 N2 |) q$ d# o" ?. D1 L theSession->ListingWindow()->WriteLine(CurrentRole);
0 L0 j' X' }% x, f
0 x+ W. v b! Q% Z& j6 `}4 v5 M) j( [: o/ @
T. b+ K4 ]6 Q$ X6 n
1 h% Z2 a/ y' c0 p% A0 }6 A! w$ ]8 \2 s8 e. p4 J4 `% l
|
|