|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
J, R: d1 O) V% L8 p/ B# Y* v
2 Z6 `# _: R4 OTeamcenter ITK二次开发源码分享:创建自定义文件夹# v8 C, V, l! {& \8 [9 i6 w k/ f4 S
输入的第一个参数是文件夹名称,第二个是文件夹描述。. n2 H0 d' X' s* F
7 Z7 L1 J( F% n: w0 N0 y1 Q
/ h1 b9 @8 _2 h: u0 M" | p#include <TC/tc.h>; P7 l Q7 C9 Q7 J
#include <tccore/aom.h>; }$ U# G& W0 e1 {( u2 H
#include <tc/folder.h>& T$ I' h- ]2 }8 n
#include <tccore/workspaceobject.h>
, \6 N& a' g5 h7 L* n
/ T( N2 m3 s4 C* x#define EXIT_FAILURE 1
1 t1 r- G7 D/ F
% O/ T! {" l+ Y6 ~% Ustatic void report_error_stack( void )! Y! l. h- f2 l. L! X" ?
{- J3 {) {6 q- @- }6 D$ U0 \ Z
int' W) O; L- J* Y. b* m' c
n_errors = 0, X+ ]% b! h& N4 G9 O
i = 0; O& u$ K4 l2 G T
const int! R. R/ O- ?0 t0 V; H" f
*severities = NULL,7 U* c( ~! P9 g/ [* H1 l3 C! K
*statuses = NULL;
7 M2 ^' H/ V9 ~, k2 V/ a/ U: l const char4 [9 t/ H: ?( i+ v/ `, D
**messages;
# C& F: n3 K; G. ^% ]/ p6 F! V1 r7 ]$ ^: f/ O( R7 F) Z0 i, Z i
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
9 Z# T) ]$ X6 P! N. N$ P printf( "Error(s): \n");
+ J C3 z" j, _/ d7 p+ l3 B/ y for (i = 0; i < n_errors; i++)
+ ] H! G/ C' z# Z {
1 f1 |# g1 ]3 N+ j, v printf( " %6d: %s\n", statuses, messages );
' b2 h! S: z% f* q1 j/ U. u }. n: g" S; q8 R, \; z1 w
exit(EXIT_FAILURE);
* h) E. G3 A0 C& Q }. k8 X3 N' D5 D
0 y4 x! c6 l/ I+ f# ]7 D
int ITK_user_main(int argc, char* argv[])
5 [" R+ y0 B. k4 K, j{% _ T& W- h u% C3 D" R; f3 d
int5 I6 Q8 r* K0 m( ~2 G+ w2 P0 X
status;5 W: k! U9 e2 W* p" O/ |1 P
char
6 E) m* H" `! f; ?/ @. [ folder_name[WSO_name_size_c+1],7 k3 I8 x+ Q" f
fldr_desc[WSO_desc_size_c + 1],
8 }6 A* X( S! U5 \ *message;2 j: M! \- s# S2 i/ X A
tag_t
/ u! j; K9 d. U% Z- l5 q5 x* s' ], [ new_folder;& v$ x7 e( o0 Y/ ?' M! r1 \3 y
# |' W! | B! N$ c: A ITK_initialize_text_services( 0 );
7 ^/ b1 l- _# r, I3 ^3 o8 @ status = ITK_auto_login();
) u3 ^$ ]% `0 j2 } if(status!= ITK_ok)
, Y- ?5 t8 |2 R1 ]& w- t5 { {
$ r! m+ C# S6 K- d report_error_stack();( p" \+ u, l+ Y/ a
}& t8 i- V$ W' N) r' X3 X; N
else) v# l" {! K: z! v
{$ N2 F k ~9 z0 h2 {; O
printf("iMAN login successful.\n");
9 h& O/ n3 l6 p5 w! h }; Y: W! \+ u3 {( W& h7 p
6 S+ `$ _. T- T ITK_set_journalling(TRUE);
5 B6 L* v& F$ ]9 c, G
j U6 l/ \4 n7 [ if (argc > 1) strcpy(folder_name, argv[1]);% k+ [& Y" }$ r$ h$ I0 g
else
A$ t- k8 l3 b* Z {
% @ H4 c( j7 { printf(" Specify the Input in Following format : \n");
% E: z5 E) }: F6 y" x. p6 L printf("program_name folder_name folder_description\n");2 y1 G: |9 V7 A9 H" m2 j$ a
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
# [" |1 p) G' I return ITK_ok; & O- |. q/ g% B8 Y. g
}
" c. g; j3 |- ]! Z' b& d1 p# V/ h% Z
/ P3 q' X: u% Q/ Z if (argc > 2) strcpy( fldr_desc, argv[2]);: V! ]. R i1 a; B' z6 q$ Q
else strcpy( fldr_desc,"");7 i( m& R+ j, j1 H- A0 o
& Y! q$ ~: T1 s0 [) U2 u. S status = FL_create( folder_name, fldr_desc, &new_folder);; V0 _; t. e9 R# |
if(status!= ITK_ok) report_error_stack(); 0 Q/ d: r* |3 R* J Z4 X1 x7 }
! ^- Y) N; E/ y7 G status = AOM_save(new_folder);8 b' V: s% a! r* i; J
if(status!= ITK_ok) report_error_stack();
9 z6 |1 f, S# K2 @1 X$ {; l4 n else printf("Folder '%s' Saved; ", folder_name);- \$ l' _ ^: D k
- u9 @7 y: I l8 K0 g6 M status = AOM_unlock(new_folder);, {* k$ O; U4 e" z6 D+ U
if(status!= ITK_ok) report_error_stack();
- \* d- M& X* v, p8 h else printf("Unlocked; ");' J4 `3 ~7 C* c' ?; t0 S0 _
) P$ a+ _ a1 Q1 c4 t R status = FL_user_update_newstuff_folder(new_folder);
% C0 D; G% t; C2 [# S& P$ R if(status!= ITK_ok) report_error_stack(); n2 n' y8 @) ~ W
else printf("Put in Newstuff Folder.\n");
6 k+ k& I' ?) V& G1 r" a
! P# C @4 A- U+ N6 Z8 } ITK_exit_module(TRUE);
( l- @- d4 n- f9 X) o3 L return status;
. a2 R, P. S, x2 i: ~2 ?* [$ Y( w}' N/ q9 A/ b% ~' s. x1 D
|
|