|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) X m$ ~# t9 e3 \" u* i( DTeamcenter二次开发源码分享:判断对象是否存在在数据库中% ]1 u9 Z5 _$ T; ]$ }8 s
8 z7 R" x& V9 M# \- r$ o2 o#include <TC/tc_startup.h>+ _8 S8 L. H8 f, `8 ~
#include <pom/pom/pom.h>
* Q* `2 ]$ Y, X' @' n#include <ITK/mem.h>
' q* x. C& }5 Z2 v- z#include <tccore/workspaceobject.h>
' G# c7 q; Z( N2 A$ e1 M1 P( b$ B, g5 v* F& } K
logical is_instance_in_database(char *variable_name, tag_t object)9 t" z5 v4 K. _4 |
{
0 u* E9 w5 o; Z logical exists_in_db = FALSE;
}+ I, M+ ^ t' j if(object == NULLTAG) ECHO("\t %s: NULLTAG \n", variable_name);
' |6 @; d. s- V) l else$ `9 b* h, f4 q8 c& H. Q/ l
{& R! a7 w" `; \% d9 J5 |& L
char *uid = NULL;4 N6 D% U* |6 e" j6 H3 Q" s
ITK__convert_tag_to_uid(object, &uid);3 d1 @; C2 }: A& ~9 U a, I
POM_instance_exists(object, &exists_in_db);! a% ~& ?( Z: W
if(exists_in_db == TRUE)
, W/ s2 q1 Y/ @3 v0 Y {7 }3 P) G' {4 M1 ?9 y
if(is_WorkspaceObject(object) ); x. T9 d O4 H* y' n- }. c
{ H- E1 ?$ y1 K/ B4 c) ]0 C. i/ T
char *object_id = NULL;! [6 `% v/ S6 V5 d0 O( p
IFERR_REPORT(WSOM_ask_object_id_string(object, &object_id));/ y4 D6 X" E" \. {) A
char *object_type = NULL;! f3 R7 I: w8 d: ]$ ^7 y4 c1 ]+ S
IFERR_REPORT(WSOM_ask_object_type2(object, &object_type));/ y+ D/ a6 C/ J2 L& d
ECHO("\t %s: %s - POM_instance_exists: true %s (%s)\n",
' X1 g$ q( c6 z2 v variable_name, uid, object_id, object_type);
3 j4 ]& v% M! f2 a* k q if(object_id) MEM_free(object_id);" S& L( s6 g! a7 A7 Z( r
if(object_type) MEM_free(object_type);
* u6 V, h: Q4 X, b5 @0 x6 |+ g }7 s: }* s( g' ~- |
else ECHO("\t %s: %s - POM_instance_exists: true\n", , V0 O# q! g2 b& j! X( y5 j9 O
variable_name, uid);3 m6 G% n; g4 d( W! Q4 ~8 x
}& F$ G/ T# r" J/ V V
else ECHO("\t %s - POM_instance_exists: false \n", variable_name);7 x" G* p) J5 q ~
if(uid) MEM_free(uid);% u0 S; j3 A, _; J
}0 m" k. r. } v X) \) E
return (exists_in_db);' ^$ Y7 M: f( K
}$ M% ~- T% s7 a
|
|