|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ k! E+ v6 Q( S4 h4 B$ F/ KTeamcenter二次开发源码分享:判断对象是否存在在数据库中
) w7 E) l; m& ?4 j3 k g3 z- M6 W# E R* I6 s
#include <TC/tc_startup.h>) [1 G6 R. m" p/ V! W& E9 `. Z2 M3 |
#include <pom/pom/pom.h>
c1 x3 G' @/ C4 e" n* [, b" S#include <ITK/mem.h>1 x: m+ L: s2 v! b3 a
#include <tccore/workspaceobject.h>/ S O- B3 `# C+ t1 @! W
5 ? _! Q2 ]* E- M; p
logical is_instance_in_database(char *variable_name, tag_t object): D$ D& g2 y8 L) @& ~$ `/ B& a! X
{2 L7 K. Y9 K( F ?6 Z) N
logical exists_in_db = FALSE;
. S- d. B5 Z: t if(object == NULLTAG) ECHO("\t %s: NULLTAG \n", variable_name);7 B j# S" E. X
else8 U2 Z% i2 t5 M
{
) l8 f b5 t1 |* R char *uid = NULL;
4 d$ O5 F/ a3 P: o+ b( F ITK__convert_tag_to_uid(object, &uid);- q+ w6 Q. {7 L- {7 O8 z
POM_instance_exists(object, &exists_in_db);6 m3 I. J. j7 D% [0 g3 O* [
if(exists_in_db == TRUE)
e, d$ u# ~# |- I8 V5 L0 U {
9 ?9 m5 A* e% T1 R1 F8 c: b if(is_WorkspaceObject(object) )
7 H/ W2 z7 D+ n: D/ K {
6 t! Y: J5 a1 O/ W9 P" s char *object_id = NULL;
3 U5 g- J; |% N" n b8 O IFERR_REPORT(WSOM_ask_object_id_string(object, &object_id)); h: H- K) r3 O' f
char *object_type = NULL;
% [$ v, \8 F& ]) \% p2 `6 Q IFERR_REPORT(WSOM_ask_object_type2(object, &object_type));
; g8 {+ P3 N$ X% K7 P1 ^( k ECHO("\t %s: %s - POM_instance_exists: true %s (%s)\n", " ?' G; Q8 v# e s8 \* V0 j
variable_name, uid, object_id, object_type);
- s7 j# C( G9 p9 Z+ ]1 K: x if(object_id) MEM_free(object_id);3 D0 t4 D% v6 ^0 y
if(object_type) MEM_free(object_type);
% ], v# @% ?5 V* F' i* t! ^ }/ N2 W/ S; r1 s7 b4 a7 Y
else ECHO("\t %s: %s - POM_instance_exists: true\n",
3 v4 B4 O2 P$ B- k3 ?9 M: S0 `7 G variable_name, uid);
, f* k: Y% _* x2 y( j7 w9 G }: @, M5 j1 U) o/ F( G9 q0 h/ D9 B
else ECHO("\t %s - POM_instance_exists: false \n", variable_name);. h& h+ |: d5 ?
if(uid) MEM_free(uid);
2 e. d+ K' Q7 {3 U3 n1 P2 R2 a }
4 ~' a0 s" H4 V4 p/ T4 O return (exists_in_db);
8 q8 X. K5 V' j5 L/ N}
; j' B' a _- s6 a$ A1 p |
|