|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% C) K; Y5 k9 h M- _( n3 [; r7 H1 W) u1 G5 v0 D7 X" i5 E
Teamcenter ITK二次开发源码分享:创建自定义文件夹# u% S. u& M$ Q k/ O7 P$ L
输入的第一个参数是文件夹名称,第二个是文件夹描述。
, {- |- D) }! Y; l' ~5 X$ X6 H2 g3 D, b9 a- v' g3 Y$ |) {
4 R1 x$ }; u% @: J( m#include <TC/tc.h>
0 Z" u& d* j$ [+ L' q#include <tccore/aom.h>7 k Q7 m. a9 C+ X0 V3 f
#include <tc/folder.h>9 [8 M5 I7 _* j2 r/ X
#include <tccore/workspaceobject.h>
0 k7 }0 T; K) c1 E e
, \/ ~" I6 v& n' ~8 ~" W8 X0 d#define EXIT_FAILURE 1& Y( u C: _* f1 J/ o
" Y6 u. o5 S) S; x1 Sstatic void report_error_stack( void )
" x; @- D& I0 k4 L( o {% z1 A8 I U6 b2 P( x1 t4 o+ b
int/ ]* H9 v! i. y. t; C7 r; n2 G
n_errors = 0,
$ w" ]7 d2 O/ b( L' H5 {+ f i = 0;, z' q, m5 o1 g2 ] |: W
const int' s7 R" M) [; [/ s: o. t) L
*severities = NULL,& L9 O( I, A8 x$ ^1 j$ j
*statuses = NULL;% ~3 b6 C' R7 W$ j. w5 P
const char
. m" R$ ^ O. r3 a [ **messages;+ p$ z3 ~# M4 f4 n! h4 a
1 I& N$ V+ x1 M$ j7 A; J EMH_ask_errors( &n_errors, &severities, &statuses, &messages );4 S+ Z& x( R; ^9 h4 u* w6 S( T
printf( "Error(s): \n");
+ c0 ^: E; A' Q( ^- h* h for (i = 0; i < n_errors; i++)
% {+ V1 Z) \5 @/ O {
4 o: R% n1 P' _! J+ l- O printf( " %6d: %s\n", statuses, messages );+ |2 ?9 x7 h" W; x, |& e
}
7 X3 E4 m3 P. V, b exit(EXIT_FAILURE);
7 g* l' _: v# t; K: u% Q$ w }& M) H+ ]8 t2 M9 Y# ~( y
3 \! a0 d: E# m' G4 T) T. g: k; y
int ITK_user_main(int argc, char* argv[])( M2 ~1 F, ^5 Y/ H- B
{" j, |1 `1 x2 p% g2 s
int D+ q7 y1 H3 s7 m! n& L3 G
status;
J6 A ]' y9 S. T" o# N. ` char; d! k" K5 O |8 K. t8 K
folder_name[WSO_name_size_c+1],; N& [% \; o. S
fldr_desc[WSO_desc_size_c + 1],
r- K" T6 M- Q% C" T6 G) A *message;
% b, s O( M, y3 X& K7 i ? tag_t7 U6 R- D6 l0 D* y. V5 g
new_folder;5 Q% t/ e# ~; \3 B- N
1 j& O$ _; \" I* V' w( s ITK_initialize_text_services( 0 );
C/ i7 G8 o) O3 a" D. y status = ITK_auto_login();/ w+ T: d5 G# o$ J2 d# H# K' x
if(status!= ITK_ok)8 G4 C' m- z/ e* p
{
* A, L/ S8 a" a5 s report_error_stack();8 l$ ]+ x! i. S0 L. W* L ^
}
# S: T. D# I( c: T% y! \2 @ T else
7 _; d4 V; |9 d3 Q! r {+ }" M; X E! k! {
printf("iMAN login successful.\n");; K: g. V9 P8 u
}
0 x- n3 I. Z& n+ d, p, q2 ?# S( I. e2 d/ C, e6 ^
ITK_set_journalling(TRUE);$ Y- B! }# }- b/ n: Q
4 ] w0 ?5 x# _: w; H Y
if (argc > 1) strcpy(folder_name, argv[1]);
1 @- q0 {0 {- P Y else
* U. m7 ^! \- n* L6 F {
. t$ E% [6 j: e; m& m' R. U2 u printf(" Specify the Input in Following format : \n");% }% \# V' u' |. E$ t9 k4 f/ |
printf("program_name folder_name folder_description\n");
- Y' r2 ], D" M printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");! O+ v/ g g) j }7 A8 A
return ITK_ok; * l: i8 c- V8 K7 }
}
/ |* t# B$ \4 G+ C: W
* F* j3 A3 ~8 k" h' X if (argc > 2) strcpy( fldr_desc, argv[2]);+ }1 L5 ~7 f4 K2 N1 z( }
else strcpy( fldr_desc,"");
4 f- H7 X- T6 j& t9 G# y6 T+ L+ Y% F- B$ s# B# H4 _. ?* l
status = FL_create( folder_name, fldr_desc, &new_folder);9 H- ^. a: } w/ @' @+ t
if(status!= ITK_ok) report_error_stack(); & `% g3 s3 F. V- y. T
1 J, i! ?) t' {! e0 o3 ]* L status = AOM_save(new_folder);
) L" z: _, G' t: t6 U* [/ H A3 c if(status!= ITK_ok) report_error_stack();
3 ]' J, \, f) g4 ]9 k7 t else printf("Folder '%s' Saved; ", folder_name);. K7 P" Q8 @% H5 ^3 U6 r& P
) @/ Y x0 {7 G6 l" @1 V status = AOM_unlock(new_folder);" A4 S- t/ C8 @9 t% f! c/ u
if(status!= ITK_ok) report_error_stack();
" L9 }) H: d, ?5 G2 z else printf("Unlocked; ");' V% I5 M8 y$ _7 m W! j
) c: u# E; L! D8 G+ L- p7 w. E status = FL_user_update_newstuff_folder(new_folder);# y: @" X6 t1 \7 [ p5 {) x
if(status!= ITK_ok) report_error_stack();; D" Q/ i# i+ m- P0 {
else printf("Put in Newstuff Folder.\n");" s' N/ v4 @. x
( x% V2 ], m! x4 J ITK_exit_module(TRUE);! a& i. g. I$ u' M* E/ S' W
return status;7 T4 K9 e% b; ]- U+ g8 x
}% C3 |! G% t0 E. l% {8 T/ G0 F
|
|