|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 X1 v) |" N I; Y3 v
^9 Q4 Q7 z9 } w2 l7 iTeamcenter ITK二次开发源码分享:创建自定义文件夹
2 a; a g& D1 Q1 G输入的第一个参数是文件夹名称,第二个是文件夹描述。" l" W% t" p9 c) H
" k* ?1 l9 _% i
* A. v2 A! Y E9 A$ e/ O' G#include <TC/tc.h>0 [3 A7 G. T/ b5 c
#include <tccore/aom.h> x% h- U4 T3 y1 W
#include <tc/folder.h>
# H$ H% ?* |0 E/ m#include <tccore/workspaceobject.h>
& B6 I: O8 I) ^/ _; p* J" i3 e9 P' m6 y3 G
#define EXIT_FAILURE 1/ h. X/ |: e: i% d$ }# d }
1 r M6 d4 T+ X
static void report_error_stack( void )
. {9 i$ S" L2 b {& U. W$ }' Z5 T/ d9 D
int
/ m* N1 t# g/ P n_errors = 0,
3 f0 Q( `+ _, x% X i = 0;, j) m) L5 t4 f* R6 P! ~
const int
: Y w. `- x2 H+ f *severities = NULL,
a2 R1 b# n/ x( v0 X/ O: B! n0 ^ *statuses = NULL;& q, i" R: T8 F( D
const char
F* X) c) o- ?1 B5 I **messages;1 l9 p: q) J! h# t1 h. R$ U
m+ f( s$ [9 O3 \; ]
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );+ k9 p: N, x! Z* o7 y1 x$ R
printf( "Error(s): \n");
* i' U, N% t- |% l6 S8 } for (i = 0; i < n_errors; i++)
+ \, i0 Z" a$ Y; z: v {2 z# T8 a- q/ \4 H4 j2 A
printf( " %6d: %s\n", statuses, messages );
. ^/ B4 I; ?6 V$ ?6 |) T }: e1 M0 ~3 }# N7 I0 d! C. B3 I
exit(EXIT_FAILURE);' c* `+ e9 z( ^# L6 w
}
2 }- B& c3 z. ~! {% }7 A; B9 a! J$ y& d
int ITK_user_main(int argc, char* argv[])
0 i, ] W' v; R{0 k( ]! }; t4 S3 \: z
int" Q3 S# v; Q6 E
status;
2 D! g% W- ?$ p1 y5 `! Y6 @ char
9 d* o3 `/ K. a' G8 b' f folder_name[WSO_name_size_c+1],+ l0 X, h: w6 A n% o# r6 W. L$ `
fldr_desc[WSO_desc_size_c + 1],
- F* A5 T9 v# ?: k *message;
- F. _4 ]2 T+ b; @ C8 @7 K tag_t
1 s5 t# p$ |! B: z8 t% o& I c new_folder;
( l; e9 x5 v, B% w6 y
+ l2 q' F6 L8 B* u/ H# f ITK_initialize_text_services( 0 );
$ w/ b' A ]! p/ t B( a. ] status = ITK_auto_login();1 O p, r7 Y) `8 S$ E
if(status!= ITK_ok)
3 l& }% {! X E {
) {9 {! O7 q" J7 F6 U; C report_error_stack();
& s4 Y# ^% m: a3 K$ z3 B }; E. T0 X$ o$ R
else; ^& }( e) U% m* j, D- y
{
2 s6 q; @( B& c: ~8 B/ H* g4 i printf("iMAN login successful.\n");
6 K$ Y+ W' g/ G2 ^ }. {% Y& x' H* w- @7 v
. C+ m% P5 y, J. @; z ITK_set_journalling(TRUE);
5 b$ B, P2 S# ?' }( z5 w0 F$ F6 S: S& A1 `% f6 g
if (argc > 1) strcpy(folder_name, argv[1]);
! ~' Q5 f% ~6 t+ J else4 z* o5 e2 G! m$ Q {$ D) l6 A5 {% L
{; V# Y$ Z* d+ P) V
printf(" Specify the Input in Following format : \n");
7 C/ |% I* j' V. m printf("program_name folder_name folder_description\n");/ M" {" ]. G1 D! A2 Z% [
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
) d+ u5 }! r# A5 w5 e0 [. A return ITK_ok;
7 Z$ r" C1 _' P" {+ ^2 D } 2 h) W. p4 a0 J
$ J9 ~; p6 ^+ K5 ]
if (argc > 2) strcpy( fldr_desc, argv[2]);
! Z1 g7 @' t* L6 X! }9 M else strcpy( fldr_desc,"");0 }+ f; H1 B, e- n e
7 O: u5 r2 G" r2 ?8 _ status = FL_create( folder_name, fldr_desc, &new_folder);
+ N" y5 h$ U+ z! K0 A" } if(status!= ITK_ok) report_error_stack();
0 ]+ y0 P6 X0 Y: I! o! {) ]: D, J' o% Q# z! E6 a* i- o$ p S
status = AOM_save(new_folder);- S: c0 R: d- u/ n/ C6 w0 N9 m
if(status!= ITK_ok) report_error_stack();
1 v. y3 N0 j- a' G9 I else printf("Folder '%s' Saved; ", folder_name);
/ z) E+ N; T# ~. R7 M; |; G
% q2 D+ S+ [# v status = AOM_unlock(new_folder);
' x: d2 o [; L) f4 Q" p if(status!= ITK_ok) report_error_stack();$ o3 B7 R, d$ B* n- ?6 d, {. g. E' J
else printf("Unlocked; ");
: [, @0 L% `; ?# V# @8 a; |* A
$ U& E: `1 @% O5 ]; T3 R status = FL_user_update_newstuff_folder(new_folder);/ T. G/ n6 j3 [& o. I
if(status!= ITK_ok) report_error_stack();. s% J9 [9 T c1 o$ Y& |4 L6 A$ C
else printf("Put in Newstuff Folder.\n");; C. z+ R$ G8 z/ W9 _+ G
+ K( Q6 C8 e6 z4 r0 g5 W. G& @% _ ITK_exit_module(TRUE);# U1 ~! z& u' T/ B7 \
return status;) a. C& y5 o# J, h: l" S6 u9 a
}
! s7 p: q1 ]- \4 X. {7 y( { |
|