|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 ]$ J3 m- I e+ L! |' O8 T/ U
Teamcenter 二次开发源码分享:替换数据集dataset的引用集9 z4 b9 q6 C( o( P- y3 }* D( M2 T( E, _* h
6 U7 Z7 f! t. I+ d5 G% s
( @8 S, @% O1 O3 v4 f. I( h#include <ae/dataset.h>; W. n' t! W7 f0 B" H
#include <sa/TCfile.h>" P/ }; h4 c- u6 ]2 r
#include <tccore/aom.h>
' D! y2 o& ^$ L* ~#include <sa/tcfile_cache.h>2 [4 L/ v0 \( e
- q" a; J0 G; ]- F/ l
static void replace_dataset_named_reference(tag_t dataset_tag, tag_t old_file,
( {4 V% k6 J. j* j, v) W1 q6 B char *new_file_path, char *ref_name); F# i+ \" {' ]
{
0 s2 M" Z T+ l9 ` L: ^2 k# _1 g5 F IMF_file_data_p_t file_data;; Q% S' { h8 V- Q
IFERR_REPORT(IMF_get_file_access(old_file, 0, &file_data));
( ?+ O$ P1 e1 A& U! Y( g( L) V( D* X5 v* }0 F5 U# \
tag_t new_file_tag = NULLTAG;$ W& [3 ?( h8 {& b$ O7 P3 g
IFERR_REPORT(AOM_lock(old_file));. Y5 @ ?) m4 y# L* s7 \
IFERR_REPORT(IMF_replace_file_and_get_new_tag(old_file, new_file_path,6 _9 Q4 `4 q1 f2 o# }
FALSE, &new_file_tag)); + z* S; |/ _ J0 F3 l
6 L) F( L. p( W3 x0 B8 ]$ ^4 u6 w- H IFERR_REPORT(AOM_lock(dataset_tag));) D- ~8 Z8 `1 J
IFERR_REPORT(AE_replace_dataset_named_ref(dataset_tag, old_file, ref_name, u! r9 Y# i! T; M
AE_PART_OF, new_file_tag));
* ^3 k. k w& S7 d6 ]7 l
4 f% @3 w: ]/ E6 h H- E IFERR_REPORT(AE_save_myself(dataset_tag));
, f, ^6 N. e, h IFERR_REPORT(AOM_unlock(dataset_tag));
o* f$ D8 D$ @ IFERR_REPORT(IMF_release_file_access (&file_data));
/ z+ B e! u5 `
/ b9 h ^+ T% U# v$ h3 N /* assuming the old file should be deleted */- C/ u1 ?; a& @- S' D# Y
IFERR_REPORT(AOM_lock_for_delete(old_file));8 C P, H( Q+ {0 D
IFERR_REPORT(AOM_delete(old_file));" q& U& ]0 c6 ~: p! i/ {: P* ~
}+ o' ^3 g& Z5 W, b! C8 y
8 S- y! f% h; [' T$ e5 ~ |
|