|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' X5 Q- J d* V# f
6 r0 q2 T' }# R& @6 p# gTeamcenter ITK二次开发源码分享:创建自定义文件夹5 {" b$ q- T" q1 l y2 t! p h" @
输入的第一个参数是文件夹名称,第二个是文件夹描述。
1 s$ X0 p, W: Q% s% q
9 t2 Q% P1 [. {# ~, B' d' S, d- Y, v# p: X9 T- o/ w
#include <TC/tc.h>
. s& X1 x, w+ h. P#include <tccore/aom.h>
2 v7 b! M$ ^) u- J) ?#include <tc/folder.h>
$ {2 Q& T# B6 U) T+ q#include <tccore/workspaceobject.h>
$ f# w5 ^- f3 E' \+ j1 {* T' R! D: Z
#define EXIT_FAILURE 1
S. A) r. ]/ U/ ?- ]4 t3 c5 \" v4 C. a ^4 S( `5 M9 X$ C. F
static void report_error_stack( void )8 a; g* y& P& R2 S9 o6 a, u
{# o7 ?+ K- [! R
int
9 M2 u" x7 g* a; T, U! E/ i n_errors = 0,
+ x- `# v3 S, I w! b3 W# N i = 0;
. o# M! @' J# [2 c& L7 x& e& o& V const int/ G5 M8 {9 Y; [
*severities = NULL,! f- L7 s8 C; W7 t" Y8 l. Z3 y/ X
*statuses = NULL;" A, M4 Q5 I, z' X
const char c0 f" x6 ]! o1 S( [# o+ F
**messages;
9 @$ f3 o7 y: L+ n: S/ g/ o. @9 F1 [+ l0 g
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );+ c3 O# H' [! Y( d9 e
printf( "Error(s): \n");* ?' d& `! }; M f2 S M
for (i = 0; i < n_errors; i++)
+ l3 N5 S: \! o {
# y- b% G/ u7 h' } printf( " %6d: %s\n", statuses, messages );
7 i8 W$ Q- @" `. b9 F) D: `1 D }) y3 Z- |" v$ J3 s& H
exit(EXIT_FAILURE);. w; {4 P& }9 Q" U5 M
} s \: s% y& O7 z6 O8 y
* |* D# l* G6 U! \8 M& A" l
int ITK_user_main(int argc, char* argv[])4 o" `' e, Y' q
{( i) v9 Y# t+ i0 r
int6 v7 o: O; k) M( b( x7 Z. d; i: J
status;: I9 {0 ?* Z/ J) Q7 z; R' X
char8 j3 F7 L" b- Z. r7 \6 M& D, z
folder_name[WSO_name_size_c+1],
7 ~. M7 J1 z. c( }% L- w fldr_desc[WSO_desc_size_c + 1],
; h0 Q: p" ]# c *message;
( P- H7 Y) J( w# X. m8 y, m3 K tag_t
1 H* Y1 V0 W& J+ a2 A new_folder;
/ l% e5 \2 m1 x+ ~+ M' u. d9 F' z: v6 c2 X; q; S. f
ITK_initialize_text_services( 0 );
. s7 Y1 j1 Q4 K- {# \ status = ITK_auto_login();- c1 t+ Z0 r9 W! V1 _
if(status!= ITK_ok)& |- n- o3 h: w5 f2 l: e3 Z; i/ ?
{$ V0 o9 {3 w0 Q; A) h8 F8 @
report_error_stack();
# d$ s% E, X }' n; l }
- q9 `7 c6 a' W! a4 r6 V J else
4 {1 f# ~7 }/ y: J: U7 X" @; ?* g3 V {8 t; B7 `* l N
printf("iMAN login successful.\n");, S# \" l7 y# \4 o4 l, x( ` R/ ^
}. @8 D/ y" C* q5 W
. k6 H4 X* f) W8 t9 } ITK_set_journalling(TRUE);
6 K# e: W: O$ A& @1 s) E' `: z" N) E3 R# }6 k
if (argc > 1) strcpy(folder_name, argv[1]);. p2 k6 A% ^9 N# t: {
else
" }* P# l3 T9 @* c# l, b# T0 h {& g% Z' A5 J, x$ s
printf(" Specify the Input in Following format : \n");. n! j& `3 i# w0 W& J3 B
printf("program_name folder_name folder_description\n");6 X8 [* s3 L0 T' M8 S
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
5 H8 g' Z' S: p return ITK_ok; # e# b1 Q0 f3 d+ J
} 6 A5 `3 ~ v+ @
- D! g$ }5 z" D: ?! X
if (argc > 2) strcpy( fldr_desc, argv[2]);" y% ~& A+ g3 w, q
else strcpy( fldr_desc,"");
# U' F: x2 w0 |7 K1 I& Y, W7 E
0 F; a! l" Q B; L1 A status = FL_create( folder_name, fldr_desc, &new_folder);
4 _$ C7 ^% ^0 p1 {* ]: { if(status!= ITK_ok) report_error_stack(); ' b$ q3 N0 p) f3 s+ Y; x& [
, I5 e' O3 a$ t0 Y$ A+ `$ @. I2 p status = AOM_save(new_folder);+ ~: X" N# O! ~' J' l
if(status!= ITK_ok) report_error_stack();3 k3 u0 b) e, ^
else printf("Folder '%s' Saved; ", folder_name);5 u- `' Y+ w7 r1 K( K
$ G3 X3 U& I2 E2 S4 H2 ^ status = AOM_unlock(new_folder);
9 F0 u, i& Y7 G* ^- Z: T1 r if(status!= ITK_ok) report_error_stack();
, p8 z+ B( w2 s! }# U! J# M# b) ^$ ] else printf("Unlocked; ");3 C2 ^* A, N$ k1 A9 q g" e
3 K z/ C% E5 ?+ B% F( V status = FL_user_update_newstuff_folder(new_folder);, P: @, J7 ^6 [4 v1 C6 `3 `" U
if(status!= ITK_ok) report_error_stack();
2 R4 t* g# |9 l5 F+ O* p! B; ` else printf("Put in Newstuff Folder.\n");8 F( \1 |5 g9 u6 D6 t( J- N* n- ]
# ~, t. e9 X" b0 S' F+ V ITK_exit_module(TRUE);* D2 g- z1 Y: q( Z7 z W
return status;. R- S. X6 c. Y* T/ b/ l, A% x
}+ J1 L% |6 L5 I% J( Q% N
|
|