|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ P2 Y4 [( I4 C0 n$ [
4 C* X$ |2 s$ @Teamcenter ITK二次开发源码分享:创建自定义文件夹0 H. ?$ k+ Q) h4 t# g
输入的第一个参数是文件夹名称,第二个是文件夹描述。
! g- [4 |; Q2 s. u8 a
+ s- k. D8 U! e. {' K8 \ }# N. p# b) i
#include <TC/tc.h>0 ~! R& d8 V" f5 F
#include <tccore/aom.h>5 ]8 m5 r5 _1 K# U4 u
#include <tc/folder.h>
+ b @* q/ P( w2 d! @+ o" Z#include <tccore/workspaceobject.h>
$ E$ d6 U9 \: n3 A3 t; c* } e+ H/ N9 f6 m# H1 t" i3 ?" G
#define EXIT_FAILURE 1
. e" I" l( U+ M, C+ R. ]0 U( J8 d/ r' T0 B3 I( M. P( O
static void report_error_stack( void )1 F0 I' G' o$ @2 T
{
& ~5 v2 G6 J Q. X int
( l5 e- v4 [# E# k& c* L n_errors = 0,
- _3 l' m7 |6 {1 B& s+ c i = 0;
) [2 v0 n7 g+ w$ Y+ L& {( P const int/ I! G0 G+ H. s, }# l9 O/ [
*severities = NULL,/ a8 H% O# @/ N3 b
*statuses = NULL;
1 ]" [! a( w1 j const char% Y& {" e7 ~5 Y( M/ ~" d
**messages;
" \3 u% }: F8 o% E4 X/ G8 U; Y
- n+ l. t- [9 }9 N0 p( s4 R EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
, X/ |# I1 J1 Y! ~& ^' ^' z! v& v printf( "Error(s): \n");, ]) L* t& l8 U# x' _+ \; B- \
for (i = 0; i < n_errors; i++)
) o+ e. P0 y; _ P2 G, v% O) h/ S {
R9 b" J: l2 S/ L# t- X printf( " %6d: %s\n", statuses, messages );
; F1 d6 G: n" } }: ~) H3 H7 A" ^7 v
exit(EXIT_FAILURE);
& k. p+ a# c( D3 N }6 l$ T* b' ^# Z& N7 k, Q3 G
1 u& ]3 Y( h2 c r7 _% k) A
int ITK_user_main(int argc, char* argv[])
& g- Y1 V6 y# E5 H- U( s$ R9 p9 M{( R0 b) P* D1 \4 b5 F
int) T+ s3 k7 K# @
status;
6 S* h4 n1 v, ~! S& O' i, D; f char
" t0 L1 k. P$ x( f folder_name[WSO_name_size_c+1],
! ^0 ]( {: P1 \; [9 |$ y fldr_desc[WSO_desc_size_c + 1],
7 w5 H- f4 `) M" l *message;
& Q x: X: m& r! p tag_t% r7 z$ J' G1 i
new_folder;
~- b- u2 ^2 ~: |1 }
( i& }2 S+ {! Y) a ITK_initialize_text_services( 0 );+ q7 K' U/ ~2 T3 f8 M. B
status = ITK_auto_login();3 n' Y8 y6 k; |. C% k% c
if(status!= ITK_ok)8 A1 \/ d& k4 k3 e* i
{
. y5 w" x, J8 J report_error_stack();/ y T( X: p. l/ Y! C! h. s3 j
}, b# H V9 f+ w! h# ~/ b
else' a8 R% c7 }& m2 Z
{
& s# _2 U, g" N2 o K0 r printf("iMAN login successful.\n");
$ P2 a/ g7 O r$ @" Y! n0 [( z }
$ {' p1 a: |9 {; P5 c2 P3 z8 L7 U
" h: a( i# [1 a4 b* J6 l; d& @ ITK_set_journalling(TRUE);! S9 z* |4 o" G! X; U: R
! x3 d& N% H6 u" ?. v$ z& k/ r' m+ r if (argc > 1) strcpy(folder_name, argv[1]);9 ?; Y2 A; x- z$ p6 f
else
2 _+ P* Q5 ^# u+ j R ~0 _ {
3 K+ R$ T/ B- C5 I' Q printf(" Specify the Input in Following format : \n");
3 N- {6 k# ^6 \2 P printf("program_name folder_name folder_description\n");' Y. M% m/ C$ q6 I2 g) |% ~
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
; g, S' |; o. a2 O, Q4 w' D1 F return ITK_ok; - E3 N% ~1 X7 I; M p+ V. Z) W
}
0 u7 s; i- G# [ E6 S, w* B6 S @: A$ E: n* L. A
if (argc > 2) strcpy( fldr_desc, argv[2]);" |' o3 }: N# h4 t2 `; s5 [
else strcpy( fldr_desc,"");
- B/ L6 {2 i1 C }* P9 Q
, H2 D$ n8 [8 ]8 ?4 w status = FL_create( folder_name, fldr_desc, &new_folder);
$ W: h$ k. L$ l/ E1 X& J+ N9 q if(status!= ITK_ok) report_error_stack(); 2 w9 I2 M9 F5 ~1 u" V! K
" P8 ?: O5 t. E. C" c* F j status = AOM_save(new_folder);4 p( n( f ~" i e5 M) |
if(status!= ITK_ok) report_error_stack();8 z& Q0 ^# i/ P; @% m" c% D2 A
else printf("Folder '%s' Saved; ", folder_name);
( O9 l$ A' c4 B* k
( N2 o% b; `0 _3 r% i5 I status = AOM_unlock(new_folder);
: J/ H+ V0 {4 R if(status!= ITK_ok) report_error_stack();
- A' }( J% g9 _ else printf("Unlocked; ");
) l/ `" {; v, N% {$ }3 {+ m0 @( t% s# d8 `
status = FL_user_update_newstuff_folder(new_folder);
8 l5 O: [. a, j* r8 p if(status!= ITK_ok) report_error_stack();
. T* i5 {9 [) ^8 Z1 n/ v8 P9 T, ] else printf("Put in Newstuff Folder.\n");
; k) _& C" E7 E! p
5 P, h$ R# f/ M$ m ITK_exit_module(TRUE);* x/ m, D, ]; X+ B! ~: `9 ?
return status;
. o, \% x$ o* c. [}
9 O0 d0 P k m) k2 B |
|