|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# d& s% ]. I& _* `9 K0 q p. [3 l+ }7 p) q# `
Teamcenter ITK二次开发源码分享:创建自定义文件夹5 b4 c( U! m( Z
输入的第一个参数是文件夹名称,第二个是文件夹描述。
/ W0 g# G; }5 E
7 }5 i: o0 O* e8 e6 X, M4 l' W. |* J* P6 @1 i
#include <TC/tc.h>
9 G- K2 ~% h# d) P" U. n5 I4 d#include <tccore/aom.h>
6 e5 c. g# b7 K* O#include <tc/folder.h>
5 A- F+ R) O, R* P3 P- C. e#include <tccore/workspaceobject.h>9 R9 n1 J) v) V
+ l s6 W( Y% F3 Q/ L7 \9 A% b- q#define EXIT_FAILURE 1
- j2 s' K6 U) b' q% ?6 j
; g) N/ B) y1 W% V: X1 u- x& Tstatic void report_error_stack( void )) U# u- R. Z ^$ R( Q4 I# R
{
' k9 ~( w5 s1 J" I int3 q0 q6 N0 p! w! g" i( @" |' |
n_errors = 0,+ X, [5 l3 R* e! _1 ]( r
i = 0;+ U$ z- u) x7 r4 z5 k
const int4 N$ Q# `% |3 K- v
*severities = NULL,
& O/ C$ z# R1 ?3 s3 S, P *statuses = NULL;5 T' M" o/ t+ y1 D
const char
% P- {0 q$ N' k: {4 C R **messages;
' b- ^& }. w! S4 M5 n# Q" Y
% z# L) _8 N3 E- i, ^' V EMH_ask_errors( &n_errors, &severities, &statuses, &messages );+ Q& ~1 s0 t+ J1 x' ]( E
printf( "Error(s): \n");8 Q+ I a% M' g: S8 b
for (i = 0; i < n_errors; i++) , c3 a( ]. O7 p/ i# z
{
0 x; ~7 }9 Y/ n; \0 Q+ Q' q0 e1 t/ Z printf( " %6d: %s\n", statuses, messages );
& L( t3 [" Z6 _" m4 C }
9 I9 `3 k" j) e/ K% z8 n exit(EXIT_FAILURE);
; w7 X7 @/ O. X. K }$ o8 a7 `' n+ M1 F4 \" d! I
% X$ q/ |9 X! E* ]) hint ITK_user_main(int argc, char* argv[]): s: H: d! d$ l/ ~* d3 @
{
+ H" l. r8 Z: c; o0 c int* V# c" S& i5 P6 ^
status;
; n$ E4 y" t8 u5 g0 E$ F, K char
& j" p# [. Q+ B8 M2 g; u7 u* g! F folder_name[WSO_name_size_c+1],! C# I/ `! ]3 m
fldr_desc[WSO_desc_size_c + 1],* a8 v% r1 F O
*message;- J- K% O5 _5 {+ y, {
tag_t
, p- k6 u7 g' Z, j% X new_folder;: H/ M% q( G9 n6 Y! [: T8 b
, [7 f5 `) i0 c) n. t. J8 F3 B ITK_initialize_text_services( 0 );) a! z/ Q9 l0 K! z3 F* W
status = ITK_auto_login();
) g2 r7 i1 z- R- d" |# B if(status!= ITK_ok); G4 r8 o) f9 ~# q
{, Q Q$ ]2 C' E
report_error_stack();8 N, `# P. Y3 s& D
}% j' h, {) Q( [: Q# r; ^
else4 p/ J2 e# ^9 W
{
, z& l+ F4 J0 l$ l printf("iMAN login successful.\n");5 k% L$ \6 U$ L$ m6 E2 [
}7 S: f" X( m8 D, ]
" L' Q1 e0 j" {6 D0 `
ITK_set_journalling(TRUE);
?- l, [( ~- p- _
. y- I1 J9 T/ ~) E if (argc > 1) strcpy(folder_name, argv[1]);
+ |/ a) H/ s" W m8 i else. u9 a1 [# C5 _3 U0 _" u
{
7 d$ m0 H4 G9 s& [% U3 ?4 g* A printf(" Specify the Input in Following format : \n");
! Z+ [9 X z# s3 t# ^ printf("program_name folder_name folder_description\n");
9 V' [& t3 ~7 Z/ D printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");; A# ?4 _# |9 g1 @3 }
return ITK_ok;
. c5 O* m8 k. L } 6 Z, b [) I; t0 `& _ W
* t% ~1 f: I# F# d" G: E( A/ f( C
if (argc > 2) strcpy( fldr_desc, argv[2]);+ R/ N O- d C, u) p0 j9 _
else strcpy( fldr_desc,"");" O# N+ u# q8 H, E7 v0 U
/ W" X! o4 S7 Q( ~ status = FL_create( folder_name, fldr_desc, &new_folder);
, L. w R2 M3 g4 [" n1 _ if(status!= ITK_ok) report_error_stack();
# j- y+ e2 a; p6 T6 L0 I6 i; c( p6 J5 Q
status = AOM_save(new_folder);
) u1 E4 ^0 Q/ m2 y if(status!= ITK_ok) report_error_stack();
8 y' w# \5 f8 y* Z( { else printf("Folder '%s' Saved; ", folder_name);3 \/ q+ @( J; F( ?
( ]. s. j0 q% I+ B% ~
status = AOM_unlock(new_folder);
; J7 ? J; _( O, p$ n% Y/ ]1 n if(status!= ITK_ok) report_error_stack();
* i ~7 v$ w2 B/ f: N# {) b else printf("Unlocked; ");
8 c& ?+ k, W9 q( o/ W
: o& U5 S! r2 k/ r& \0 f; Z status = FL_user_update_newstuff_folder(new_folder);: ~1 d8 s/ J4 u* q% p
if(status!= ITK_ok) report_error_stack();3 o" a! d# g) F
else printf("Put in Newstuff Folder.\n");
8 J. i2 F6 }3 Z6 n' M( ?6 O
: V$ W2 b/ c; o& A' V+ j' W) p ITK_exit_module(TRUE);
% K' N+ l5 V/ ^7 Y return status;
! n+ w+ h* ?3 H} F$ F* V/ W; \; x1 n6 Q
|
|