|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* t5 M( ~7 Z* n2 B
Teamcenter 二次开发源码分享:替换数据集dataset的引用集1 l; v2 ~* @, `$ y5 w. R
0 ]8 C8 R( s4 }! W' X4 k0 `$ H
/ Z9 c l% n$ E. \#include <ae/dataset.h>
; h/ i% q) [" k#include <sa/TCfile.h>2 H: }! |, f9 o3 B
#include <tccore/aom.h>
4 {; |. q* S, h/ Y. a- D: J: [0 B#include <sa/tcfile_cache.h>; O) O1 X% @2 M& N4 I
1 B+ q$ h. i( n, T+ E- v7 D: ?
static void replace_dataset_named_reference(tag_t dataset_tag, tag_t old_file,
9 L8 k/ G# s9 H3 @ char *new_file_path, char *ref_name)3 n9 K5 G: f/ w3 v0 s8 H& j
{) O( e4 ]9 J. m, g3 g- K
IMF_file_data_p_t file_data;
; t; ^8 e- t2 I9 F! H IFERR_REPORT(IMF_get_file_access(old_file, 0, &file_data));6 ]/ ?- y8 S5 T8 M7 t
5 G L" V, S; L& q7 F tag_t new_file_tag = NULLTAG;
6 Z# ?5 ~* l0 S0 ]3 Q9 f) t! P IFERR_REPORT(AOM_lock(old_file));
- s$ C% F+ R2 m9 U# T IFERR_REPORT(IMF_replace_file_and_get_new_tag(old_file, new_file_path,! J3 L, {$ V. d' U8 _
FALSE, &new_file_tag));
/ k' I# V+ K* F0 c
. s* I7 N3 d9 c- v4 n0 f; L IFERR_REPORT(AOM_lock(dataset_tag));9 d- j/ H9 b& A& d5 u6 J2 w1 ]
IFERR_REPORT(AE_replace_dataset_named_ref(dataset_tag, old_file, ref_name,( s* A) d1 ]) L
AE_PART_OF, new_file_tag));
5 c+ l3 g7 Z- w7 f8 E- c; Y* L, x" t+ B
IFERR_REPORT(AE_save_myself(dataset_tag));
4 X. Y) B5 s7 v IFERR_REPORT(AOM_unlock(dataset_tag));
# S. N. Y7 L1 E, i) q1 P0 f4 w IFERR_REPORT(IMF_release_file_access (&file_data));
' |2 O* A- i9 i! F( S& d- B
8 K) K+ Z+ j7 i /* assuming the old file should be deleted */& U( z% h C; C" a; j
IFERR_REPORT(AOM_lock_for_delete(old_file));1 K& h( C/ J, b. j7 P
IFERR_REPORT(AOM_delete(old_file));& K- A. x! ~3 Z$ i d
}9 I& G8 g" d" w
% f% n0 \5 q w: {, G/ D. o |
|