|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 R3 E/ Z: O2 E2 _2 w+ h2 p9 @( ~6 }3 t9 y( O/ A
Teamcenter ITK二次开发源码分享:创建自定义文件夹5 {9 t& V% K6 b8 k4 F3 ?
输入的第一个参数是文件夹名称,第二个是文件夹描述。, j0 }& o9 q( i G ?' m
5 U. j, V9 w- L3 @! }2 }& H/ p
#include <TC/tc.h>3 r& Y f! f$ [6 @/ _* r# E
#include <tccore/aom.h>7 P* G ?3 g6 j9 |" m
#include <tc/folder.h>& y0 l% b( M6 J! }9 c* R/ e
#include <tccore/workspaceobject.h>
! K, D* S; {& H5 z4 o9 W
: F! ]" u; a0 i, ^! I/ Y$ A#define EXIT_FAILURE 1% }) r7 J, X) o1 O) ~/ w1 @; c! Z: ~5 q
8 i4 y/ C3 W2 Z! d' v& V
static void report_error_stack( void )
& M: c' X' |, t {5 {- h/ ]* g# I
int
9 p7 t! V" d. u k! k ?7 x8 V n_errors = 0,
, i; ^$ |. { K: } i = 0;
; U# R- o1 f v& a. m const int: |! t0 g6 P* |. I5 a# q6 u! a
*severities = NULL,' h; R+ f) r' L5 e" t
*statuses = NULL;/ b* L# b# f M! ~
const char* ?0 q4 U% h8 ^
**messages;
$ o% s3 C) X3 ^- s5 \( d
$ Z0 U1 a* a* N2 g: A EMH_ask_errors( &n_errors, &severities, &statuses, &messages );7 J8 D' @/ X6 U! S; a2 u/ t! o1 H$ r
printf( "Error(s): \n");. U# A" h6 V7 I* h- g
for (i = 0; i < n_errors; i++) 7 h9 ]/ f* n7 l+ F$ [
{/ G- {4 Q0 Y) s+ x6 M
printf( " %6d: %s\n", statuses, messages );2 b6 v( D, p/ c: |
}7 K, P% b0 j2 b
exit(EXIT_FAILURE);
! V4 G2 @7 ]: m2 z/ ]) L. o }+ K1 Q& z8 t* Y8 l P2 `
1 M3 c9 D5 J2 r6 [" Q9 l! R
int ITK_user_main(int argc, char* argv[]), n8 D0 P9 M9 g1 G4 s; b F
{* }# h% W1 ?, F( L8 K
int
/ R; J }1 C& p3 U$ ~! t status;
7 M2 }1 q/ D3 G) _* V" w; h3 f char
6 a3 x6 w2 @* V' _& ~ folder_name[WSO_name_size_c+1],$ M) n) Z2 a0 ?- z
fldr_desc[WSO_desc_size_c + 1],
7 n9 A! F! q1 V, ~ *message;% ], [6 C% g) ?- ^( u% d3 H
tag_t
% @/ H! }" z0 t6 D' q0 v1 z& n new_folder;; W" g6 R" F& X! [4 c- O8 H
/ P; U- m1 y. r
ITK_initialize_text_services( 0 );
% k t- e U0 v: S$ {* j3 J status = ITK_auto_login();0 D+ A; f0 e1 i9 H/ J0 \% ?
if(status!= ITK_ok)
3 f2 w" X0 Q8 s* g {
8 O- d$ Z; b( ~: i: |9 R, ] report_error_stack();
! F. y% S/ {8 R- v1 A6 @" D9 W, f }
: G% X6 H0 b1 ] else: U* P2 C% _( l8 x _
{
4 _: i7 g! S! L6 ^/ n% U3 W/ ^ printf("iMAN login successful.\n");* v; o% R9 n# Z' o# U( [
}$ b8 S6 b: x! C9 \% G0 E/ \
1 Q0 i& ]$ S1 p7 ~" t ITK_set_journalling(TRUE);: r. z" ~% O* @, E) a9 ^! _
. s% h0 k- Y0 a4 y* T y
if (argc > 1) strcpy(folder_name, argv[1]);0 M' p% `+ x, l. U b
else
6 W5 h# |+ A* B- `4 w; }1 f {/ Z4 Z5 c( l/ S+ ?$ Y' U7 U/ b$ m
printf(" Specify the Input in Following format : \n");
: q- q8 R+ ?6 y% ^0 d& a printf("program_name folder_name folder_description\n");8 `8 B! ^" R" T5 L6 b6 z% Z# Q
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
2 z/ y" s+ J1 X% U return ITK_ok;
9 L3 `+ c$ T! G+ W) M } 8 o+ h5 v z9 h1 x
; x" c2 c+ w' X
if (argc > 2) strcpy( fldr_desc, argv[2]);
# J- Z. m* a; B/ M }) V else strcpy( fldr_desc,"");( d. n% \, o6 U- L% r3 i) `
- T: j! U! N- Q! s- @9 m& e
status = FL_create( folder_name, fldr_desc, &new_folder);
x/ U! K; l3 t: w if(status!= ITK_ok) report_error_stack();
0 M/ U: t& K% y$ g" s& n; t4 W; Q2 K7 a \
status = AOM_save(new_folder);
7 e) x+ ~) l" ^. W2 l- ^ if(status!= ITK_ok) report_error_stack();3 p3 C) |5 S4 \( C3 q/ }" M
else printf("Folder '%s' Saved; ", folder_name);1 w/ P8 ?$ B0 R/ P6 j: Y- O
& C: B6 B: t/ R1 e, s, ?. K status = AOM_unlock(new_folder);
7 ?/ C, l( H; Z9 n, t; ~- a if(status!= ITK_ok) report_error_stack();
3 k O* N' x, f& \! a) c else printf("Unlocked; ");" a; Y" M# s! O1 V: X# Z" F
9 |4 u! E! @; s" p
status = FL_user_update_newstuff_folder(new_folder);
4 a3 w1 @- e) Z# l6 t. q% o( i if(status!= ITK_ok) report_error_stack();
+ m" \7 M5 s W/ v else printf("Put in Newstuff Folder.\n");
f3 W' V3 D6 A" t- O
: Q' D Z- k+ _: |+ G1 m0 Z. } ITK_exit_module(TRUE);
4 E& h* e r" D4 ]* h) Q3 K return status;& n. j1 |( B( w6 x
}" Z" M; [# N1 a- L
|
|