|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" |# Q& O: d0 S1 w7 {
1 w7 Q4 b7 y6 C' X, C/ z" B& H% KTeamcenter ITK二次开发源码分享:创建自定义文件夹
0 m8 X- W, U4 k/ F$ T" E5 P输入的第一个参数是文件夹名称,第二个是文件夹描述。
% e. o& M B, x( K8 Q
3 F! }6 }& O6 L8 U
l4 ?, x# `0 M! P% G. S+ ]#include <TC/tc.h>
/ {/ w# x( s0 q#include <tccore/aom.h>
7 J) H/ _3 U! H: \' `#include <tc/folder.h>* }5 E3 Y4 K: k# Q% {! Y) ?
#include <tccore/workspaceobject.h>
7 R. A- G3 x- Q$ s
6 n% L7 u$ _& f. h8 B/ e#define EXIT_FAILURE 1$ `+ J3 X6 x9 Y
' V% l; R- S( R% Q# j& Y" Vstatic void report_error_stack( void )1 K; ?# d# x. x& D+ r, ~: y* h
{4 {! ~# c/ }: y1 E4 {! ?0 v" A; g
int
) S! i4 `# n' S) k* n n_errors = 0, [2 T# v9 C% i: S
i = 0;
2 o" b8 t% i3 s7 _ const int. o) L3 @/ q0 ] I/ x! ]
*severities = NULL,
4 @* b7 S; ^1 E+ |* Y. _ *statuses = NULL;7 b/ w) Q- T8 Q3 r: o; J5 R
const char: t9 i! O0 W" n: d3 Q2 y
**messages;5 t4 H% J- p- E" a
* V6 @# r8 E& [8 I1 C9 m0 n1 n
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );' p4 f9 V0 i- p x. c
printf( "Error(s): \n");) G2 I4 Y4 t+ g' |- E: z& R
for (i = 0; i < n_errors; i++)
% ]" E% [1 L- ^2 v8 _6 l) [4 m+ N/ k# N {
& D; _0 u) ^# a, ~5 s* Q. \ printf( " %6d: %s\n", statuses, messages );
! V+ U" a4 C, _ }
& o) p, h+ q3 f, @1 n exit(EXIT_FAILURE);
- ~& C% N! _( C }& Q" h4 _# c- g% g: V6 b* ?4 E
5 Q3 X/ g9 v6 lint ITK_user_main(int argc, char* argv[]); h9 W+ n0 \- T4 ~( ?' F7 ?) \4 v$ j* R
{
/ D8 T' z7 P4 w" c int
5 ~0 W+ W- s& m' }: Z5 Z status;- X0 k; k* |' t) t0 C$ i! i8 v
char- Z L |, R# v! ]
folder_name[WSO_name_size_c+1]," w0 y" m7 t2 \1 e) C
fldr_desc[WSO_desc_size_c + 1],
4 I, E" o( r& u- }7 ]4 {% c *message;
& I% G$ K; U2 {4 Z. Z: b tag_t9 P4 m9 U3 f6 i) [) O7 k4 j @
new_folder;
' b( \3 h: O9 m& ]3 i) c* a9 t& U. m
ITK_initialize_text_services( 0 );
0 N. o2 [2 ~) j9 W/ q status = ITK_auto_login();4 i9 G" J# s8 L
if(status!= ITK_ok)9 h. ~3 V, E* T, x ~
{: _/ ~6 u4 k2 J, c- H2 \( i
report_error_stack();
- d. l& r7 E' S& t7 h }3 O( _# j! P5 K. y( v+ X$ [1 B
else2 P" a8 n, ?0 T8 b; J7 ~& f
{: w; R0 N( y& Y. y" u
printf("iMAN login successful.\n");
; Z, }) l8 k9 `6 A4 T/ u m, S @ }
# q! L7 W: V* I# J9 @7 {) j# C. `/ a3 n
ITK_set_journalling(TRUE);
: k+ i3 u. y4 `2 [% V" x4 _; K2 }4 J- \1 ]4 A x! E# ?
if (argc > 1) strcpy(folder_name, argv[1]);
K; {# d& e7 l& x8 r7 ^: G else, r- b0 n( [( Q: Q8 y' H8 {
{
: N. X Z$ H6 G" K7 O' } printf(" Specify the Input in Following format : \n");
6 ?$ @8 R9 W8 j. }" c printf("program_name folder_name folder_description\n");" `$ }. \5 P0 f6 `( y: n2 Y8 x
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
2 l+ F* L! W$ u; U% W return ITK_ok; & r; }, h# s, f" ^, t. }
}
1 F/ V$ Z4 ?" F) j C o3 C! i' j0 o9 B0 {
if (argc > 2) strcpy( fldr_desc, argv[2]);
5 P, H" ?5 n# t t else strcpy( fldr_desc,"");; B; a' e$ p0 X
# v1 J {6 x/ S. ^+ A status = FL_create( folder_name, fldr_desc, &new_folder);/ t4 _% j1 M* Y1 F
if(status!= ITK_ok) report_error_stack(); $ P- U7 C2 r! j1 ]* M3 z; m, A( ~: `
' l) p- z p" d$ z; a1 B% F status = AOM_save(new_folder);5 r# _( ] Z# E% c
if(status!= ITK_ok) report_error_stack();
- j" C! @( v& X: u; j: Q2 Q1 q else printf("Folder '%s' Saved; ", folder_name);1 C& K, p O/ u/ h: O
# U& j# A) s( ~4 P
status = AOM_unlock(new_folder);
4 b! u: x' f- `7 F- ]" L2 j4 Z" i7 }$ w if(status!= ITK_ok) report_error_stack();
$ r- o t8 P; z8 w8 D% o- _ else printf("Unlocked; ");- |/ a0 I' O8 ?
2 E: H, c, [" ?$ j3 N( q status = FL_user_update_newstuff_folder(new_folder);
+ Z0 p% q- h6 w) r if(status!= ITK_ok) report_error_stack();
) _2 X7 K R. K# R else printf("Put in Newstuff Folder.\n");
$ q! N7 L$ n1 H o1 ?5 E- W- B& ]
ITK_exit_module(TRUE);
) ^% k- ^; L; {: p. Y3 j return status;
+ O0 Z* V7 N1 ?7 O0 j8 ~}
% g8 v5 w1 n1 a( J4 e6 V: @' P% s |
|