|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 u' j: o: X9 _$ v4 A# W8 A& S9 b. F% O
Teamcenter ITK二次开发源码分享:创建自定义文件夹3 `+ C* P6 \% _
输入的第一个参数是文件夹名称,第二个是文件夹描述。% @/ F; k) W6 i4 g
' |, n1 Q* M1 `
6 ]& m9 m+ t) A#include <TC/tc.h>! T8 P- S$ Z& O# T7 l2 b3 R
#include <tccore/aom.h>
- y. G) ^( o# \#include <tc/folder.h>! z! V! a% C- S9 W; c
#include <tccore/workspaceobject.h>
# g) T$ r- G% {; q0 L# D! n5 y
/ e& k+ H+ l m#define EXIT_FAILURE 1/ r0 T8 R8 ~ r
+ y3 q3 h0 o3 D1 \static void report_error_stack( void )6 Z0 R( Q( J! }) b% q( B s
{
3 O' m4 G; \+ l4 S7 ^9 x7 V( k int
y. m2 @1 C' j' { n_errors = 0,/ K. c J) F. J7 O
i = 0;( c5 A8 s2 f1 O( J3 w1 J& k/ `
const int
! t. M% x% e0 Q *severities = NULL,: m9 P) G; B* ]) x+ Y. |: u
*statuses = NULL;
8 l9 `- l# k( f1 K' g" c- D const char* t( H1 }: W5 w4 |, k$ L
**messages;
9 I7 s2 q6 i6 M6 x& q# ^
" B) ? V* ?7 x+ s% d; c EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
2 @$ o% W9 Z6 `. h% }+ r printf( "Error(s): \n");
5 A0 C, n* I8 B9 n9 { for (i = 0; i < n_errors; i++) & r( w2 w3 v: }# L% M& C
{. I M/ i5 O* z) |- ?
printf( " %6d: %s\n", statuses, messages );2 I8 `# b/ @( t9 ]
}
: r3 V* _$ [) y7 X5 x. I" s exit(EXIT_FAILURE);" K9 f& z+ E4 O! J; R0 ~! n( U8 B4 g
}
. y; B" y; d0 Q @) T1 e
* ]3 U( S W7 }9 c' Q6 }int ITK_user_main(int argc, char* argv[])
9 @, R0 N3 y J8 E- M$ v{
# z# h, b' M" E int4 a: t `- A3 N$ R$ L, r
status;+ {' E$ ]* ]1 O3 R' h7 M6 U% r/ ]
char* U: p, r6 K' M/ C* M; p7 t: Q! a
folder_name[WSO_name_size_c+1],% o% p& \; \" L* H
fldr_desc[WSO_desc_size_c + 1],* k! ^# ~; Z1 ~8 b
*message;
" n+ r; |1 Y! i7 A tag_t9 O1 F6 b. c' R' M, L S
new_folder;
0 m, P5 C' G9 H1 q9 Q& J3 ^
- X, x" q- s; m0 G1 _8 n& M ITK_initialize_text_services( 0 );
3 w/ ]3 ?9 [& {* F status = ITK_auto_login();& A& k s) b* V/ x4 H& M
if(status!= ITK_ok)
- q! I- o, K$ K" s {$ W" D* w# o- ~/ d
report_error_stack();
! X( N: {" p+ X- R1 f! G: _9 _5 e }
# a4 J7 U6 \: E' C else
5 Q" t6 }$ ]) X& ]! A m1 N {
' E4 I! n" V! {. f. E6 ~- B printf("iMAN login successful.\n");& a6 d2 d* {. `9 |9 U; p
}
# v) q# ^0 A- o) N. _$ R
3 D9 b. d' S: n( \' Y9 O ITK_set_journalling(TRUE);5 A# n8 V" |4 i
) d1 E7 @9 p1 J if (argc > 1) strcpy(folder_name, argv[1]);" l7 c- v$ Y1 d( H2 C( o3 f
else$ J) J3 V; G& u& S2 \* G g! g
{
% _; I U3 y {. q2 J' ^ printf(" Specify the Input in Following format : \n");
3 ]. z, ^3 s1 V printf("program_name folder_name folder_description\n");
$ n! b* |5 t& f9 X printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
4 K R) g% x8 |* h. ^: \" P) \+ J return ITK_ok; # Q5 y2 D& v5 c; K5 I
}
2 o, B, D1 H4 `- o4 k3 p4 }( {! m4 p2 I7 M# h+ x& m! [
if (argc > 2) strcpy( fldr_desc, argv[2]);) O/ t/ M P' _4 H. R' C2 e
else strcpy( fldr_desc,"");
$ z- _4 n9 `, i* v) j3 m! S [* j9 N" `3 b. Z- }
status = FL_create( folder_name, fldr_desc, &new_folder);" C$ s" N4 e5 o+ A* A. z+ q
if(status!= ITK_ok) report_error_stack(); : h& B7 G" A( V& f4 r: M5 e
9 F3 v4 {9 J l
status = AOM_save(new_folder);% P7 p; }+ X" D) M. R5 h- S! i* ^
if(status!= ITK_ok) report_error_stack();
. O- d8 F3 H, x4 Y& ~ else printf("Folder '%s' Saved; ", folder_name);- N5 F2 F9 X5 r7 {+ m
- X/ T6 g+ o U# {7 s5 @
status = AOM_unlock(new_folder);
: l, K+ R+ v7 y0 V if(status!= ITK_ok) report_error_stack();6 G6 P0 t8 n1 a9 t
else printf("Unlocked; ");
; j* G1 B0 n$ A
; M: x, M( E) V4 Z- C status = FL_user_update_newstuff_folder(new_folder);( d- H" V) p% } c% v, Z
if(status!= ITK_ok) report_error_stack();
: M3 c# s! m0 G$ @+ S5 y1 \! { else printf("Put in Newstuff Folder.\n");' G& c6 J8 G, A. {$ e
) w X- v; v+ B" Z8 x% J7 g
ITK_exit_module(TRUE);
; g, ?$ I% h$ w6 ]9 ~& U$ y1 } return status;, n- B/ \& y, N" J* g) s" ?; |! b
}
3 t) T, H0 U( w/ `* w! L' z* \ |
|