|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, W7 s8 w1 ?4 p! s: D- s/ c9 P' Q
Teamcenter ITK二次开发源码分享:创建自定义文件夹
# q5 I0 l0 ` [0 Q( P输入的第一个参数是文件夹名称,第二个是文件夹描述。
9 K! `/ `: o" j$ X% g" a9 u- i. C! _: ?8 s( c+ R
( [$ u! l+ Q8 d& ?' i6 u
#include <TC/tc.h>: n! W5 B7 u0 T. R2 r- I
#include <tccore/aom.h>$ {# H! k9 {; w! m u
#include <tc/folder.h>
; g8 G0 A, r6 G* ^. l0 V#include <tccore/workspaceobject.h>; {/ V$ u2 c5 |, h, ?; ]' W- N
+ s+ M3 m8 H! Q; }( @; {0 B
#define EXIT_FAILURE 10 a" n0 _* T; S6 j3 a% P8 A
- `9 F7 o( d% nstatic void report_error_stack( void )
) B8 N, s2 K% d h0 \ {
2 P- }2 F( ~/ f" t5 e& E int9 w) B0 F0 F k+ t6 B7 `" o o9 V$ G
n_errors = 0,+ \5 N: J5 n t- y7 T- Z6 }
i = 0;
" Q* T: h+ p3 l" A1 l) c# N const int9 a: g" h% G* S) u1 }/ i
*severities = NULL,
3 B' i# J; n0 L& f/ N7 k *statuses = NULL;3 U) C. _, j- p7 v& K
const char9 J9 m; s5 S3 P
**messages;1 @3 `+ a6 b, ^5 h. a6 L
1 P! |: s- J) o. ~ EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
. C, a# S3 r# f; M& d printf( "Error(s): \n");1 j" }7 k7 S3 y2 q0 X
for (i = 0; i < n_errors; i++)
4 u7 E& {0 {4 a/ L0 P* s7 ^8 ^ {
, I& }5 g# Z0 D printf( " %6d: %s\n", statuses, messages );1 v @5 _6 ~9 \$ |0 e; d
}* Z S: K0 G e' N( R8 [: ~ W
exit(EXIT_FAILURE);- X) `8 v% D- M
}
3 {; Z v. {6 D# ^5 @
g0 U4 y' G) U& _+ V1 g9 x& sint ITK_user_main(int argc, char* argv[])$ C6 r8 u: Q2 O2 V- G6 \2 c2 E
{' }+ k6 }9 Q" l0 d8 b3 ~
int% P, ?% x$ C3 c3 q5 r& n1 f
status;) t, y" g q0 p0 H+ x' {, w
char0 X3 E, |1 Y# ?- L9 _8 {% u. h
folder_name[WSO_name_size_c+1],
! x7 G3 L; F- D- ~: C/ m- H: c fldr_desc[WSO_desc_size_c + 1],* I, D+ Q+ `* R
*message;
2 `4 Y& r" v: R1 F; l. t tag_t
Y6 h3 l- Z/ y0 M8 s! c new_folder;
% ]' v) n7 e/ a; q* @3 O1 \# B) {* c4 R
ITK_initialize_text_services( 0 );
9 q6 p& D: ?6 V. |4 q status = ITK_auto_login();7 n& P3 E, @: c/ J
if(status!= ITK_ok)% @: G! Y* A2 e, U O
{. R* d1 K; e% J- s. n/ N& c
report_error_stack();0 o2 _$ _ B. c, B* ^6 A( ]; |
}
7 L1 Z* d N$ g- ?, `* Q3 y else
0 e1 Z5 ~1 l2 Q. _. B {
4 {# j* w! ~# `- L# S! t& O printf("iMAN login successful.\n");
; m K. |9 } T/ X% W8 L }
5 j' r/ c/ L! ?: C5 A8 k \, k
* l& z4 e- w( R# t" Q1 `0 A$ p' a ITK_set_journalling(TRUE);: ?. J& f2 p; r/ E- g: o7 f
# K6 `: |8 A* u- T7 }6 c. F if (argc > 1) strcpy(folder_name, argv[1]);$ _! [& M& \1 u* I6 P
else
( ] L. V; H/ o2 W {
7 K4 s; t- ~& f" J: z3 Z0 z printf(" Specify the Input in Following format : \n");9 `8 Q7 j; [4 u6 _8 X
printf("program_name folder_name folder_description\n");6 G6 Y4 {& |. v! \; x+ ~2 O
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");$ {, r8 Y; P/ v! y( T
return ITK_ok; 4 S9 v6 H$ S/ A; C2 {' y, ?
} 5 O8 a! P7 j7 m5 s
0 v/ T. H' |0 v9 X/ ]7 t if (argc > 2) strcpy( fldr_desc, argv[2]);
3 W6 S+ c; \: H8 [$ J9 |! \ else strcpy( fldr_desc,"");. s; r2 D. V/ r# B+ X; f
) G% s9 K5 V) @3 @2 k& }
status = FL_create( folder_name, fldr_desc, &new_folder);$ R. s# H5 Y0 E# a
if(status!= ITK_ok) report_error_stack(); % o( ]' `5 {4 I3 h) F, J
5 t S4 q1 W) Q9 w status = AOM_save(new_folder);- ~$ [+ d6 _" |% s! l
if(status!= ITK_ok) report_error_stack();8 A) q- a! N8 E- U3 ^
else printf("Folder '%s' Saved; ", folder_name);
; t2 X$ G( G& ^# N: @" m7 O( p& v8 o$ R0 ^" a0 o/ d8 \( T* c
status = AOM_unlock(new_folder);
5 f; h0 y6 B! K. S2 W" A if(status!= ITK_ok) report_error_stack();
2 B8 Y4 _7 ?( r" J else printf("Unlocked; ");
, _* i: q4 R7 R% C$ K8 z& ~2 [& A {- v9 x+ W. ?1 m9 s" U5 p
status = FL_user_update_newstuff_folder(new_folder);' N1 u! T; X$ n/ Q9 p5 C
if(status!= ITK_ok) report_error_stack();, h* y* T c6 x& {( u; M
else printf("Put in Newstuff Folder.\n");8 h- ~# \ r/ U
( N# a7 D5 d+ N# k3 A; P3 }' B8 d c ITK_exit_module(TRUE);" T9 A! ^/ @ D. ^* P, G0 E
return status;
, K, ]( x0 a$ V- V* E9 \}. l9 k! J: s4 i
|
|