|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 d0 h# d! G" y! @9 I
$ N# i) v0 V% `7 {1 b; ~- t6 LTeamcenter ITK二次开发源码分享:创建自定义文件夹
$ l9 v; i- J. ]. s6 `- }- B# K输入的第一个参数是文件夹名称,第二个是文件夹描述。: G9 q$ V$ ~% t6 p' w
8 m8 q. l9 o9 }* y" Y
' {) A3 o7 ?1 G0 P8 V6 y4 R#include <TC/tc.h>% @3 [- ]0 X5 T! n& ]# I
#include <tccore/aom.h>
) }. H4 }6 f4 Z' O) Y9 s6 ?/ L#include <tc/folder.h>
7 {, x! j0 S5 e" i& Q3 A9 }#include <tccore/workspaceobject.h>6 D+ D' n5 m+ m/ a, ?1 @
; z9 I* b1 p, v5 N#define EXIT_FAILURE 1( w8 N) y. X5 I) Q! i9 y
7 ?7 x& v& w1 v' r2 pstatic void report_error_stack( void )
: l* z5 y' v' e {
% p, y* L6 v5 [$ x# C int X$ t" V- w _" `
n_errors = 0,$ m( \1 n$ ?( T$ b- ], Q. s/ L
i = 0;
( T& g5 w0 V* [* M const int
. V- j: r9 F$ R! N' n# M! Z2 A" g *severities = NULL,5 {- [5 b" R3 F A
*statuses = NULL;
6 O0 p, Y% E' o8 _ const char8 X5 A1 W' _- C$ d
**messages;" }+ V+ N2 E% k3 T! E$ {
, i" E! A1 k8 C# D1 \- ~% W$ ^
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
/ {) [+ A9 H5 V printf( "Error(s): \n");2 J$ Y( W u8 `% U
for (i = 0; i < n_errors; i++) 0 J7 c5 g9 M$ K2 I# k# }' b5 W' z. m; G
{
1 E! y$ M1 K7 h3 S. \, B printf( " %6d: %s\n", statuses, messages );
( U: h9 Q3 F1 Q* O }( f& ?) J2 X4 z5 x0 K9 y
exit(EXIT_FAILURE);6 V& o* M4 c6 K
}. V0 H, j4 J. t8 W3 A' }( [3 h
( n! e! m+ ?: x; G5 n5 S/ sint ITK_user_main(int argc, char* argv[])
' R. a; Z J, D: ]% O Q{% @2 ^9 H& K- z5 y( w
int- x1 c- o) [" \: e1 F
status;: J2 n' g/ C' Q8 e
char e N0 u; `/ V7 T+ l2 o
folder_name[WSO_name_size_c+1],0 [. J2 K4 z6 `! _/ b- x
fldr_desc[WSO_desc_size_c + 1],
- J3 C6 X# d9 u/ x2 B3 B+ \3 `" D *message;
3 C. i6 [2 l. J tag_t4 G3 B" K3 T4 ]. W
new_folder;
" d. s! X4 R& |3 Q% h: m# O& i
: j$ O) G2 C2 N3 R9 p0 a ITK_initialize_text_services( 0 );
( ^# A9 l1 h$ Z1 t5 G$ v- Y3 p status = ITK_auto_login();
' D0 r- ?+ b! N& d if(status!= ITK_ok)0 T8 x2 g. K# |2 N- M+ l K
{- z, h% y9 `9 f% R0 Y
report_error_stack();$ O$ B5 @# G# q& j
}, Y9 \% d# Z3 S; D9 C" Z
else
9 [" {! v% k; n0 N, {: v {
0 U8 [* {, V% a/ n7 C% V# a3 ^ printf("iMAN login successful.\n");
/ H$ w) B9 l _+ T2 x3 \ }
/ _6 g: [0 j( Y: i6 z
) G9 m# g2 Y" r p0 X' H" t9 D- j" Y ITK_set_journalling(TRUE);
/ L4 e" S& o! r( i. W3 Z5 s7 p/ J- U0 H9 O5 g' [
if (argc > 1) strcpy(folder_name, argv[1]);" }: c; W1 i: E0 m4 ^8 t1 ~3 A
else# S, M" ~* ~+ c; Y5 Q" r
{7 p+ G8 m( U( q7 l& T
printf(" Specify the Input in Following format : \n");
+ R8 q6 T$ S1 r L$ I l0 b i; R printf("program_name folder_name folder_description\n");# L8 Z; u: Z& t/ y, z
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");% m/ y) d; O9 f0 I; C) X! c
return ITK_ok;
: e L3 q$ G+ w9 f- B+ u+ F } 1 l) F! y7 }! t, q- a& G
s2 g' R9 b5 P2 K3 Y8 x2 z/ @7 ]
if (argc > 2) strcpy( fldr_desc, argv[2]);4 `+ e1 A* X) n( R6 G
else strcpy( fldr_desc,"");. M& \! `" d8 b8 c; q
& r2 ^: b3 D3 V9 m; x# y; H( X9 O status = FL_create( folder_name, fldr_desc, &new_folder);2 ^) E0 u) d3 T0 S: w
if(status!= ITK_ok) report_error_stack(); 6 j1 x8 x! X2 G, G
5 p1 x* p& k$ Y. h% o1 o! r! q status = AOM_save(new_folder);5 Z, v6 U4 J/ d! M
if(status!= ITK_ok) report_error_stack();
6 D2 V: [0 }3 V" q8 [ else printf("Folder '%s' Saved; ", folder_name);& n d, Q! V' j" T" D% k
+ n' N- [! [" V( y/ H, o. U status = AOM_unlock(new_folder);
; S, T/ }. v- n2 B% I* Z" y9 m if(status!= ITK_ok) report_error_stack();+ d+ T$ r+ L) g0 o' l- G' l
else printf("Unlocked; ");5 Q6 }) N/ z& o$ |: ^
b2 @$ A8 P |/ u( u8 B7 Y
status = FL_user_update_newstuff_folder(new_folder);
& H) }$ m5 E" I4 z( [ if(status!= ITK_ok) report_error_stack();
5 {; R) D# E' C* a8 ]1 b else printf("Put in Newstuff Folder.\n");, @. ]9 _8 j- l% f5 ?! }
7 n$ A5 f& i6 n: d r- S ITK_exit_module(TRUE);. @% P/ i0 V! v0 C/ ]
return status;0 Y$ n$ @+ S8 e7 y) \3 A
}
8 \3 n3 F3 b% M. ~+ U |
|