|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 F# ~- F/ q. m7 q: f
8 |- O& V) B$ N! v% I3 q& GTeamcenter ITK二次开发源码分享:创建自定义文件夹
/ P9 K) o7 k2 i输入的第一个参数是文件夹名称,第二个是文件夹描述。
! L$ R+ t) C4 n g3 [( j C5 k J- n+ o& X/ p
& Z% c9 k; S7 Q% R#include <TC/tc.h>
& m4 S( l& r8 t0 j#include <tccore/aom.h>( C' P9 O8 r$ \2 G) O/ n* T' ]
#include <tc/folder.h>2 _" i* A6 r, _/ Y2 D
#include <tccore/workspaceobject.h>1 k! I2 `0 r; H1 [! R
: A. Y% c; m/ P0 H8 p9 V- q#define EXIT_FAILURE 1
2 K+ S$ M/ c' X# ?4 S) E. v& |5 o9 S- _) [) |* K
static void report_error_stack( void )) o1 @9 L- h( _% f# q
{+ ^" C. E2 k0 ^
int
' M- V; D& i, X n_errors = 0,
" s5 Q; k# c$ L! A$ h! H i = 0;
( `3 k7 u* P7 r$ {2 b$ t; s const int
( n8 V; E' p- P D *severities = NULL,# D; Q2 T; r+ p. i
*statuses = NULL;7 a4 L8 r+ L) d, B# e
const char
# v( _0 p% z2 @; W3 L1 f* F, X **messages;
' ^1 ~5 }" }' V6 w( x7 y9 l* |: z& ]# I$ m9 G4 [$ b, G& j" w
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );% b/ S H6 g! j. T3 [4 v H' ~# e
printf( "Error(s): \n");
3 Q% U; s3 [- o& ^" x% R for (i = 0; i < n_errors; i++)
/ ?- f* W- c& N# R( G {9 o. `. Z5 W ^4 M
printf( " %6d: %s\n", statuses, messages );3 h" ]$ |6 J. G% P, |! k
}+ z1 Z$ K6 L+ \4 M
exit(EXIT_FAILURE);2 \' r' l9 Z6 ?, O6 v4 V+ A6 E
}
( J5 h. [4 }/ X6 t3 m
K9 K; \+ H% e7 iint ITK_user_main(int argc, char* argv[])
& I7 Q* {, T, z{4 B) b5 R" n# ]- H* `! o6 O2 A3 b6 r# y! u
int
* A; `5 _1 X- B9 |7 B1 C status;
, V/ \4 x4 w5 A* K0 E6 R8 C. { char
5 U: R7 s: z# K. j( R folder_name[WSO_name_size_c+1],+ E: b+ R3 W2 o0 c
fldr_desc[WSO_desc_size_c + 1],
2 R- e4 e: W/ J( i" _. Z *message;
3 ], `& B1 N$ a' H U Q8 v tag_t
7 j [# J) l& |! b# c3 ] new_folder;
( S7 _8 G# _1 C3 C" e7 [" R7 h8 Q1 g/ u; [9 r- _2 M$ i
ITK_initialize_text_services( 0 );
: Z9 n9 f7 ?3 q6 j3 ^ status = ITK_auto_login();
' q7 G% B; P; N4 I6 B4 N. U% Y- [ if(status!= ITK_ok)
8 S) z) \1 r; P {& K1 I+ J2 W3 p; c
report_error_stack();+ ?" `/ Y! y. u/ t
}
8 W- ~' s( Z- ]; N7 ` else3 Z8 \' h5 `" u0 u, ~2 c5 p# O
{
/ @- D8 b4 X8 Z" ^/ u# `, ^7 G printf("iMAN login successful.\n");
8 ]' Y/ y/ U5 }) d- |) f2 n8 `7 { }
- \2 S! ~5 ?6 h7 L( I1 D% L& X5 M; e
ITK_set_journalling(TRUE);
7 N4 ~7 s' D* i1 m% N$ V$ w* `% O! M1 R4 z! @% K
if (argc > 1) strcpy(folder_name, argv[1]);
3 x% v3 z n! P, e. G else; r3 e S/ a# x( ]8 _
{ t/ _8 j: W1 Z0 c! L
printf(" Specify the Input in Following format : \n");. F" u5 }) t% S0 R6 V, F
printf("program_name folder_name folder_description\n");
4 u0 H: m4 d! {5 n( e6 A" Q printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");: W m+ S, Y: Z3 ]% R8 b: P1 p2 e
return ITK_ok; , q- Q2 u9 f* M* R. d
}
9 w Z, t: B. q, @8 P! G/ L4 |, i9 q; Y% y( n! y# p. W
if (argc > 2) strcpy( fldr_desc, argv[2]);- U/ ]$ [; ?! L, f2 A: }/ |
else strcpy( fldr_desc,"");
# |( S+ n' H) \7 Y& q
8 r& L& s. j0 ?! X status = FL_create( folder_name, fldr_desc, &new_folder);
2 q5 {7 H% D2 D if(status!= ITK_ok) report_error_stack(); % ^, Q$ x8 G, x% O/ Y
4 P' @- J& l; h2 f3 | status = AOM_save(new_folder);& h( W: k/ b" o) g9 J
if(status!= ITK_ok) report_error_stack();" q+ N, R0 i# W0 ], u
else printf("Folder '%s' Saved; ", folder_name);
) R% \+ B' Y' r& N; X* M$ `% q0 q
7 l( z# h% @+ P: c. H6 v3 ? status = AOM_unlock(new_folder);
, s! B9 M) y- t7 }( e. N) K if(status!= ITK_ok) report_error_stack();
- h- B4 X# V6 _ [ else printf("Unlocked; ");
( z" R1 `0 ]' p% U; I3 ?( q$ g$ Z% [& C. c
status = FL_user_update_newstuff_folder(new_folder);7 r! C) ?7 U0 L: {4 g! @
if(status!= ITK_ok) report_error_stack();4 e5 f. W5 O1 y) k% K ?
else printf("Put in Newstuff Folder.\n");
( ?# G9 x% d# X/ V6 s
. ]! v/ ^* j; P) o ITK_exit_module(TRUE);; E$ x, h' ?3 _" Q, W: U$ ]& T7 R
return status;1 V5 D& H4 E: ?( g2 \! x7 t
}
5 o0 _/ `2 L' O/ A! w/ G$ u) j8 \" f |
|