|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ a ?: g% f! R( K9 q
/ K- ~ y( z( Q) D( O4 r: OTeamcenter ITK二次开发源码分享:创建自定义文件夹# ]( V* \% w/ |$ k+ r& D, {
输入的第一个参数是文件夹名称,第二个是文件夹描述。
- V( p+ @4 d, ]6 ]+ m6 ]; ?. [" E( _, _
1 S! {$ }3 o0 k6 a. X; K7 M#include <TC/tc.h>7 X, d' T( P# }# G1 X4 n- M7 U& ?
#include <tccore/aom.h>
/ ^2 T. F J0 R#include <tc/folder.h>6 S: h- I5 r! h6 @+ [
#include <tccore/workspaceobject.h>
+ ^1 P- p+ I3 E# D P; ~! A4 z" |$ C$ M, Z! H
#define EXIT_FAILURE 1" P0 R. X5 T8 J9 g; P; L. P
5 Y& ]+ O) f/ h! O2 \8 W6 s
static void report_error_stack( void )
: Y* I! G6 H6 y5 f {
- X5 {5 q; J8 \% X A int9 U8 u* m3 u$ ^
n_errors = 0,
5 o1 m; N7 e; w% i7 ?( w5 H( f } i = 0;
: G$ U' p# l5 a6 s' C" { const int
: o Q' h5 w! y0 t5 G) H *severities = NULL,# `! Q, ^- z4 Q' r2 X0 t
*statuses = NULL;
0 x0 f! U; _0 J/ P5 Z( O- ], G, | const char9 }: O. o* P7 g; K, ^
**messages;
2 _6 a8 G8 w4 m2 Y. u* s
7 J: m/ U2 r ?- z EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
& z% a5 G `* |, e6 X printf( "Error(s): \n");
$ a' m0 q/ w2 d5 A7 s! b. R for (i = 0; i < n_errors; i++) ; M- t+ N5 [2 M' A( p2 G0 U7 d& Z
{
, \5 _% l. E: {% g9 n; v3 E# b printf( " %6d: %s\n", statuses, messages );
- _$ V7 J& m& K% H }( B: Q* N3 o8 S; J% ~/ ~7 X& F
exit(EXIT_FAILURE); y" ]2 g* _! D7 m: ]
}
9 B8 V3 s8 T. ?' d0 [3 M4 B# _
3 \6 q; d" m0 a9 ~3 Y* M6 fint ITK_user_main(int argc, char* argv[])! Q/ r# ]% L' `4 y
{1 w( E2 z, R) A) h; c
int/ y; m$ w9 @: G0 I8 e
status;' L8 o* [8 ?$ V
char+ p: C4 C( g% w' f9 B5 i7 n* F
folder_name[WSO_name_size_c+1],( r- N S, m- i. [' a/ J
fldr_desc[WSO_desc_size_c + 1],3 f1 f( @( C: D/ e' a
*message;
; g( H" ]1 ^( j6 ?' @0 I5 G tag_t
. N! q; Q5 g) S+ W, [9 h# d f% b new_folder;
6 n4 W- Z/ p' I! ~8 N
4 x5 }# D1 ~3 h& n ITK_initialize_text_services( 0 );' ~, U6 L) z; T% Q& F+ p
status = ITK_auto_login();1 B6 g, P# R' J7 p7 [* q% d5 Z
if(status!= ITK_ok)6 v9 \& U4 }) b: \
{: K' N$ k5 O4 D8 r
report_error_stack();
- Q0 U+ \1 ~1 a% d8 u1 _& f }3 T; v8 N9 E. x; [: s
else* M7 r( v2 r/ O' Y! Z+ R v
{
& A: X: i4 w& B# U/ D4 k printf("iMAN login successful.\n");' x1 e( l4 E& W+ r& D& e
}. m! |4 f* h g. A
1 r4 o0 a1 E* U' b6 D- [9 p
ITK_set_journalling(TRUE);9 P6 e5 j' g8 w7 }, L
5 [: L9 m, f9 D3 q$ R+ e8 o3 h
if (argc > 1) strcpy(folder_name, argv[1]);; k% c6 y ~2 `! X
else4 O# s& E; o- J' ]
{2 E$ a. R6 i1 y* {% F3 e
printf(" Specify the Input in Following format : \n");
+ b/ S; w; \2 ]6 P/ v% r; d' A8 t printf("program_name folder_name folder_description\n");8 p: l: x3 a" f; q j' R6 |6 ]; H+ Q
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n"); h3 U% c: ]/ {1 k% l
return ITK_ok; % L6 n8 t1 l- f( X: k$ h
}
! f- P9 |* s Q1 h/ o+ G+ z
! b: |' l. s3 K3 d# b if (argc > 2) strcpy( fldr_desc, argv[2]);
9 v+ ]: H" h4 {1 J" [' p6 Q else strcpy( fldr_desc,"");* U+ d: K5 W, R H8 P$ h
: ]6 V, l& u, I1 L- K+ f status = FL_create( folder_name, fldr_desc, &new_folder);+ x" ^! s Y: c A: N6 G2 B
if(status!= ITK_ok) report_error_stack();
& M" ]8 [! S. g/ C
$ x9 O! o, I/ b$ T status = AOM_save(new_folder);
* C E2 t0 P( l8 F if(status!= ITK_ok) report_error_stack();
% H0 Y: w$ k2 A* d else printf("Folder '%s' Saved; ", folder_name);
/ ?( z+ T+ i' x% u" ]( U
: E5 r0 R, T* c2 y; @ m status = AOM_unlock(new_folder);+ i2 {4 ^2 I7 e' G/ G) I7 }1 J
if(status!= ITK_ok) report_error_stack();
! h7 K' f, @! i! t2 V else printf("Unlocked; ");
% U. ^/ X+ Y# o# Z" x4 n0 `) Q* f) i6 [) R: u
status = FL_user_update_newstuff_folder(new_folder);! \/ C6 Q+ k6 k3 `
if(status!= ITK_ok) report_error_stack();
& e3 n8 K8 q3 H8 c$ H: F0 v else printf("Put in Newstuff Folder.\n");# T% k. C. x- |7 f
7 i% a2 {% b6 w3 `+ @
ITK_exit_module(TRUE);
2 |3 j2 K9 h, |! o return status;
2 ^) [4 r- Y+ c$ x7 X: n, W: A}
, A3 Z8 n/ z# \/ a+ ~4 @) ~# @ |
|