|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& R+ o+ y9 C9 @& M: E) I
( @+ f n6 I1 v5 FTeamcenter ITK二次开发源码分享:创建自定义文件夹
7 @( a5 |! x) [$ f输入的第一个参数是文件夹名称,第二个是文件夹描述。# n1 `, l% K* q) [, x$ f8 l& O
. v0 \3 E1 Y8 g; v% b9 x6 ~
. e4 O* D# l5 H6 U#include <TC/tc.h>
8 z! W$ c4 z+ G5 S4 i: i/ t" v$ O#include <tccore/aom.h>- \) d2 Q- M: Z
#include <tc/folder.h>
. R+ D* v4 V& K* ]& a/ G#include <tccore/workspaceobject.h>0 o7 f( }) i1 w7 v
4 ?8 c+ e$ B4 O
#define EXIT_FAILURE 1
& P& z }3 W3 v8 R' c, o V. J! U6 O y0 p
static void report_error_stack( void ) |3 x9 E: V F7 e/ g
{3 l1 A9 }/ a# G
int
3 a/ G7 _2 Y/ u+ h' u* w$ E8 f5 Q n_errors = 0,% ?1 O7 q0 a4 F) S
i = 0;
7 o. `5 Q; {9 G! G: L const int; ?! K* J2 e7 `+ @
*severities = NULL,6 N& W+ p; q/ j2 ?" s: [2 I
*statuses = NULL;
6 m& i: F0 }- }0 } T const char
# p1 p7 ?- C4 h5 ~8 A **messages;' G# F2 M! [- C
X' R3 _: ~. T* v6 X' b( G
EMH_ask_errors( &n_errors, &severities, &statuses, &messages ); \5 S" \. H/ z C. b
printf( "Error(s): \n");5 B7 Q& O8 c& P( n/ d5 s
for (i = 0; i < n_errors; i++) ) N2 I& Q% {5 R, F# I1 `
{
/ x4 A! t: D4 H7 g1 x2 j printf( " %6d: %s\n", statuses, messages );
) C/ [ X6 @0 S) x9 h) _2 g }
, S. k& m# q* N" \, ` exit(EXIT_FAILURE);5 }' c5 K- r0 I+ V# g- j/ y
}
) u6 {: [4 X: k& u9 M. q/ z6 c" { ? W+ m3 ]. x/ Z) S
int ITK_user_main(int argc, char* argv[])
- ^' s' j) N- k, d7 Q/ y{/ h& x! q: [, X$ L5 R x3 ~
int
$ F# w7 q" o3 e; ^ status;4 r4 B/ ]- O# ]- ^& ~ a
char* M' N3 a3 g4 S' ^# b5 b. }! C& G
folder_name[WSO_name_size_c+1],
$ G" d' a" ~& M& D6 } fldr_desc[WSO_desc_size_c + 1],
C, P: v' F! |5 @, R- e v *message;
& u; h& d: E$ X5 o* `8 E tag_t
6 Z2 U1 Z* ~, f1 d new_folder;
; D) u" ^$ m; l$ y/ C/ y$ \/ z! a) ~' m$ f& Z9 D2 X
ITK_initialize_text_services( 0 );' Z/ I/ u6 R: b7 J' I+ u7 o& G3 p7 u
status = ITK_auto_login();
2 f# o( C4 G4 K; W; s5 s0 b8 R if(status!= ITK_ok)
4 a; q. N! y* V8 Y* Z {
, P, i7 O8 |1 r* U; G& [# Z report_error_stack();
5 m$ @7 U/ J- P0 a& Z }3 ?6 E) u; [% ?
else$ L( y/ `) p3 b* z* V5 I
{
1 s$ E5 [: T5 P# K5 j) l1 {7 A printf("iMAN login successful.\n");
+ X3 s/ a p* ?6 x6 I- L% K }
, _0 Q& L9 L0 W5 Y/ o. S
7 b! }8 }+ q- U0 w ITK_set_journalling(TRUE);
7 W% c' v* [' i4 b: M( R% `$ t% n) Q5 c) S7 U2 [ C
if (argc > 1) strcpy(folder_name, argv[1]);
5 B: h: P* ^. J7 X. M) v else
, p# p/ n! `( | {
: r. X+ a: k6 S2 E8 x5 u( ~ printf(" Specify the Input in Following format : \n");1 ~6 l: c; i1 j. A
printf("program_name folder_name folder_description\n");
" @- d+ ~: n, d5 v* _ printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");4 S. @* J' J; C& j
return ITK_ok; * V& g, A( n$ ^
}
6 y) Q0 l: \" D) _* x8 B0 L
0 P+ d2 r( b2 f3 @. ~) `( _* g if (argc > 2) strcpy( fldr_desc, argv[2]);
$ `* p/ Y( u% Z2 N% e# s else strcpy( fldr_desc,"");
4 C% P5 X: M, `/ n' w4 ]& o4 l# a X1 y
status = FL_create( folder_name, fldr_desc, &new_folder);
E7 u. T( o* f. k0 x: C9 Y if(status!= ITK_ok) report_error_stack(); ' G) ]2 A; \$ S# m" _
1 u' x( Q* ~5 r7 N2 Q/ z status = AOM_save(new_folder);6 y! h2 a$ H% H
if(status!= ITK_ok) report_error_stack();
6 }- H( L1 c% R6 Q/ Z else printf("Folder '%s' Saved; ", folder_name);
- G. \4 I5 b3 T& ?7 t8 N
+ u# r* E2 D( ^: V status = AOM_unlock(new_folder);
; y3 t8 P. {2 h3 Q! C if(status!= ITK_ok) report_error_stack();/ o* u) w/ q; d" J* i
else printf("Unlocked; ");! P- H, ^7 e- m0 u8 k3 A4 I
" J" p# D/ r: h5 v) O: E' J0 q0 Z status = FL_user_update_newstuff_folder(new_folder);
5 g' q) r' t7 c+ |" ?) O if(status!= ITK_ok) report_error_stack();
5 G! H# ^' o) I( n. l* m) L else printf("Put in Newstuff Folder.\n");
, z4 ?" I- i: p' u4 b! O" w" ]8 v: d
g- x: v* Z$ r1 q7 t0 s ITK_exit_module(TRUE);
0 {3 E8 _ D. I7 A3 T. W3 C return status;
: l5 N" Q6 W+ F$ B6 j}) i: @* h8 C3 W
|
|