|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% g; q* c) M u9 c; xTeamcenter 二次开发源码分享:替换数据集dataset的引用集
/ }7 p, f0 q4 G% c4 N6 v, s- l& Q. k- S4 y u8 T, |
. t8 z" `0 n( `0 p7 x- J
#include <ae/dataset.h>
3 | l" S# p1 f: ~ W/ l0 u9 e#include <sa/TCfile.h>
! b9 @! @# [/ w: S0 \3 M0 Q#include <tccore/aom.h>% K) Y7 D0 d V3 n/ J. U0 C, m
#include <sa/tcfile_cache.h>
9 T2 R+ H6 O" ^. ?, Y/ ]8 B% S: i' u5 J4 Q
static void replace_dataset_named_reference(tag_t dataset_tag, tag_t old_file,
, P0 y, i9 Z. r/ V8 B char *new_file_path, char *ref_name)+ Q) C; h3 ^- V# b
{
7 K! i) [5 v" s( g# W m1 n IMF_file_data_p_t file_data;
6 w! t- h% G4 a# k d! | IFERR_REPORT(IMF_get_file_access(old_file, 0, &file_data));
% h3 |- m% B' e6 Q, j( G% o O, G1 g/ ^7 Z
tag_t new_file_tag = NULLTAG;. b5 X: m( o: F$ c- k8 c
IFERR_REPORT(AOM_lock(old_file));& k3 F5 V# N# O+ t" \
IFERR_REPORT(IMF_replace_file_and_get_new_tag(old_file, new_file_path,& c$ S! G& T; H H1 _
FALSE, &new_file_tag)); 7 h1 e! h0 j8 |/ s4 ^& I
& h' S0 R9 S+ B/ m6 g5 u. S( F0 R
IFERR_REPORT(AOM_lock(dataset_tag));
0 b3 k$ S" h$ H) c7 J8 V7 L IFERR_REPORT(AE_replace_dataset_named_ref(dataset_tag, old_file, ref_name,6 k* e: F4 ~9 x( G+ Z
AE_PART_OF, new_file_tag));
' e+ V# C. S* u, H: B7 ~2 @8 w% C) N! B7 X3 ~
IFERR_REPORT(AE_save_myself(dataset_tag));: b Y2 S. P# d D; D. P$ x
IFERR_REPORT(AOM_unlock(dataset_tag));5 F0 s5 ~# C4 n" J, E
IFERR_REPORT(IMF_release_file_access (&file_data));; Q# w) G+ s2 Z$ n: P
/ g9 {8 T, o! R- H) ` /* assuming the old file should be deleted */
$ n- K' _2 P; Z0 z IFERR_REPORT(AOM_lock_for_delete(old_file));$ o" U$ X) a: z# c% m; D
IFERR_REPORT(AOM_delete(old_file));8 D3 p6 S! g0 p" L' j7 u$ C( Q0 u4 \
}
3 g1 k% @7 W( b. a( m) W+ a& o! Y) Q$ n) }
|
|