|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 Q& ~, A0 d9 [9 L" r D2 g1 m
Teamcenter二次开发源码分享:获取对象显示名
. ^1 b w8 B) L d, W
& r. ^* D! F& \$ M+ ]) r) A& u4 @
[mw_shl_code=cpp,true]#include <property/propdesc.h>
3 t5 D4 b) O: b#include <TCcore/tctype.h>) T( j: N# j. |$ B8 j4 u
9 [7 h/ f* {, j#include <base_utils/IFail.hxx>
( {% t& Q C6 Z' N$ y r#include <base_utils/ScopedSmPtr.hxx>5 C# C' u- h( a( q6 V7 m
#include <base_utils/TcResultStatus.hxx>
, A; P9 i& p2 a/ {4 R( e4 m' W2 P% H6 M3 m* K' l B
using namespace std;
+ X9 f" n- ~; g9 U9 L3 r3 ]using namespace Teamcenter;5 o8 G5 X& U$ U( c
, J& l9 Y/ U0 D2 @
static int ask_property_display_name_by_type(const char * type_name, const char *prop_name, char **display_name)
" O e! Y* T7 i5 E/ C{
$ X% j% {9 D, k5 j p3 n int ifail = ITK_ok;
$ g1 @( I7 e2 y( V% A Q ResultStatus rstat;
* X# H: t) \! g) t" l" h0 A( n0 L6 i7 V3 {+ H' [ M6 Q1 ]
try
! N' s) s5 S0 a% x$ E0 u {
! O) c [+ M! f h- A! V tag_t type_tag = NULLTAG;
" a& Y* s8 F$ ]0 T1 Z7 n/ P- o rstat = TCTYPE_find_type(type_name, "", &type_tag); 1 U6 J C+ A2 H) F5 e
, x4 ~; U, l: c* A: m
tag_t prop_desc_tag = NULLTAG;
" [/ D) A2 `7 l1 Y$ \ rstat = TCTYPE_ask_property_by_name(type_tag, prop_name, &prop_desc_tag);
( N' V" J# ^; O6 T
1 M, d* K# d# B: W rstat = PROPDESC_ask_display_name(prop_desc_tag, display_name);
& A, c+ @* C& j+ g4 q J0 K& p6 f }" t8 ]6 `" w5 W0 ^3 [2 x" R/ f
catch( const IFail &e )* ]6 C9 f2 _) @4 v
{
* Q+ A6 m& d1 G( a* `4 e6 e: ~) x cout << "error " << e.ifail() << endl;
3 Z& i. N( S& W/ J8 e cout << e.getMessage() << endl;
- B( y# F- \( a4 c }1 C5 V$ G* @; |* O6 i) V
/ {( F/ ?9 W; o9 p I' P% S: n return ifail;
. p6 X* p% P& ` e' R}[/mw_shl_code]
7 ]+ X& O5 g& f8 F4 f, ] |
|