|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: D7 Q8 X$ j9 z5 n; ? `1 N6 gTeamcenter二次开发源码分享:获取对象显示名
% O% { s( k' h. o$ }/ r0 L/ H( M! e0 O% R4 s
3 R8 w( | Y5 g6 g/ E6 ]" S% I) _
[mw_shl_code=cpp,true]#include <property/propdesc.h>9 N2 H t g1 }/ z- Z) E+ J1 G. U
#include <TCcore/tctype.h>) s0 L" _! D( c3 Q6 t- t2 L5 u$ a
9 W( t4 H5 |6 ^& n( R#include <base_utils/IFail.hxx># v. ^8 I+ `0 u
#include <base_utils/ScopedSmPtr.hxx>& k7 C; R5 c9 ]' g; B: d
#include <base_utils/TcResultStatus.hxx>
o- s- J& ?$ T, B* _1 D/ _0 ~5 Z8 {: L; H( o" ]2 T3 ]7 l
using namespace std;
7 e4 S% R8 q& jusing namespace Teamcenter;
5 F* J1 x5 L" a* g6 |3 w
; h3 j o* x, }0 U& H4 }, a0 L* Jstatic int ask_property_display_name_by_type(const char * type_name, const char *prop_name, char **display_name)
) N$ _% P9 D" O+ X# u" p3 O! ]$ V{) w/ w/ E$ ^3 L' A9 n$ @
int ifail = ITK_ok;
3 F4 N7 z$ C9 _* m( c ResultStatus rstat;
) \; A& j3 u' T8 |& N1 S+ @9 o, Y4 O
try
) w4 D; v8 z% g) r {
+ o& D3 _4 ~1 S& U tag_t type_tag = NULLTAG;% c6 B+ s. r+ R% Z) V
rstat = TCTYPE_find_type(type_name, "", &type_tag); : V U* V. x) j+ a) ?7 q. S) r- n
. e& l! c# @* f, R$ b& D2 h8 \
tag_t prop_desc_tag = NULLTAG;
- E6 U5 C) _, P! S$ _! x7 _; c rstat = TCTYPE_ask_property_by_name(type_tag, prop_name, &prop_desc_tag);8 |- Z y, M0 O) z
" ^) l9 ?% L6 u$ W
rstat = PROPDESC_ask_display_name(prop_desc_tag, display_name);
& z- n5 R2 t e. {( @ }
% \- n( E/ M# Z8 S) s# Y catch( const IFail &e )/ c. ^+ x5 P" [$ y: V
{
& h N: K) f/ M+ t! q! t cout << "error " << e.ifail() << endl;
' c% f4 \, Z! q9 J cout << e.getMessage() << endl;
' ] G3 ]2 t2 G G }
% K5 C& H4 {% k1 j R7 f e
1 I, P6 ]4 z5 _' n1 j+ D/ }/ s return ifail; . i- f, F/ L- T9 ^8 C5 { N
}[/mw_shl_code]7 l8 D1 {9 V5 T9 Z' b+ a
|
|