|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" ? R* m4 L7 U! h1 Z
, K* }; S( w9 L3 R
Teamcenter ITK二次开发源码分享:创建自定义文件夹
7 O% R% q+ D. H4 n' b7 C输入的第一个参数是文件夹名称,第二个是文件夹描述。
. _% U7 x* f& F' a b d- K5 e( m7 L' |' k2 E9 ] h9 j. u
& z5 b3 k, V) l, b0 f7 j% R; w#include <TC/tc.h>
7 k" Q$ p& _& t# H! L#include <tccore/aom.h>9 a" s7 M$ W) b6 }
#include <tc/folder.h>
) Z2 S" N- i6 \- V# I5 K. s3 |#include <tccore/workspaceobject.h>7 W3 \8 D) _' }+ S1 L* J! G
) j9 H" h$ g3 [( l#define EXIT_FAILURE 1! T% S0 \ H6 s0 ^$ Q
; W* L+ C% w: d8 R4 K3 K% K2 Wstatic void report_error_stack( void )8 G8 V9 f' F3 H' A* X
{
# t/ p4 @; [7 W int6 U! P+ J2 d$ V# D X; H
n_errors = 0,
4 q0 J) K: ?- x2 I8 \ i = 0;5 f" [/ y/ s$ B- D) M3 v
const int( _8 C d* Z9 ]; t' k& L" w6 n
*severities = NULL,
G- \+ b1 f" S1 Q! _8 ? *statuses = NULL;) e! w+ ]) {! }" a/ j3 c
const char* W/ T7 |( h% N/ L6 f
**messages;
8 k2 Q: _ j& o' R
$ k, T- D* d) n$ Z& a EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
+ N& f! K0 e3 c- \# D, ]3 M printf( "Error(s): \n");. `3 {6 r, Q# R" R0 W; _: e
for (i = 0; i < n_errors; i++) - e! k: O- a# ?
{
/ ]) h" r4 x* L: S printf( " %6d: %s\n", statuses, messages );) j6 f1 }0 y4 e: o( @
}& V. n" g0 s7 l; W: O! s
exit(EXIT_FAILURE);
5 t" p$ ?. @1 D0 i }" n/ U1 b) n3 S( c( i
1 G+ a6 @+ g7 F4 F0 z; \- ]
int ITK_user_main(int argc, char* argv[])
4 A4 i# d1 q; s1 Y$ \5 Y{
1 V3 c# |; ~! u1 v$ d; R9 j int3 [2 Y( @: H6 t4 t$ m, M
status;) i1 P" p5 M( p- I9 ]0 W
char
) p3 y. ~2 S! l# s' p" _ folder_name[WSO_name_size_c+1],
# _4 S2 H" U& _2 g. I* ~ fldr_desc[WSO_desc_size_c + 1],6 _8 t8 a6 t+ R: b& s- ^. X) y3 ^
*message;
; ~* @. T+ l3 l2 r6 v* H( ? p8 } tag_t
3 T8 q( n6 b$ P- C0 ] new_folder;
% |. J1 t7 R1 ^7 k, m% Y+ _6 l$ ? _5 F( m& B0 A/ V
ITK_initialize_text_services( 0 );0 A8 C' P7 B$ m+ n0 c: p* D
status = ITK_auto_login();
* s- v$ W0 h0 w! H if(status!= ITK_ok)
1 E! i& {; V4 {6 ^5 O {
0 W9 S! ^! Q! [& c, C report_error_stack();
+ Q1 g: Y$ C6 b1 z- P, X }
1 s# j- _3 f3 m: s! R4 `* ^ else1 r1 N' |9 \0 ]" c8 E9 K! Q
{
; X4 }( D: S& d' J1 N& p5 H printf("iMAN login successful.\n");& ~- U7 T' Z' l9 r7 Z
}5 K; _$ }6 z+ R' D5 k- J
+ I% c! f' H( J) V8 d* ]
ITK_set_journalling(TRUE);( N: b9 p( A: r% @' y
( f) _- ?5 o) p6 h$ x* n7 j3 G5 `
if (argc > 1) strcpy(folder_name, argv[1]);
* P# K( i0 x2 a$ u" V0 C2 S else0 c0 g1 n* f3 o$ o# p
{
! O$ }4 k S5 w2 t+ e) ~( \* }% P+ X2 z& n printf(" Specify the Input in Following format : \n");" t2 P# r5 j& [7 S
printf("program_name folder_name folder_description\n");% V5 f7 T4 ?$ j
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
0 d; P' ?4 [: x% \, t4 L, _ return ITK_ok; * s& F, E5 V* \# \
} m; w9 p! c. x+ _* `) F) y% f7 Z
! C, X% g# [9 }& R, k4 G! B; D if (argc > 2) strcpy( fldr_desc, argv[2]);2 I! Z p* ]6 O. N- a
else strcpy( fldr_desc,"");0 h7 |2 `7 U! k/ J( f6 Z/ d# @$ i
& s2 N+ h* H, O: @/ L. _! \
status = FL_create( folder_name, fldr_desc, &new_folder);+ z) ?! W& C3 z
if(status!= ITK_ok) report_error_stack(); 6 n! Y: b3 y& f3 N G) L
7 N" r' V3 ?6 P" O5 C$ |
status = AOM_save(new_folder);7 [! D: j7 r: ]* r- E
if(status!= ITK_ok) report_error_stack();' \3 M; l1 @# z/ o3 P) M
else printf("Folder '%s' Saved; ", folder_name);
$ ~% S; u! \: O) b0 q6 W- f0 C; [3 U* O Z, o! P% f
status = AOM_unlock(new_folder);8 Q: U# b& ?3 y) V6 @/ G# w
if(status!= ITK_ok) report_error_stack();7 H0 ~; ] x" E% E
else printf("Unlocked; ");. J% N V! r" z1 p d( Y6 S o
9 L7 c5 z6 g# V- y+ j1 ` status = FL_user_update_newstuff_folder(new_folder); |, a; \5 T9 r2 q
if(status!= ITK_ok) report_error_stack();
/ T+ I" t3 ~8 c; k* @9 a' R! T' Y else printf("Put in Newstuff Folder.\n");3 V5 [+ R. T* T5 j( \
/ g' p* I. z4 [$ e0 y ITK_exit_module(TRUE);
* q8 n7 N2 \. R' L {+ [ return status;
! W% T! h0 E' a+ H' k( {" v}, W: x/ {6 t# K' s& ]
|
|