|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ u8 Z' c5 i* B! o2 j2 k- D: L9 \Teamcenter二次开发源码分享:判断对象是否存在在数据库中7 Q; \' b2 e/ V* L
6 }# g; e& t* Y+ u& ~#include <TC/tc_startup.h>( K+ c- X( T- N+ W, L+ ^
#include <pom/pom/pom.h>: A0 [4 _* n3 I
#include <ITK/mem.h>- W# _4 T6 o0 }/ R5 i2 P2 R
#include <tccore/workspaceobject.h>3 r- l& a/ @, r) k, K; Z
& ?9 S# x; B* \3 N* A, e/ x
logical is_instance_in_database(char *variable_name, tag_t object)
) @' s4 _# U' t$ f) U2 R* ~' t{: F) i; h5 r4 T. g8 f! x1 u5 T% Q8 N; [' `
logical exists_in_db = FALSE;. Q$ K1 m$ k3 g2 B" Z4 `3 m
if(object == NULLTAG) ECHO("\t %s: NULLTAG \n", variable_name);/ V% }: X* ?$ O b7 Z
else
4 H# ?% A; P8 R9 Y% _ {
0 I. f3 a0 `, o) H; i6 q- R2 G a) o8 i char *uid = NULL;
8 b$ V+ p4 Q+ l ITK__convert_tag_to_uid(object, &uid);
* Y5 Z: j/ e X6 f6 O POM_instance_exists(object, &exists_in_db);6 J: ]( A% X% Y
if(exists_in_db == TRUE)
, j* v; x8 ?+ O1 O# m# ` }- j {$ M6 m+ w1 [+ F% K
if(is_WorkspaceObject(object) )
8 z' ^3 g2 V7 v! v5 u+ j. ~ {, c7 {( G* S6 m& p, Z
char *object_id = NULL;
; A3 C0 A/ N7 T* p IFERR_REPORT(WSOM_ask_object_id_string(object, &object_id));
" a* @/ e9 n& b char *object_type = NULL;5 u9 Q' K! [8 p
IFERR_REPORT(WSOM_ask_object_type2(object, &object_type)); I& E7 T/ p5 j/ L! L- P7 y1 s
ECHO("\t %s: %s - POM_instance_exists: true %s (%s)\n",
3 d& m7 N9 o, e- w variable_name, uid, object_id, object_type);/ y7 K. L) c, U7 T% g0 V( H. b0 G
if(object_id) MEM_free(object_id);% X! j& O' E1 v) Z4 w3 s' b" j
if(object_type) MEM_free(object_type);" x9 L) M1 }$ J3 {% J( W" _5 {
}
5 }! ^! V- f$ s0 d* C% W else ECHO("\t %s: %s - POM_instance_exists: true\n",
% J/ d' _' j y$ O W6 V variable_name, uid);
6 o! u% F4 U, x' g9 c }
: Z _& g4 }# S8 h8 C% g( ? else ECHO("\t %s - POM_instance_exists: false \n", variable_name);
4 v9 V" N- @, d: B( l8 S if(uid) MEM_free(uid);. M' Z4 D8 d% S1 u- h7 j
}
8 C2 ?( V. _# W+ [9 t2 F5 l: J return (exists_in_db);
/ r" k# [* Q" Q! m3 O1 B2 W; y}0 ~3 b: l. `8 q) f
|
|