|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
7 H& s& Y' |5 ]( D- Y }/ a
% A. b" c& ~ \. ]6 V6 Y/ ?! w2 a
Teamcenter ITK二次开发源码分享:创建自定义文件夹
( e9 |' l/ \5 K+ s& R9 A输入的第一个参数是文件夹名称,第二个是文件夹描述。
* h) V7 i5 B [# a# `/ G' u7 c* E' `3 y- S
$ v9 S r7 ]. |) x& q2 |#include <TC/tc.h>( u+ b$ X; j9 A; Q. N( W1 @: d
#include <tccore/aom.h>
5 g8 Z( x# ^7 J#include <tc/folder.h>
, m ]3 M/ p# o+ f. }( \- w7 c- j#include <tccore/workspaceobject.h>
Z: p; n! v+ i; r: O
. \0 e0 T3 f5 F- T1 G* S2 p {; K#define EXIT_FAILURE 1
8 d1 G: K8 m4 U. \! H& Y2 x/ \7 t
# U! q/ }9 V) v, Y" b1 gstatic void report_error_stack( void )3 v% y& }9 e$ W. T. t( ^ _
{
1 I0 A. k( r: J7 x1 f5 m7 C6 V3 c int
M3 T0 ]; H! t5 K n_errors = 0,& A$ d" Q" u4 z; U0 Z, o
i = 0;% k6 L1 Y; b: B" Q9 t/ i& {
const int) Q5 T8 i. Z8 d% ?- ~6 ^, M& A
*severities = NULL,# y4 N0 l+ m: t3 |9 ?8 |6 i) t! K1 _
*statuses = NULL;( n/ m m4 E! y
const char4 k; j. ~ J0 K" F5 N
**messages;1 d1 R$ T5 L) H, Y5 K( {
, E, F- P% j! l+ Q EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
{3 N) s7 K$ _ printf( "Error(s): \n");
( o9 ~- ~/ j: R for (i = 0; i < n_errors; i++)
/ s% g( q: y) }# n+ t {
8 ^& d+ t# d0 m3 H' w4 m" N7 d% S6 Z printf( " %6d: %s\n", statuses, messages );
0 n/ l# t+ g& ^3 \ }) a1 g" i1 ~0 c. e/ g0 y& W' E" G
exit(EXIT_FAILURE);0 r& f$ w: S6 {
}
; {9 `4 c8 w+ J8 U
1 u. W( [: o+ Dint ITK_user_main(int argc, char* argv[])
8 v. V, i3 D! b- |- |4 N$ T/ T2 W{
( j! L: A9 k8 L& f) s3 G& l int9 C9 v; u( X0 k8 s! Z- W" ?
status;0 A" G/ \; M2 `! b0 Q; s' s' @
char
3 K6 O4 g, y; g$ @ folder_name[WSO_name_size_c+1],
& I% M1 n0 J7 \) }3 i- x fldr_desc[WSO_desc_size_c + 1],
) z% h* X3 ~' }* R+ q _6 v *message;4 }% ?! z" a7 ?, v3 r
tag_t
+ k2 j* L& A0 U# g new_folder;
0 e/ N b" ^) D Q7 R+ l) f
6 r) w) ^0 ]$ J q: a& g ITK_initialize_text_services( 0 );( A S6 A% |* _9 ?5 ?
status = ITK_auto_login();1 v( E2 I# V8 t, R# p% J
if(status!= ITK_ok) i+ c+ ?. ?+ V7 Q ~
{5 i+ W/ _( @& A
report_error_stack();( B. h: I8 e! T' q: N' o4 y) V
}
. s) W: j$ u% | else `1 z+ z* f# @
{0 @# p! B4 w4 } I% ], \+ a
printf("iMAN login successful.\n");
0 W! X, L* l) ^( ?$ @* U. P }& N& c1 O; T+ ?. ?8 {
/ ~) u q, E$ j- W1 X! S8 m+ T2 y
ITK_set_journalling(TRUE);
+ Y8 |: b5 o8 A/ d5 [
" C& Q3 ^, ~2 J* J( R if (argc > 1) strcpy(folder_name, argv[1]);6 f) m6 I: x4 u6 v- c
else- a8 Q0 a7 s9 m9 B. w
{
$ r4 I" W' Q6 z8 q printf(" Specify the Input in Following format : \n");0 d' S! D s8 E! {6 t
printf("program_name folder_name folder_description\n");, W5 s$ q) n% w3 |, a% s6 `
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
% u$ [9 N; M e# ~. z7 r3 M return ITK_ok; # N2 b% a/ {2 a4 q, E
} # E( n2 V5 r7 T6 {+ Q
2 ]0 b" g! X9 Z( s- y4 q if (argc > 2) strcpy( fldr_desc, argv[2]);! p* L! K: H8 K+ {
else strcpy( fldr_desc,"");
* l* V+ q- W7 m+ a: m- A7 w' \* d ?4 p/ X8 Q3 O
status = FL_create( folder_name, fldr_desc, &new_folder);7 ?" M6 w' \2 \6 k; y9 {8 V) c
if(status!= ITK_ok) report_error_stack(); 7 C: @ e- x; ~- @% R, n
- R& g0 c5 j4 q5 c6 N8 Z$ Q
status = AOM_save(new_folder);) p* W0 L- o6 W
if(status!= ITK_ok) report_error_stack();- N$ H, A) V. Y
else printf("Folder '%s' Saved; ", folder_name);8 b8 P8 L) y/ t% u
- L3 H1 @# G7 v- N% e. c- n# I
status = AOM_unlock(new_folder);3 `; S4 m0 y, g* j& q0 ~
if(status!= ITK_ok) report_error_stack();
* S: j }( h% e2 B$ y% f else printf("Unlocked; ");
7 V! H ^. b' u# L8 \
" \& H) f3 k6 Z* x9 `* f" j status = FL_user_update_newstuff_folder(new_folder);
3 x! y. f) U8 L x" g if(status!= ITK_ok) report_error_stack();
/ u# b6 A; o+ W" y2 F: ? else printf("Put in Newstuff Folder.\n");
# {; m; g/ h' y$ Q8 t9 y8 |1 W( K. @4 z
ITK_exit_module(TRUE);
) S- ]7 {' |1 M. o; d9 y g return status;" V: ]& ?8 Z9 S3 k+ c
}: Y; t1 G8 ^4 k* f! v [- ]
|
|