|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* t( j( C. c) c2 |( h, Y/ C
% U- E3 T) K/ X6 z& UTeamcenter ITK二次开发源码分享:创建自定义文件夹) q& \) _! n6 D
输入的第一个参数是文件夹名称,第二个是文件夹描述。
+ ~1 N1 s/ T! w; J7 g6 b
H! P6 X- {0 H" h
# I2 Q- [: J+ ?' a) C6 N#include <TC/tc.h>0 @( s+ d# U ^3 I
#include <tccore/aom.h>
! j# Z+ k, J7 K#include <tc/folder.h>
7 U9 b0 M* Q9 i8 ~; A#include <tccore/workspaceobject.h>
6 l) d# u5 I# q# } k
$ z1 ]2 c$ T' z1 r9 U- G# @9 I$ e#define EXIT_FAILURE 1
: P$ q& G7 \/ s' N* D: b
' c$ r: l% J5 }( A" [$ @% C9 Fstatic void report_error_stack( void )
* ~; i+ K+ K/ Q, C j( Q2 k% Y Z {
' `/ a. E4 k) T/ O( e int
2 f! e, q9 l, F) A% U n_errors = 0,
( z% R0 q5 z# m; ]# z9 O/ E; J i = 0;
( n4 G# S. L+ I const int1 ?. e+ \) K, u2 O) I
*severities = NULL,
0 H- }" I7 ^' s *statuses = NULL;& m, R# V& d% I) ~
const char: a+ {. U2 k) k
**messages;$ @8 z7 e5 T5 T! |! ?& F
; T2 M9 r7 u& L8 C b
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
" m* l7 I; C0 E6 X; s) n4 }( I printf( "Error(s): \n");7 C0 L+ c& E/ z2 I' W7 n0 Z
for (i = 0; i < n_errors; i++)
/ y, D, p7 |2 n2 C% V {
5 S4 t6 h( M3 P- } printf( " %6d: %s\n", statuses, messages );, h# t% H/ G: ^* E, K: f* r" D
}
* d5 M2 t. }: i$ R2 b exit(EXIT_FAILURE);: h8 G1 b& }& m* F
}
! Q3 x# @4 w% I& } ?; L) y$ N
& E6 Z( v4 S% x# u" w: p+ qint ITK_user_main(int argc, char* argv[])7 `0 Z& W7 U! R( @ S
{/ F; e8 |* z$ \; ]
int
8 e& n z% }& E- o! i& p status;
" h) t: h9 X" R+ o* j: C char ~' p, q/ m9 I& s8 b x8 n
folder_name[WSO_name_size_c+1],
: I/ x2 m2 ^ L fldr_desc[WSO_desc_size_c + 1],4 i$ D& |8 [$ S. x& S, ?7 Q& o
*message;
# R$ \8 A s+ ? n5 P0 Y" X! j tag_t
; J J* n& l+ c" { ~+ L5 y) h new_folder;: ?% ^( F) e5 b# D# h5 w' |, L8 [; k
& W- C8 g. l; k" w" b5 V ITK_initialize_text_services( 0 );* [+ Z2 F+ B7 p4 d) J& D
status = ITK_auto_login();' ^, k. a8 `% U7 H+ F0 ]9 e7 U
if(status!= ITK_ok)
: q8 E* ?4 x% k. @6 `. x' E {+ ]( G# A) n1 U; g+ J( [
report_error_stack();
4 A; ]+ b+ \6 T- h! l+ ^+ H }( y6 ]5 a" w e4 D
else9 {! C4 c [2 w+ Y/ r
{$ {8 H8 w% [: q0 S+ M" C
printf("iMAN login successful.\n");- E4 k& d5 N7 G" \
}$ \0 b9 W0 u) g: q# j9 a0 f* T
" I* P/ b8 \0 ^+ T2 n0 R8 o3 U* H ITK_set_journalling(TRUE);1 o) G) x' J$ m9 p/ ]
' K/ M) p; l8 Z0 C; f: z if (argc > 1) strcpy(folder_name, argv[1]);
( y* _7 g/ w9 Y9 V- g else6 P: b# n% w" a) C8 O
{$ ?2 F) s, j, u
printf(" Specify the Input in Following format : \n");6 Z4 e& f: ?9 { O
printf("program_name folder_name folder_description\n");
4 r: D* p9 N3 K( j6 m printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");# Z/ d, H" H& k1 N8 r9 c- G! ~
return ITK_ok;
2 R' h' j( i0 D2 p8 Z* ~% o7 R+ ^ } / I) d3 j& ?+ }' p
' D$ T) L9 a2 J, B) u
if (argc > 2) strcpy( fldr_desc, argv[2]);
: w" _: `& @% N& `/ t else strcpy( fldr_desc,"");
) N$ d! Y0 ^3 S: o$ A# q) f& O* g( K3 F
status = FL_create( folder_name, fldr_desc, &new_folder);
/ c1 ]. d" S. v$ K* s* e if(status!= ITK_ok) report_error_stack(); C, J1 u3 J# f" [* J% l9 M
3 x' y2 q" ]3 X/ e& b8 P; F" ~
status = AOM_save(new_folder);
0 v$ b& n# s. `0 N, c# _ if(status!= ITK_ok) report_error_stack();
$ {) \8 Z g! s# G- |3 A. Z' v else printf("Folder '%s' Saved; ", folder_name);) j6 r/ i7 S; B: l! S! }
0 Y7 z" d P7 e- R2 w status = AOM_unlock(new_folder);3 N; R) i' _. N, _' ?
if(status!= ITK_ok) report_error_stack();4 B& x6 Y+ K v5 m* Z F
else printf("Unlocked; ");
$ g( A5 H' f: y! O' p9 S
& Y) O- ^( ]& o1 E status = FL_user_update_newstuff_folder(new_folder);- Q% X# _6 w6 z
if(status!= ITK_ok) report_error_stack();$ {6 I) t; ] j/ L' `
else printf("Put in Newstuff Folder.\n");) O& J8 a9 T% `4 H
# Q, h9 A$ X9 p% F ITK_exit_module(TRUE);/ g# g( ?6 q" V1 \1 k
return status;& z4 S. Q) Q2 o9 D% o
}
6 c# K3 N, T# ^ |
|