|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter ITK二次开发源码分享: 替换命名引用name reference
& h$ Y5 y0 |7 s5 s' E" |; r/ K- [; w( z- Q3 D% D' n
4 C6 ~9 f% w) ^
- #include <ae/dataset.h>
* H0 H' V7 H( L) T+ A! w7 W - #include <sa/TCfile.h>1 @# f* U1 F0 H; ?* g
- #include <tccore/aom.h>% W* a' N1 u8 F( O+ |0 O- i8 B+ Z
- #include <sa/tcfile_cache.h>: ?- y2 z- g. |7 G) R9 x5 b# F
- 2 o2 Q0 P; m0 \+ ^+ l" O" s8 F
- static void
2 R. [- P; b8 @- H: U - (tag_t dataset_tag, tag_t old_file,
* J1 C j) Y# Q; g' X+ f* k - char *new_file_path, char *ref_name)
. c, J4 Y# U$ f4 O1 J0 q6 f5 \ - {% k e/ F0 k4 d/ G# n" h7 }9 W! ]
- IMF_file_data_p_t file_data;
+ p" ]( f3 @" |, W; S" m - IFERR_REPORT(IMF_get_file_access(old_file, 0, &file_data));! n8 M j4 v% @5 f8 S/ C, M' X
; C! o: v0 `- S$ E% Y" ~- tag_t new_file_tag = NULLTAG;, a% i+ z0 Q6 G. S2 L: Q" T( u
- IFERR_REPORT(AOM_lock(old_file));
$ M6 k4 p$ Y; J. u* h) {9 j0 D - IFERR_REPORT(IMF_replace_file_and_get_new_tag(old_file, new_file_path,
. S. Z# M( X# H" [- ?/ u - FALSE, &new_file_tag)); 0 z+ S8 v2 ?! y" s& M
- " T( E" j! \- g
- IFERR_REPORT(AOM_lock(dataset_tag));# A8 @2 q' k3 N+ W( b* Y5 I( w
- IFERR_REPORT(AE_replace_dataset_named_ref(dataset_tag, old_file, ref_name,
) y4 A1 h( R0 D- a - AE_PART_OF, new_file_tag));
1 [1 _3 U( t4 v, q# ?& [2 D5 Y - 9 T# z8 x# }$ \) s6 @; j8 l! f( }
- IFERR_REPORT(AE_save_myself(dataset_tag));
- @! G$ \$ V9 h G; t8 ~4 | - IFERR_REPORT(AOM_unlock(dataset_tag));
( ?" f5 C+ Y9 Q ]( P# o - IFERR_REPORT(IMF_release_file_access (&file_data));) f- l& Z! N" e) }3 N
- + M, ?4 _* m! J# h9 Z. m6 I
- /* assuming the old file should be deleted */
3 Z* e' Z; z% _9 W% s, |) Y - IFERR_REPORT(AOM_lock_for_delete(old_file));
! v- q- N) L4 M+ [/ p+ F - IFERR_REPORT(AOM_delete(old_file));* O) P1 n$ t" T; p
- }
复制代码 ( u, I3 y) V9 G, w5 P
0 U) f0 O1 S2 A7 W5 I0 Y
. _9 P4 y/ {& w |
|