|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ R5 ^5 H& i+ L# |" z
Teamcenter二次开发源码分享:获取对象显示名2 @, Q7 E+ g: ^0 Y2 t. z
& [4 C% {( I$ W! X7 i0 l7 {( h' ~' ?4 E* K1 a. a/ q
[mw_shl_code=cpp,true]#include <property/propdesc.h>0 o8 B# a9 ^/ H/ C: S
#include <TCcore/tctype.h>& H' v% K; {' \, @- j6 [. n, B
7 l ?, m$ c0 b#include <base_utils/IFail.hxx>
( y* N! v( l3 R; Y' r0 y% N4 P#include <base_utils/ScopedSmPtr.hxx>
8 S5 Q+ e- ]. x+ z4 S* v#include <base_utils/TcResultStatus.hxx>
6 L, s9 Z% M% ~ ]! j: }
: r! S6 ^8 l4 U6 Q6 x' q: Lusing namespace std;
# _7 m9 j' i* h6 ~, G; c/ ousing namespace Teamcenter; S$ F& o! w; Q* m$ b
; S( u6 C9 U8 {+ \# l
static int ask_property_display_name_by_type(const char * type_name, const char *prop_name, char **display_name)* [5 {* w- U: E
{
9 b7 Y1 q7 F1 t* r4 J& F+ d9 J int ifail = ITK_ok;
5 s g2 C. W$ ^. u ResultStatus rstat;
4 H$ g4 U4 r3 d1 P4 o- l6 z8 {% x- p
try
2 H q9 d' s8 Q1 b {9 x7 A+ M I6 c6 u4 p" p" t
tag_t type_tag = NULLTAG;0 X% T7 Q* H: g
rstat = TCTYPE_find_type(type_name, "", &type_tag); ; B# C- E+ l- j
/ M- U9 O0 E+ Q4 A
tag_t prop_desc_tag = NULLTAG;
# E4 a2 u7 U3 C* ]0 e rstat = TCTYPE_ask_property_by_name(type_tag, prop_name, &prop_desc_tag);/ f1 g' y4 T `, y& d
( J' P6 R6 X' \- Q! L& `
rstat = PROPDESC_ask_display_name(prop_desc_tag, display_name);
0 {3 Y3 f$ B/ b1 E( G) R7 P& v0 I }( N& w V& A$ }
catch( const IFail &e ); S% @ q7 w4 x4 [
{
* V0 g2 s+ k# l' p cout << "error " << e.ifail() << endl;
- w. T9 v- _ L: Y8 F cout << e.getMessage() << endl;
1 _: ~0 l/ [3 N }
% n9 U3 ^$ M7 ~! j8 Y6 g; E
. A. V/ S- A; B; B ^: [" }8 U) W return ifail; 7 R$ ~% E+ Y) A0 I" a( I0 q
}[/mw_shl_code]
( b; g) t# F- Y7 f4 C |
|