|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: w0 `+ ^) r% [( D0 B, `% s7 v# N8 C
$ F% D4 O- H; X3 d' ]4 y- u5 VTeamcenter ITK二次开发源码分享:创建自定义文件夹
" K. o2 F' Z/ L2 R; Z输入的第一个参数是文件夹名称,第二个是文件夹描述。
% A8 A7 p& H0 q6 n2 `1 f" c/ M$ E2 u* N7 c: a' z
( G# e1 R- A& ]
#include <TC/tc.h>% x+ @, C) [4 U1 [! }: {; J. |
#include <tccore/aom.h>
7 B$ }3 ~4 T$ J#include <tc/folder.h>
8 Y; x0 _$ C; }4 X#include <tccore/workspaceobject.h>
/ `/ z3 `5 t. T4 r X' J
+ D$ D# @$ O- t2 @#define EXIT_FAILURE 1% l9 w. R2 `& q
; G/ j; y' w. {static void report_error_stack( void )
% K1 O5 t% @" K& h {
7 s- J3 ]0 y, H9 Y0 [+ H int' Q' b2 J# `3 \' u1 a6 _$ h( b p0 D
n_errors = 0,
- m/ f d& a* |- V0 D: u i = 0;
1 s8 f, Y# y7 S const int. n+ ?' D. N6 p( |2 |
*severities = NULL,! R" y1 ^$ k/ k
*statuses = NULL;
, z7 r) m# d2 V/ z1 |" t% k% q const char( I' I8 D- ]5 U) [% a ?4 Q
**messages;* k C% V- p8 v, T/ J% ]
4 J2 N- U5 F# T; ~ EMH_ask_errors( &n_errors, &severities, &statuses, &messages );( B% [* w$ r% Q H' _1 D& U( ~! x( X
printf( "Error(s): \n");% u* A: y- V4 S" s3 C: Y3 ~( e
for (i = 0; i < n_errors; i++) X* L$ b9 G' ^; e
{
. u- D+ `& \5 |0 `/ u5 T printf( " %6d: %s\n", statuses, messages );
& {6 ^* m: L* Z; y( u% h( z }2 }) c$ o* ~1 L
exit(EXIT_FAILURE);0 C+ i' k/ l9 K3 J
}9 C: D/ C" I& V9 ~5 @
0 Q0 i" x" \7 `2 _5 }
int ITK_user_main(int argc, char* argv[])# Y- o4 ?* O S
{ V' m" a; m. l) b" B
int1 d% H' z4 d. ^& |
status;) T$ F5 Y* r: }/ g7 m
char6 H* |8 q& Q+ f! n5 D* A8 O& O
folder_name[WSO_name_size_c+1],; x" l3 i2 A: L( t+ q# r
fldr_desc[WSO_desc_size_c + 1],
0 z7 W/ P; q) X4 }. Y3 a( ?+ T# b% ] *message;& X5 l. Q$ v4 [
tag_t/ D- U; x! A6 F0 {' |8 y! M! `) ?' ~
new_folder;
9 S' v+ @3 _+ m5 ~9 e
" d1 p2 F/ o4 {8 d/ o. } I ITK_initialize_text_services( 0 );
6 [' d) E$ j/ H4 M4 B9 h status = ITK_auto_login();: E( T! m+ F6 w' y( `" G" Q
if(status!= ITK_ok)
1 v) H; z; s# Z- z# G8 A& V/ ^ {0 P0 L4 e0 p% I" \
report_error_stack();" _- D7 Z: k7 g C( I3 ~. m
}! ^: Q& M |# o/ f p+ e
else
6 z8 U* n9 y, X, y" m' l {- Z* I. V" H9 C4 B
printf("iMAN login successful.\n");) V1 T& H8 d9 ? z2 z+ V/ U, E
}
# K7 h/ e" b. }8 Z: U" Y
+ E+ v9 i; P$ T3 ^ ITK_set_journalling(TRUE);; A" p) k- V- c0 a) |
# o: b* }) w) c# b5 q" S if (argc > 1) strcpy(folder_name, argv[1]);
! l5 b7 Z9 z+ _( q. N* e else$ n( o7 m) w: ^' T9 l( M& b, `
{/ b2 T( ?& W* W/ \
printf(" Specify the Input in Following format : \n");
R2 [; ?5 O- l. M( t1 T printf("program_name folder_name folder_description\n");
1 c9 _4 K# M1 {+ E) q printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
, Q4 v, n- D0 b return ITK_ok; 2 |* i- [; y! }
}
. `% x( r3 d) t+ y- K
! y. T3 V+ q9 z8 ~; X0 @/ g if (argc > 2) strcpy( fldr_desc, argv[2]);( C3 J& ]' W+ d
else strcpy( fldr_desc,"");7 ~* N0 b y* S( F( J
2 T9 e5 Y9 C' @2 t
status = FL_create( folder_name, fldr_desc, &new_folder);, e0 u* j. M- S8 q1 t- I# Q7 B, C
if(status!= ITK_ok) report_error_stack(); 0 O, H7 a! i) W
# r; B' i0 l2 ~+ e: q+ r% l* ~
status = AOM_save(new_folder);
5 P7 P0 r" u0 [: G if(status!= ITK_ok) report_error_stack(); ]( \, L8 Y' t/ n. L
else printf("Folder '%s' Saved; ", folder_name);
7 f& R2 i1 o0 J; c: n$ d5 d; m) Z i# y
status = AOM_unlock(new_folder);
. L. u) d7 Z8 ]# r% | if(status!= ITK_ok) report_error_stack();
% c$ }; \8 ~& Z4 W9 ]; m else printf("Unlocked; ");
1 R! V' a' [% H5 b
j9 L" a( a- H status = FL_user_update_newstuff_folder(new_folder);6 t! F9 ^3 R Z+ u
if(status!= ITK_ok) report_error_stack();0 G9 ]1 M7 J2 e
else printf("Put in Newstuff Folder.\n");
% V7 E0 A1 k1 Z
$ ~6 Z; z2 j+ y- T0 r, _* r9 g ITK_exit_module(TRUE);# d$ ~- m2 L* J& d
return status;
: Y4 ?4 @0 ?& i# R- i}
7 G! v; M$ j/ c# s% Y |
|