|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 G5 j: g0 c5 C6 r
5 z# |3 O( X# v
Teamcenter ITK二次开发源码分享:创建自定义文件夹+ h6 r0 D# \0 i8 `7 ~
输入的第一个参数是文件夹名称,第二个是文件夹描述。9 }) K7 M* L' }5 J
9 p2 W4 _ Q, O: v
4 Y& r+ U: q- ?; [0 L8 _' r
#include <TC/tc.h>
5 j, }4 V+ e9 R- t# h! J& Z#include <tccore/aom.h>- Y# h6 Y; A2 X+ I! p
#include <tc/folder.h>
) X! C8 s( s- x$ C#include <tccore/workspaceobject.h>0 Y2 B8 {; [- @8 z
# L' p5 X `* I7 _- ~' E& Q
#define EXIT_FAILURE 1 {* L0 W5 W* H# b9 {! G# g
4 r: g% i& J+ b! ?8 t
static void report_error_stack( void )
9 r* P; b9 ]4 p# b. i$ j {, t/ m6 y+ k% g6 J/ z
int
. d. U" k) H& h6 P9 `0 k3 M n_errors = 0,
+ X* o. Q7 w0 F6 D9 H6 B& b: O i = 0;3 q8 i9 t+ f3 |, O2 }2 l x1 Z
const int
$ V- I( x8 B) L/ P6 E4 ^. k *severities = NULL,
* Q( H3 f+ n7 w& M6 ?6 u *statuses = NULL;
* L5 t3 D. h4 W" ] const char0 R' d3 R# s7 `1 ^7 s
**messages;
! }* V& p4 d* x0 |2 _/ v7 W; U+ a4 J2 m6 h/ B0 t
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );1 {+ R& d% z" ]4 S1 ~+ c% x/ u$ @7 B, g
printf( "Error(s): \n");& G2 B( M( [9 Y# F4 L
for (i = 0; i < n_errors; i++) : b4 v7 d: g5 G* X) r. {8 n$ }
{
$ k2 e1 b, M0 K; U$ T- t printf( " %6d: %s\n", statuses, messages );) T% o1 Z8 i7 V, C# M' m8 g
}
( t1 f# @/ V& `* p+ p6 D exit(EXIT_FAILURE);
& `; r% O0 J' y) X' \ }
( @) [2 S' e% R- ~4 u1 r! |
7 Z5 @4 N0 o& ]' b% lint ITK_user_main(int argc, char* argv[])
8 G5 r- x' R, q0 g2 m/ `! Q{
) \7 h5 K- c; p. D. O& W int/ H& \ Z; g7 v- ]5 I- _
status;
7 R6 I$ g6 }+ y8 r char6 F2 E* P4 L3 `# d4 V
folder_name[WSO_name_size_c+1],
& b O. q) G: g Y5 ~2 X fldr_desc[WSO_desc_size_c + 1],/ |3 M( l; B- y0 \1 i
*message;, ~9 J" A9 n$ ~: ~! g4 U9 g) H
tag_t
1 r8 R* S6 J7 k* E; M new_folder;
! F. X( V) l2 J4 ^; d( e, ?7 h C5 X7 L- E& ]5 S
ITK_initialize_text_services( 0 );9 s) x. |4 m+ |! \( F
status = ITK_auto_login();$ z: W- i, M4 U5 {- ]: e; m$ C
if(status!= ITK_ok)) p, U% u9 ^; z7 W; |
{( J# n2 r" `/ g+ ]
report_error_stack();( F4 A4 H! o) e. W9 f1 t2 i s+ ^7 ]
}! s2 M8 Q, s5 N0 S
else
& _1 B4 i0 [3 i5 ?5 l6 w {
% h n) D* k9 H" D4 ^) s: C5 `% R printf("iMAN login successful.\n");
+ `4 n) F9 \: X. v }. D7 s% V7 V7 }2 L: ]
6 g% c3 ^; ?& f$ e# B
ITK_set_journalling(TRUE);' l$ t1 a; g2 i: f) R+ _6 h! y+ T
# \/ q0 R2 \5 \ y. E if (argc > 1) strcpy(folder_name, argv[1]);
" ]2 m5 M8 z4 G else+ p! b- J1 |3 M$ t/ z7 U
{/ w* C- v! ^4 K/ t( A
printf(" Specify the Input in Following format : \n");. q% m, H+ u1 y8 ? T6 \: v2 i
printf("program_name folder_name folder_description\n");
1 b8 x. Q$ W. k9 \7 i. O printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");/ z- ]# {7 _( H: ?( N/ G ~; J
return ITK_ok;
# U1 U& U6 u; ]6 H: {3 Z# D3 c7 F) t0 I }
4 c1 y/ G, S; _
1 b0 M2 \$ C' Q. d$ R if (argc > 2) strcpy( fldr_desc, argv[2]);) l7 {: M5 O" F* A- I1 f2 q
else strcpy( fldr_desc,"");& F2 t4 ?2 [; j/ p4 {4 B, u
& G- K0 n# j2 ?9 e
status = FL_create( folder_name, fldr_desc, &new_folder);# m' B w6 r7 F0 D) |
if(status!= ITK_ok) report_error_stack(); # f4 W9 Q7 I% w; z: Z$ ^3 Z$ t
5 M+ z" F: Z q
status = AOM_save(new_folder);
5 c, A: {$ P# U if(status!= ITK_ok) report_error_stack();" a* r0 a+ r: i' F
else printf("Folder '%s' Saved; ", folder_name);( i* ~% e$ C. o! c: I. v
' c5 [+ B( k9 ], H' Z X7 I* R
status = AOM_unlock(new_folder);7 Z5 z. _/ J$ @
if(status!= ITK_ok) report_error_stack();
1 P8 P* l4 ~3 s$ \! r else printf("Unlocked; ");& i9 u1 U4 I2 i0 U
+ m9 \: `$ V0 M+ W0 J. ^ status = FL_user_update_newstuff_folder(new_folder);( {4 M& Z. U0 {$ x2 ~+ m4 J
if(status!= ITK_ok) report_error_stack();6 I* i' i* O8 g$ ?. k# T
else printf("Put in Newstuff Folder.\n");# Y* i$ `0 y& X8 s& f+ O
. S _$ H9 M$ H4 }; z* l4 x/ o
ITK_exit_module(TRUE);4 g- y) D( d* C1 U- O- r5 D$ ^
return status;9 [! P( ~6 G4 d
}9 X1 l; K5 J! v/ b) p- ~2 V" c
|
|