|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* L( M8 b% Z# L/ c# V P% x
8 U3 H/ x. @0 n. g, E# h3 V7 qTeamcenter ITK二次开发源码分享:创建自定义文件夹
3 p* z, { m7 @7 y- b! w; G& e+ U输入的第一个参数是文件夹名称,第二个是文件夹描述。
l9 q f- j, |1 A$ A( d
+ n+ z* z2 t6 c% ]) h" P( q8 {. m) i2 s. Q% b: [- R+ b
#include <TC/tc.h>
$ P. i- s3 E: f3 b8 Q( e/ B8 ? Z#include <tccore/aom.h>
2 g- D% Y% Y, C4 s, ]( _#include <tc/folder.h>
5 S& j$ B$ K0 W& H3 L#include <tccore/workspaceobject.h>
2 ^1 c( r5 _9 G C8 H
9 A7 }3 @/ i% D5 \/ R#define EXIT_FAILURE 1- n/ G7 r4 M9 ?+ b# J+ l
8 g0 |& \, U) P- B/ J- ]8 U/ P1 istatic void report_error_stack( void )
& f+ {5 o+ |8 a/ | {" \! D2 E5 p- y* d. B$ {
int! \2 y) o. t, m2 |) r7 m; p
n_errors = 0,$ e$ t, Q' ]4 ]
i = 0;
9 N5 m3 [, Q) {- v const int
& m& H& L2 \- p, V9 U/ Q1 Q *severities = NULL,
- z: b/ U4 H" G: n( w *statuses = NULL;2 f; J; p- M( {! q
const char4 V% Q9 A3 O5 L# P
**messages;* A' z+ v/ T( F0 P
2 W3 g+ O8 M1 F; T" L. Z- C6 T
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
7 t, ]$ q) e: u3 v5 y' w3 n+ U* v. C6 \ printf( "Error(s): \n");7 M# ~; I7 _" d) r6 ]
for (i = 0; i < n_errors; i++)
& A3 i* t+ I( o4 E7 t9 _0 U0 o6 ] {
; v# r, h) w; f( A printf( " %6d: %s\n", statuses, messages ); I. f* P: e& U0 w) M3 e
}
4 o% D+ g3 g) L exit(EXIT_FAILURE);
' h7 d: ]; d8 F9 p5 J } U5 I4 g: w; v
$ V$ [* U& ~/ Y2 x
int ITK_user_main(int argc, char* argv[])
: e* u' [, C( F3 w- |3 o$ J2 `, f{4 b' D4 p" y1 u
int m9 ~0 v5 N# Z+ C3 Q( \" P8 P+ s: D
status;
8 f4 Q G' ~# a! u; k char2 w9 C' `- W: F/ @7 ^& `3 H
folder_name[WSO_name_size_c+1],
9 Y- K1 [! P' a* i fldr_desc[WSO_desc_size_c + 1],- E5 A( {# U; m
*message;
& L; N% f" e" _& C1 V( S& X7 V tag_t
: _6 [7 _" S4 a+ @/ f new_folder;
9 ]9 @, h7 X: N x9 @; v/ A- D/ B9 u0 H _' F
ITK_initialize_text_services( 0 );
3 ?, @4 g, T' Y) S: Y& l status = ITK_auto_login();
. M) F* `. C% J6 K if(status!= ITK_ok)' m2 C5 J) N- A% X* V
{, Z8 }2 C0 J7 k6 _
report_error_stack();
+ Z& b+ ^7 I1 A! ]1 S N }, o' s) o$ C* B
else
5 {+ `* U, Z2 p/ S7 G* p. q% R' G- C {& v4 U2 R: s4 |& @2 j6 E, Q W0 D
printf("iMAN login successful.\n");
8 ^2 C* a) x3 [( | }
: E$ k$ Q% t8 W+ B/ e# s8 j3 w* u- B( v
ITK_set_journalling(TRUE);
3 t3 w r$ o6 w6 l+ o& C: P" @6 Z- X" r* g" e& G# L7 b7 }
if (argc > 1) strcpy(folder_name, argv[1]);
* k0 P; O- D/ @6 s$ s else% i. r4 y/ Z% h, X) U
{* R1 U( [0 Z; C1 f
printf(" Specify the Input in Following format : \n");8 e \" k3 c( _) E
printf("program_name folder_name folder_description\n");
) O7 d- q$ S- r) a# P; H printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");& d# p5 F( F0 l {$ X/ X! z4 ~
return ITK_ok;
$ l" ? a' @3 i1 q- f } ( z8 y7 ?0 ^) V- m1 C8 W |* U
, x0 V" T J( b if (argc > 2) strcpy( fldr_desc, argv[2]);
: j$ ?- i9 }* w7 P$ Q( I else strcpy( fldr_desc,"");
( D; s5 ^2 m; c. `3 R. ]5 y7 B8 Z6 U# V9 j
status = FL_create( folder_name, fldr_desc, &new_folder);
! m" M8 t9 L1 N) k if(status!= ITK_ok) report_error_stack();
6 u C! y. W# B5 z
5 V8 ~# D3 F2 j' r% ^9 r _' n1 f: Q status = AOM_save(new_folder);
$ L- ]9 i4 B! t+ B4 ~8 }3 S/ c( } if(status!= ITK_ok) report_error_stack();
- T2 x3 x! h0 l0 y6 r else printf("Folder '%s' Saved; ", folder_name);
$ A1 y6 B& o5 `& @; ]7 n( z8 s
Z0 y" U6 x( I; I( ~' B5 W status = AOM_unlock(new_folder);3 I, K0 P2 t+ z: I. v
if(status!= ITK_ok) report_error_stack();4 ~4 f8 ]+ b$ Q4 S+ P; b# a
else printf("Unlocked; ");- C% k6 O. B' F
" u, a9 T) q% `" \; {: Z status = FL_user_update_newstuff_folder(new_folder);1 ~* C6 d L! L" ]2 @+ u% J9 b
if(status!= ITK_ok) report_error_stack();
4 L- M* U; V( n; X' M' A4 X7 N! m else printf("Put in Newstuff Folder.\n");
/ \ p* p! }9 j- h$ |/ ]/ D7 A5 V1 I: r( ^
ITK_exit_module(TRUE);
% T' y% c }' O a return status;1 [/ I4 a, o- }3 U, @
}5 E% f, z3 Q+ k5 B% y
|
|