|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) E' _( r8 @, K3 x, dTeamcenter 二次开发源码分享:替换数据集dataset的引用集, h! n) |3 ?4 X3 K& D/ A; b8 a
; i E/ E' Z% s# X
* ~" I% }; h9 ^' Z! S2 i2 r% m#include <ae/dataset.h>. U+ u5 ~3 w9 }! A% `- ]
#include <sa/TCfile.h>
( S1 j- D9 S5 q+ v/ o, Q+ j6 ^! E" u t#include <tccore/aom.h>+ A* q/ s( B8 d" z, Q
#include <sa/tcfile_cache.h>
3 J4 P- x' [* Q, k& b- o4 f* p+ B$ }7 Y7 N* ]/ l$ y
static void replace_dataset_named_reference(tag_t dataset_tag, tag_t old_file,
* m d# ~/ j5 m1 H1 S% \! j1 a% R char *new_file_path, char *ref_name)
& }5 H: ^& y5 k: z3 W. E! R{8 r' J5 u% r& \( w% T
IMF_file_data_p_t file_data;) p9 ^& E' q4 v& A
IFERR_REPORT(IMF_get_file_access(old_file, 0, &file_data));+ S" f, D* A5 r! w
. K/ w- Z H) U7 Q! k
tag_t new_file_tag = NULLTAG;9 I6 b" G) d% t9 X7 P
IFERR_REPORT(AOM_lock(old_file));. u8 B9 d- y% C2 _) a j4 S
IFERR_REPORT(IMF_replace_file_and_get_new_tag(old_file, new_file_path,6 v# O" P9 {( |) L% R
FALSE, &new_file_tag)); ) L. K4 v+ M/ [/ Q' R2 D
7 ?& {0 ]/ ~9 D+ D, r( B; H4 n, [; E
IFERR_REPORT(AOM_lock(dataset_tag));, J3 D% ^" j8 c* p* g' x
IFERR_REPORT(AE_replace_dataset_named_ref(dataset_tag, old_file, ref_name,
2 y$ E+ b e3 z9 u! [ AE_PART_OF, new_file_tag));- G) [4 N6 M8 K+ Q$ h
% y% m' e/ Z6 p
IFERR_REPORT(AE_save_myself(dataset_tag));/ ]% Z; `1 Z8 l3 P! [
IFERR_REPORT(AOM_unlock(dataset_tag));" z3 O4 k, S5 J! Q0 r' s
IFERR_REPORT(IMF_release_file_access (&file_data));
; A4 X6 n& h/ G) E8 C4 @9 t5 D, M3 k6 d0 L+ ~
/* assuming the old file should be deleted */9 O H o4 p4 q
IFERR_REPORT(AOM_lock_for_delete(old_file));" {) h$ u9 ~ a3 Q w
IFERR_REPORT(AOM_delete(old_file));
8 i( t& k7 A: R& A: p7 j/ a}
4 y8 X7 h" U% N: k5 Z3 A7 u" j
: x0 V) h0 l5 i" O- `1 d |
|