|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 l" q! K. D/ s( V3 y, x
' ? j j# e! m- l, QTeamcenter ITK二次开发源码分享:创建自定义文件夹! g% Z; X5 N$ N) Y
输入的第一个参数是文件夹名称,第二个是文件夹描述。
9 K/ _" ~: m2 e
# z% w5 L6 Y( C# e8 U: [9 i$ ]/ }. ^+ A" L M) b: h
#include <TC/tc.h>4 X, i$ h+ I' e l( s' v: W1 s
#include <tccore/aom.h>
! v' q. U% l8 T% G#include <tc/folder.h>
6 q' }* _- A' {; ?1 W#include <tccore/workspaceobject.h>
2 w8 o; B( a- t
8 t0 k. k( H# ~#define EXIT_FAILURE 1: y" p+ w" g: Z7 T8 t( i. v
6 |& N0 |8 Z, A9 Sstatic void report_error_stack( void )
4 z9 Y( l4 _% a# ^$ Y" D H, L) r! G6 E {
( B" E; o$ t0 S3 }+ C5 p int
/ B7 H9 {7 H6 s4 \5 a# u1 @1 [8 T. q n_errors = 0,
9 G) L! o; u/ N( l i = 0;
2 i8 s# y' P" L8 T const int
3 M/ S3 y+ o; I9 \" B) X: O *severities = NULL,
! e. I0 k7 l1 ?, c7 {; S+ S *statuses = NULL;
* n/ k- ]3 ^6 N% c$ l5 V const char
6 y7 Q. U4 x5 v" G0 ]+ b% \, V **messages;
" [+ j/ _) V" g' r$ u3 z) I P. ?" C6 `* S- Y5 C5 Q$ q+ H
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
) K8 J" y7 f D6 Y; c printf( "Error(s): \n");0 q4 a ]/ z8 a
for (i = 0; i < n_errors; i++)
/ Q& h0 P2 {- H: z7 K; t p {, O! p0 }4 o3 q+ t' P
printf( " %6d: %s\n", statuses, messages );# @# n5 k. p6 \# n9 ~
}
- \0 [/ \* O" Y! ^ exit(EXIT_FAILURE);. C* Z5 L- P) Z( {4 o& _
}8 z5 W, A, x9 B5 U: j+ V% C1 [
/ m* ` t/ U, o) O9 h
int ITK_user_main(int argc, char* argv[])+ s2 M! k4 j+ y! ~* | u; t; o
{- L* s0 q5 d( c9 }) J% r; s6 L
int2 ?5 q7 ]* o! ?; q2 F% p
status;' U, F) L. A, ~3 n# S+ G
char2 P2 t, c# m- Q/ c
folder_name[WSO_name_size_c+1],2 `0 C N8 l' f1 D
fldr_desc[WSO_desc_size_c + 1],4 D3 b7 ]# }6 T9 G
*message;; ^( e5 d# J, `* a2 H) X& R
tag_t
; j$ A# X, i: q+ H5 O new_folder;
8 N. \, b1 f. g- t3 n; V: t9 `' z4 G7 X6 X+ f1 j; W, S
ITK_initialize_text_services( 0 ); W8 N. q% z: w3 N
status = ITK_auto_login();
3 T5 L) S2 C& B7 X9 h if(status!= ITK_ok)
$ B5 p: z5 J2 ?$ ~; d6 t' d } {
% _6 E( \; O* b% M/ u* G report_error_stack();
3 c6 B3 r8 o! `% S/ l }. a! w2 |- V6 f7 p# c9 N
else6 R0 D3 w1 ?+ |/ o5 q
{6 y/ U" g* A$ K( r L7 g
printf("iMAN login successful.\n");
" k, |. j6 ?0 r6 C E6 D4 a }
+ S( P' t1 I5 ]8 z l$ Q& F2 K9 Z2 a; L5 J8 @- R3 J% u
ITK_set_journalling(TRUE);* @) R# J! P+ m2 V( w5 ~
8 r: n' V: _( ` if (argc > 1) strcpy(folder_name, argv[1]);0 F$ `9 L9 H$ z6 M6 B
else8 i9 b# H3 j; G# K
{
! D( J% F, F j* A# ` printf(" Specify the Input in Following format : \n");7 o# K$ A0 C% F0 o6 }8 B7 P0 X1 L
printf("program_name folder_name folder_description\n");
0 H0 G6 _8 V/ [+ l+ f4 C printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
1 h% d; N. d {7 X% ~ return ITK_ok;
1 i/ J2 I4 g! X+ W: z }
) s+ F8 b/ J) n% T1 l; |; z* f+ c) A& J2 @7 f/ n
if (argc > 2) strcpy( fldr_desc, argv[2]);
( a; R6 A* Q8 | else strcpy( fldr_desc,"");
/ v @2 y5 i1 q- F1 N) \5 o6 U4 m, H" W( o
status = FL_create( folder_name, fldr_desc, &new_folder);
9 a( t9 D- b/ l4 @$ k3 R2 H* p if(status!= ITK_ok) report_error_stack(); & B5 V# O o' V e
4 L8 A/ \$ s( M8 X @: l5 e* h
status = AOM_save(new_folder);
! p1 ?$ n* A5 A+ ` if(status!= ITK_ok) report_error_stack();
7 _7 V2 S) Q) V; p1 G$ b1 d else printf("Folder '%s' Saved; ", folder_name);
& F9 }% _9 Z" B8 A3 W
3 }$ p$ O8 j4 R: K# \& }7 {+ K; R status = AOM_unlock(new_folder);
. F+ o: s/ l2 e. w# r5 `8 h; K if(status!= ITK_ok) report_error_stack();5 M! p1 J4 Z3 y: v1 l
else printf("Unlocked; ");1 ?8 H) X T; ^: S. J9 H& [
: A) E6 O8 N5 s status = FL_user_update_newstuff_folder(new_folder);
) g8 k5 x/ Z' D' _* u9 e9 v% V% e if(status!= ITK_ok) report_error_stack();
6 \2 b; v) L8 @3 S+ R* q& C else printf("Put in Newstuff Folder.\n");
2 ]/ m! i: _0 W$ J6 g* M& ]8 U6 t5 ]. U1 I A# C$ X' @- U2 m9 j
ITK_exit_module(TRUE);( W7 N6 ^( k3 U1 T4 h# Y# u
return status;
8 C1 ~) v( `6 B* D, j, G}
* _' {- ?& d6 p' L1 F: l; B |
|