|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 p- M+ I4 ^. DTeamcenter二次开发源码分享:判断对象是否存在在数据库中8 R1 I6 C. ?. \ h+ e% R [5 c
5 P: b. t$ G M1 r( P. M
#include <TC/tc_startup.h>
0 g" F) Y# m- z5 V/ A' ^8 |#include <pom/pom/pom.h>
% B% _ C/ i% ^/ f#include <ITK/mem.h>
4 g0 e% U) j( z#include <tccore/workspaceobject.h>+ S: U/ P% |/ T% J! G! s6 D
% r- p9 V4 f; @' z4 U( K5 |
logical is_instance_in_database(char *variable_name, tag_t object)
# T1 ^( C; K/ F8 ^% z{! s# L. S' `- K( q% c3 Z
logical exists_in_db = FALSE;! @6 q/ A! O6 [: P- {# }
if(object == NULLTAG) ECHO("\t %s: NULLTAG \n", variable_name);
5 J- L5 ^, O. I4 @ else
9 G# ~7 I8 ^$ P( v- e& x5 d7 N0 X {
. b+ h* P& M2 y char *uid = NULL;# E/ d; x4 p) f$ j; |8 P5 S% w# F
ITK__convert_tag_to_uid(object, &uid);2 v( L! [$ z$ \2 L) [
POM_instance_exists(object, &exists_in_db);( N8 k$ g- B, ]1 x
if(exists_in_db == TRUE)" ?: Z. ^/ S6 q% z4 p
{
7 x( W! j; M: V: Y5 V if(is_WorkspaceObject(object) )7 W0 J9 u r, i
{/ z& l8 W. U; X+ b
char *object_id = NULL;
% p$ l# ]. @$ ^1 ` IFERR_REPORT(WSOM_ask_object_id_string(object, &object_id));8 v1 a; \0 L4 P, x4 O+ _6 L! C/ m( ]
char *object_type = NULL;. {; G3 K$ y# |8 E
IFERR_REPORT(WSOM_ask_object_type2(object, &object_type));7 {& z/ i% ^5 {
ECHO("\t %s: %s - POM_instance_exists: true %s (%s)\n", 6 G$ S1 U+ m; c
variable_name, uid, object_id, object_type);! ]; f5 k; Z' a" P$ O2 n
if(object_id) MEM_free(object_id);4 l- J( {0 [! n! C4 H. Z2 j! P
if(object_type) MEM_free(object_type);$ D& a0 ?9 D/ ^- L8 Z8 X# f
}$ D7 Z# n6 X; E. x
else ECHO("\t %s: %s - POM_instance_exists: true\n",
# B7 Q# j# Y8 r3 o. q: y4 @ variable_name, uid);8 K) k, L) T0 J
}+ R/ E" Q6 d& G' Q/ }+ {& \
else ECHO("\t %s - POM_instance_exists: false \n", variable_name);
% Y, A+ Y: |/ i+ F o# p$ H2 B/ P if(uid) MEM_free(uid);0 E' U6 ?1 h f
}
4 ?1 h, I5 x$ Q! C8 k return (exists_in_db);( W7 }- G% b1 u; @. u
}- @* B& E/ m! k2 y, c
|
|