|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: N6 q: k& c- l( Y3 u
Teamcenter二次开发源码分享:获取对象显示名
+ y C- k9 [: [; k3 s a! P' F! m+ ^. m& |% K) }
- M! a' }* [/ P6 u9 o/ r0 _2 U[mw_shl_code=cpp,true]#include <property/propdesc.h>+ U: h" A4 v9 v- q" R
#include <TCcore/tctype.h>
* ]4 `/ ], |/ z2 f2 y B( l1 u, k& E( Y* Q% g
#include <base_utils/IFail.hxx>
7 H- T) J- ~! }; Y8 d#include <base_utils/ScopedSmPtr.hxx>! l2 Y6 a. Z9 C6 ^$ l1 y4 U
#include <base_utils/TcResultStatus.hxx>
* s5 ^7 }5 i d' Q k+ B
# \' O9 H+ N5 ]1 z8 \using namespace std;
* U2 s& u4 ^5 m+ z4 Ousing namespace Teamcenter;
# J- A j: F" p& F- k9 L: D' D |* q+ n8 z. n% @7 @$ @) H/ l
static int ask_property_display_name_by_type(const char * type_name, const char *prop_name, char **display_name)
# e( Y$ j9 [/ i/ e9 ~; }# |: x; A{% G8 M( g% C, I2 V
int ifail = ITK_ok;9 B' J0 t+ |' N# i% D) }- ~
ResultStatus rstat;
. \' p: J5 ]4 F& s* N$ m
) |9 m( k& \( d5 f' \ try
: B; R1 m$ l; r4 { {
8 I% }3 w7 q3 L# f' h3 M3 I# N7 ^+ ? tag_t type_tag = NULLTAG;( d/ I2 P0 J: T4 c: I
rstat = TCTYPE_find_type(type_name, "", &type_tag); : n7 h# H* L Z9 `2 Q6 O
( Q; j/ o, v% T8 V- J4 x; O tag_t prop_desc_tag = NULLTAG;
/ O0 s! f2 A5 d& \3 C rstat = TCTYPE_ask_property_by_name(type_tag, prop_name, &prop_desc_tag);; X4 u0 n/ h/ C$ N) j. V. `
, i- P' ~" y6 y( r5 s; S. ^2 B/ e rstat = PROPDESC_ask_display_name(prop_desc_tag, display_name);
. \' v6 |. ]. O }; ^! Y) L( U) {! m) T0 @
catch( const IFail &e )
0 S! P0 Z8 O+ t* W. x; i' b9 A {
; O$ I: b0 X, T# d& Z I8 R* o cout << "error " << e.ifail() << endl;
* @4 z( V6 x" o' N4 d8 v cout << e.getMessage() << endl;
% c5 h; E, L2 s3 l. M/ H$ Y }% H4 g/ t* p1 I+ E8 D; ?9 j; A2 `) T/ I
" P/ a* ?4 V# Y5 @
return ifail;
: J" ? k5 G, x3 [7 w}[/mw_shl_code]
; [1 Z3 A' Y' M |
|