|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, q" N$ y& `2 M- y* d8 P* ]( X4 ]! c+ O
Teamcenter ITK二次开发源码分享:创建自定义文件夹6 U1 T! N E7 Z e3 ?& w6 O" w
输入的第一个参数是文件夹名称,第二个是文件夹描述。
# o/ e2 g2 b3 w; x1 @- b; ]7 d5 A0 ^7 b% j Z# i6 a4 F- g
- ^7 |# ?( P. O6 q4 }#include <TC/tc.h>
" ^/ z3 R T$ ]" X& G#include <tccore/aom.h>
$ o! X G5 p! {4 g+ A( f#include <tc/folder.h>! F/ b( ^1 ?& O0 K
#include <tccore/workspaceobject.h>7 ~, g Y8 L2 i! U
, K( X. D+ H0 W' E4 k& f6 F- X
#define EXIT_FAILURE 1% V- V( o& |* n5 v
, O, ~4 z. D4 u/ _7 o6 w6 H. Istatic void report_error_stack( void )
* u5 U/ k% H, Y, D9 C/ u% p" R% h {, T3 M" N) K8 y$ r. L5 h5 u" g
int
7 R' }. _' Q( W! ?. ` `6 b7 ]7 {) U n_errors = 0,4 H6 D7 ~6 [: F& E
i = 0;- C) t& V1 I4 W! ]2 t1 p n
const int" K) l/ c! ]5 d2 {) }% O: X1 p
*severities = NULL,8 O7 z$ H8 I% c3 g" x; Q( n; v2 P
*statuses = NULL;4 w1 ?! D5 M4 L* D% U4 W2 B, P% X
const char
- d1 i$ @) }+ s# b% h **messages;
, J9 X, H, S6 g5 ]5 D. o# a5 G* w0 f( u# ^1 _
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
$ u( w2 B5 X% J, B8 C5 p: p printf( "Error(s): \n");: I; ~, c. i: p4 \1 ?
for (i = 0; i < n_errors; i++)
E8 r2 \9 k* {- T$ a. e0 h {5 a2 Z( }. s- W$ p/ [. [7 N4 D' V4 u
printf( " %6d: %s\n", statuses, messages );4 ~& B! D$ e, @0 B2 F. V
}9 P M, Y+ V* n
exit(EXIT_FAILURE);1 [" N/ i. {2 x- d/ E1 d
}( W; Y* w F% h- X
" W/ q4 Y4 M$ _ Q! Fint ITK_user_main(int argc, char* argv[]). T" f3 d) D w) x7 u0 O4 r4 |
{
7 r+ `! G2 E2 \- H: k- k* ~ int, C7 d( J5 I" E( q: @
status;1 M+ w+ e; S- V8 ]5 q- S
char# U1 h! Z1 N) T9 H0 H3 A0 J B
folder_name[WSO_name_size_c+1],4 s/ {# ^6 s: s: H
fldr_desc[WSO_desc_size_c + 1],. H) s2 R" Y; ^# d W& Q
*message;
+ _" l8 m6 @- S3 R0 ~2 C tag_t
]0 h% ~* M" U) x new_folder;
B3 \2 K. C: n5 h6 r# H( Y
% w: H# [: i M$ k1 y/ o; q. Y ITK_initialize_text_services( 0 );1 \& T* i6 s: j
status = ITK_auto_login();
& N1 J$ |! J6 i6 d# ? if(status!= ITK_ok)) |! _( {; W v
{0 R ?# D6 u$ m- \4 s* y
report_error_stack();, o5 x- x+ O# f6 @! L
}# z8 K% v2 F8 _
else! D2 u ^2 V( y+ K& h
{
$ Z1 b. H0 o3 W" r( S' U/ ~- M printf("iMAN login successful.\n");9 F1 V3 ?+ P+ ?8 q7 i" |; h
}
5 ^/ s( ?0 n2 g
" ^$ T+ Y; d {1 _( J ITK_set_journalling(TRUE);
P& n6 f6 P0 \( I; m, V: T0 {7 K
if (argc > 1) strcpy(folder_name, argv[1]);. [/ F& Q% V5 a
else
1 `5 c x! ?+ {5 p! _% G {
3 G/ K1 T) S: b/ S" h printf(" Specify the Input in Following format : \n");
6 t, ~( U* S+ l/ g" c printf("program_name folder_name folder_description\n");7 O5 m; [& y0 ?, S2 w+ \+ u
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");7 V, ]% u, V! ?. d
return ITK_ok; d! ?, G" R! |$ i3 P$ f
} z/ L1 L' u [ x4 |8 {2 s
- @" B# q! P5 y/ m# _) d& [6 Q7 r$ J if (argc > 2) strcpy( fldr_desc, argv[2]);
5 w: l3 F& N5 d; m2 E2 D else strcpy( fldr_desc,"");
% l* o1 ]2 l( }0 \& q- Z+ @5 P" c( X3 o3 [$ B
status = FL_create( folder_name, fldr_desc, &new_folder);, G+ U4 x& ?: Q3 f; e8 U# ]! Y
if(status!= ITK_ok) report_error_stack(); - _7 J; E" n0 e* [/ j* Q5 i& j, }
5 U9 P' p( x0 x) _. G
status = AOM_save(new_folder);; _9 ]7 n3 i8 S [) v
if(status!= ITK_ok) report_error_stack();
: M1 | b: c) l. H$ q+ n4 k/ m* | else printf("Folder '%s' Saved; ", folder_name);; s# ~! ?, _9 k( M! s$ `% k( |: @0 a2 y
) v7 s! M3 B4 f% v4 H3 |
status = AOM_unlock(new_folder);
; p s' w6 X* o2 f0 j' a/ i if(status!= ITK_ok) report_error_stack();) C2 S ?3 I& ~8 @' X$ C
else printf("Unlocked; ");
- \9 D2 g% _- D; V7 k7 a1 }! F
3 m$ U& O( N; t& P status = FL_user_update_newstuff_folder(new_folder);# `. I2 R: ]* p: v5 d' Q( s8 x9 W
if(status!= ITK_ok) report_error_stack();3 t; T! @/ ~) O, O1 s" F
else printf("Put in Newstuff Folder.\n");
) Y/ r' ^7 _8 @3 n t9 V4 j k4 l% r" M( H" ]. j: l _
ITK_exit_module(TRUE);
, K$ K; r* {! }- D return status;- d7 v0 g" _# B8 e( A
}
# U' P! l7 V4 N: y1 | |
|