|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! T0 `( [0 E' q4 j& N. l: ITeamcenter二次开发源码分享:判断对象是否存在在数据库中
# Q" ?' Y$ z- k2 b( ~) t# o5 S% c% w$ \$ H; }
#include <TC/tc_startup.h>0 P8 O0 j& c# M
#include <pom/pom/pom.h>3 d6 T$ d$ f) X) i
#include <ITK/mem.h>) u0 U' l6 s" M3 e/ Q+ N
#include <tccore/workspaceobject.h>
5 m- T, T% _% G- ~* N4 o
# Y" O7 I! w) i- p( U1 o0 klogical is_instance_in_database(char *variable_name, tag_t object)
* E$ u5 w0 c4 [# p6 N- k L" Z{ J- |$ c9 Z; L. _8 \
logical exists_in_db = FALSE;
: t6 A$ A5 s! z5 w3 x. i5 w6 ~ if(object == NULLTAG) ECHO("\t %s: NULLTAG \n", variable_name);' Q9 o7 S. e0 Q5 ^
else0 _- f; E8 d2 N5 `3 v7 `1 R2 V* C
{; u8 ^; W& {2 K2 r
char *uid = NULL;3 a" Y1 v6 I0 p3 z( j% i: O
ITK__convert_tag_to_uid(object, &uid);
' G& K3 l+ k# w- V" y { POM_instance_exists(object, &exists_in_db);
! k+ h$ s' p9 q if(exists_in_db == TRUE)
1 G1 q* D' E2 l, b" O4 D {
) b6 H$ y+ h5 p' K3 L4 H C if(is_WorkspaceObject(object) )0 |4 Z$ Q% X/ [
{9 F9 z0 e6 B# A6 [5 A
char *object_id = NULL;) {0 h0 n; Z9 L9 @8 [+ H3 _0 p5 e
IFERR_REPORT(WSOM_ask_object_id_string(object, &object_id));6 o% k; K9 D/ \7 [
char *object_type = NULL;
+ a, f7 m* w& N/ Y/ R8 J! ^8 a) ], ^6 r IFERR_REPORT(WSOM_ask_object_type2(object, &object_type));
) d6 y# Y$ K2 A ECHO("\t %s: %s - POM_instance_exists: true %s (%s)\n",
: @ i) A M5 b; g! s+ t0 { variable_name, uid, object_id, object_type);
. U' d3 V3 Q- s# Z4 O if(object_id) MEM_free(object_id);! P+ E2 U3 | U: j& D. B$ Q
if(object_type) MEM_free(object_type);
4 u7 O: b. g7 f! r" K; y }
5 }7 U( o7 d0 a( B- v" V else ECHO("\t %s: %s - POM_instance_exists: true\n",
3 E& |& d5 H3 C4 _7 o1 F variable_name, uid);! A! t0 i- u, g
}
3 U/ L6 ~) |# | else ECHO("\t %s - POM_instance_exists: false \n", variable_name);
, Y8 N: l" K/ F/ q8 q ? if(uid) MEM_free(uid);, ~2 i$ `% T! |) [' Z
}
/ X; C" p2 W: x0 z4 N2 \: F0 ?. L! o return (exists_in_db);' d0 z9 [% E/ h t5 F5 T
}
8 r' j" i/ q8 @0 l7 u/ L: n( [ |
|