|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# j* H$ [. R2 [' ^( W+ N
6 S9 |* ?# U9 w3 sTeamcenter ITK二次开发源码分享:创建自定义文件夹" d4 {' h6 N, E8 m
输入的第一个参数是文件夹名称,第二个是文件夹描述。
9 P+ n7 f3 h' c
; t0 y1 _5 Y# C4 V+ @4 x0 A
6 W2 s1 J5 [" c# e2 Z#include <TC/tc.h># j+ Z ?( j% f, `/ Z ]
#include <tccore/aom.h>
; g# E8 C' n: k; k$ t#include <tc/folder.h>
0 B4 y& I) a% G+ n; `#include <tccore/workspaceobject.h>
) S& C! ~: w! J" { s
. ~. q+ c8 F; Y5 _# A) ]#define EXIT_FAILURE 1
* {' R& g. f- E' u( f4 J$ S
. u5 ^8 y2 `- O+ T( k5 Qstatic void report_error_stack( void )9 g, Y/ G7 y# B$ Y0 H: H2 u3 P
{! }5 S: C/ H* ]) D K
int
- [: e: J5 ^ b7 _* Z n_errors = 0,6 v7 H. i0 R+ h, v
i = 0;
5 r& b8 b5 C# P' G. Y const int
4 T% m5 Y% w& H6 ` l *severities = NULL,$ S/ Q. ^( Z& k+ i
*statuses = NULL;
' r+ l- l: ^& V' L- p const char
. ?9 ?3 K; S" a **messages;
/ `: F5 E' b- b! l1 U- r6 ~/ N# G# H, z0 O0 |7 b
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );0 H- }: {1 Y0 `( S( H& f+ {8 t- V
printf( "Error(s): \n");) A" ?9 L8 Y# ?
for (i = 0; i < n_errors; i++) / H. [: {, `' N6 G, ?
{
# P0 a0 c) A6 s. e printf( " %6d: %s\n", statuses, messages );
) x+ Q2 s% `! q# L9 ] } _. j& b& s5 a
exit(EXIT_FAILURE);9 N' S9 q( k8 G* i" U+ I
}0 T7 z+ L3 S3 k) S, M6 U* B
8 L3 G; d9 h* P+ V2 B
int ITK_user_main(int argc, char* argv[])8 O. P2 c& i* i3 y( k
{1 y+ q8 y9 R1 [
int7 _0 Q: j3 c, G2 R
status;
+ M; p2 v8 R, H5 M3 i char$ _* P8 X; E" [( B7 M8 T
folder_name[WSO_name_size_c+1],& B1 _/ h0 M L( B8 r
fldr_desc[WSO_desc_size_c + 1], M2 D* H0 f6 y) M4 {; K
*message;1 U9 t* T, W9 |, S: g. Q( S# j. {
tag_t
; h# W0 h/ z1 B) g! A% ^ new_folder;5 S( h$ K1 ]/ g, }
. C, C$ K- Y. Y( v6 [9 ~- k2 t
ITK_initialize_text_services( 0 );
! x$ L: m/ \/ N4 p( n6 V' n status = ITK_auto_login();: ?5 l4 t4 u& j4 i$ j3 u" q0 D& ]
if(status!= ITK_ok)
3 q7 M9 k) J1 l0 X9 T7 N1 b8 k9 I {& k2 | g' I) k2 Z9 `3 `
report_error_stack();
8 q8 k0 ~% \/ s$ E% p }
5 [& C* F! S/ D) ~" E else
0 U% u3 w Z4 H: ~( h {) \( j9 l" z- k0 V( I
printf("iMAN login successful.\n");# k9 ^5 o. `2 r. D! \
}
( `: H o5 @2 ~* K+ v. X6 Z6 t' E3 s" ]! i4 j
ITK_set_journalling(TRUE);- Z7 L5 T6 ?7 f9 b% W/ m: {7 k8 @
4 E0 ?, P* Z9 p, | if (argc > 1) strcpy(folder_name, argv[1]);
8 r# d" s% X5 X4 u else
, D4 I& `3 n w8 ~0 r' {, n2 X) E {% k) S/ k1 q9 h5 u) X; N4 d
printf(" Specify the Input in Following format : \n");
# b) ^1 C# d$ c L0 ?7 c% D; ^3 l printf("program_name folder_name folder_description\n");
3 H, ]- w/ ]4 _# Z, f+ @ printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");# P! \- k4 {; S- [0 ~4 F3 d, S% F
return ITK_ok;
# h! _" o" _ G3 { }
, \) {% i8 k+ i) [) e6 S. M! ~! I7 I6 Y: k6 q @
if (argc > 2) strcpy( fldr_desc, argv[2]);, w& d( O6 a2 {7 l7 o
else strcpy( fldr_desc,"");, f' ^" W2 q9 O" R
" f1 y# q: w. V5 g M4 `0 E status = FL_create( folder_name, fldr_desc, &new_folder);
1 l+ _% G0 n9 i% @ if(status!= ITK_ok) report_error_stack(); 8 x& A2 a/ L2 {! N
: h5 }% Z: l& p/ ?( F# `
status = AOM_save(new_folder);2 D2 K& P* Z# r, ?0 j3 f" U2 m! s
if(status!= ITK_ok) report_error_stack();# H: J) t W# G
else printf("Folder '%s' Saved; ", folder_name);1 i2 H k- x+ ?
6 ^$ `# B1 K' @5 E [" N) U3 r% I& }& } status = AOM_unlock(new_folder);! \8 ?6 ]; F; R2 N7 y& I
if(status!= ITK_ok) report_error_stack();
5 x+ _( U/ x' @- Q6 L- r# Z# g else printf("Unlocked; ");$ v8 \+ i3 U/ q9 r4 u8 P9 g
! k C8 T6 ~6 c1 ~$ F
status = FL_user_update_newstuff_folder(new_folder);
1 C7 \8 m4 f( B: F& d if(status!= ITK_ok) report_error_stack();; i8 i+ L @# g2 c! P( H
else printf("Put in Newstuff Folder.\n");
& F9 ?8 n1 K) S, c; ^* W* ?% o$ P" G" f6 j- \
ITK_exit_module(TRUE);
) e9 W6 O( |- _# } i N( q( u return status;3 T% K8 W3 ^! |9 B7 f4 j+ w
}
3 n k2 t* ~; B' n0 h |
|