|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# Q! \ v, S; z. Q6 b
/ N# \/ f3 d0 l" D9 iTeamcenter ITK二次开发源码分享:创建自定义文件夹
% T$ \% |! g' [) g1 Y* N0 \输入的第一个参数是文件夹名称,第二个是文件夹描述。
7 S9 y+ a9 A" v. t
: J3 R& Y, v; G0 G) ?$ W$ o; h3 ]. t+ G, N
#include <TC/tc.h>
5 B0 d! ^ E3 ~( t#include <tccore/aom.h>8 F0 U7 L$ W: K: B0 x8 U. b/ E: W
#include <tc/folder.h> y: _- o6 E/ R1 ~9 a
#include <tccore/workspaceobject.h>5 I" i" ]/ F2 F7 q! c# Z4 C
- w D+ E9 O: |- L& C#define EXIT_FAILURE 1, n Z+ b/ C* F5 ]7 H; L1 D# g
* E: w8 n& e9 jstatic void report_error_stack( void )& i3 W/ ]% @. ~# T( k
{
5 |* t, c- j& |$ T" g int. }0 T+ ]1 |2 ]( t3 g4 O* Q; Z# B
n_errors = 0,3 U) m6 o3 o% W* c, v1 ~/ z, z, S
i = 0;
. b- v( I# o6 |+ J' c const int
" x* f7 l4 }% b/ ~% V' Q- V *severities = NULL,+ f8 F. b5 ^# f' b1 t4 f$ {
*statuses = NULL;; y- K# z6 m: l' C
const char
! m4 k/ S7 M% K9 F; c6 m **messages;
* }+ b1 d: _( Y% s( |& \. u$ h9 ^8 H C
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
3 o5 j, v' c: d E0 N printf( "Error(s): \n");( t4 L3 b, x& x4 H' g' t+ W
for (i = 0; i < n_errors; i++) . n% M5 L ~8 o1 u, r$ N3 O
{- J, g% T. \; B
printf( " %6d: %s\n", statuses, messages );$ s4 c# R! e0 U% Y' f
}
8 i8 w* ?# G0 w( s exit(EXIT_FAILURE);: A9 E3 H2 }& x" z, P5 t. I
}
5 ]3 g/ ?( }3 g
+ E' l$ f, j5 x: D% Zint ITK_user_main(int argc, char* argv[])
) k8 v$ d' w" f, e$ S$ g{
d' ^* I+ X- E2 @! y int
& [. K7 M9 A+ Q4 Q- ~& h. J status;
# y; P( C. @. H char3 c& I' p/ S) _
folder_name[WSO_name_size_c+1],
. m. |3 y3 n- L fldr_desc[WSO_desc_size_c + 1],' l7 g) S J: ^/ L" Y) C
*message;
! L$ X9 h, Q5 q" i0 p tag_t
' P7 @& @! z) p. E1 _5 ?# B% u new_folder;/ I4 E- a2 H8 \, R
8 d; j& l! R6 t
ITK_initialize_text_services( 0 );
, [3 m0 N8 G5 n0 V' e/ D# T status = ITK_auto_login();
3 d4 B/ |) @# o% x0 B5 |3 B, I if(status!= ITK_ok)
- C6 f) Q9 u0 h+ u; ?6 `2 @, w {
# S h" b9 x3 d2 L- |3 ~ report_error_stack();( q s4 u. d7 o! L4 A9 G
}
1 `# N ^! i$ B8 } else
5 `) D. V( }( R' W0 v) n! ` {4 L' D3 v! R x# P
printf("iMAN login successful.\n");
4 i! y4 f9 F. ]1 q1 M }0 R$ Z+ u; w9 X( b k* J- E# d* b
* P: P$ B' r% K ITK_set_journalling(TRUE);
Z, I9 U( d: y/ J) A
0 n) f! \7 V1 |" _ if (argc > 1) strcpy(folder_name, argv[1]);. s' y; T5 p: i- R, m6 O! J
else8 T; P( z. ?5 j3 e" S; @( ?
{
+ F! i+ r8 j% H6 Y# | printf(" Specify the Input in Following format : \n");
# z3 s& ~8 T1 [- Q) Z printf("program_name folder_name folder_description\n");
, v& [6 z8 u% W( d printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
4 ~( x2 m% X' C" t: A return ITK_ok; 9 w# x$ q5 d; |, [# n# J1 n4 e
} 4 B' w8 @- c+ t7 ^0 u- G
( D& }. N( l3 V. u% O
if (argc > 2) strcpy( fldr_desc, argv[2]);
: A' C0 y7 b( ~8 n9 S, Y7 b else strcpy( fldr_desc,"");# b7 h; B6 z* T5 j% `0 u
& [! _. K* _. Y" P status = FL_create( folder_name, fldr_desc, &new_folder);
. g# z; v( \3 Z if(status!= ITK_ok) report_error_stack(); / B+ X3 S( k3 W/ R+ @
8 C+ ]3 r5 B0 h( u% L& r2 `8 p status = AOM_save(new_folder);- Y3 @1 U7 S* A/ p
if(status!= ITK_ok) report_error_stack();
& Q2 D4 t) I# s. D* j) A else printf("Folder '%s' Saved; ", folder_name);
+ o0 z9 \7 d8 l1 H# C0 I
) m6 X3 U( K7 B status = AOM_unlock(new_folder);! k/ |" q3 c' N6 c
if(status!= ITK_ok) report_error_stack();
/ c2 ~+ Z' p! W( H$ _$ E) s else printf("Unlocked; ");0 J; R0 `" |/ q4 }5 B2 P- ~0 v
$ t! N. l8 a9 t- Q4 ~3 O- z8 Q; r# B1 q status = FL_user_update_newstuff_folder(new_folder);, N4 g+ H. n, r4 N" b5 n" C
if(status!= ITK_ok) report_error_stack();) V7 g9 H% y6 F2 s k' V; M
else printf("Put in Newstuff Folder.\n");6 s% B0 j+ o4 ~/ L* \' G
2 _" U9 r9 y' w$ ]) K ITK_exit_module(TRUE);/ o5 o( o/ ?8 `1 b1 h2 G
return status;: T$ f! a/ t7 o6 |. P) a- g, W
}+ m) J I! ?% b- s
|
|