|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: x* B( B: q7 T" T @7 n8 K' k$ u) Q8 p# \
Teamcenter ITK二次开发源码分享:创建自定义文件夹
e9 J( r/ o% v: }输入的第一个参数是文件夹名称,第二个是文件夹描述。1 c, l; X0 B2 X8 E. ?# a, g
% k' d Z' B0 d: {
- Q9 S3 |1 d( {0 q) [1 C% w
#include <TC/tc.h># ^6 V( o3 C! T6 u) u: L6 T
#include <tccore/aom.h>
$ R0 _. {* e8 h+ F#include <tc/folder.h>" W- n$ \( M$ s/ \( Q/ ?
#include <tccore/workspaceobject.h>" Z* q7 s3 Q0 W0 |: D; Y' h. s
0 I9 \( ?# R" {#define EXIT_FAILURE 1, Z" i- K" ~' A- q1 Q+ O: u( F
7 M7 |. [/ Z5 m0 U, a7 _; vstatic void report_error_stack( void )
; S. d- _) T5 H9 ^, s {" l _8 Y( d" b- {
int
! h& i9 s3 \4 ]$ f/ P n_errors = 0,
: i5 y9 C* l, Y0 t; [9 I$ t i = 0;
: ]1 ~ e5 C+ h, r const int/ T5 `% S& |0 x& i
*severities = NULL,+ {7 a: W1 ~. o
*statuses = NULL;
7 V" V m W' Y+ | const char
Y- Q' t# \( X6 m: c4 @: U5 I, R **messages;" N+ l! v0 f9 v+ Y0 O4 P
7 f# }* Y' |, i# M2 {7 C EMH_ask_errors( &n_errors, &severities, &statuses, &messages );! h- ]0 \" w! }4 c! a$ q3 [1 [* {
printf( "Error(s): \n");
6 _- O I: B2 o. d' S for (i = 0; i < n_errors; i++) # v+ Z6 |6 W. D- G2 ?
{. l' Z0 d; D; T- z9 o
printf( " %6d: %s\n", statuses, messages );
* s: E. Y% O& C2 V }
: h; \. \* g, k# H6 x2 I* P! l) s! _ exit(EXIT_FAILURE);# {1 `7 V" s0 U* {0 e, ?
}
' V# P. M# d: E
4 n% c2 n7 o& x6 c& Hint ITK_user_main(int argc, char* argv[])& i/ x4 m- d) @# r: {: P
{7 c. U- g7 Z7 O- \
int
# p% Q1 |! v+ k- Q# ?, W status;
. l2 u2 w6 \6 M% f6 O8 P char2 _+ M2 ?3 g9 h' x/ y$ P
folder_name[WSO_name_size_c+1],3 _) n, T q% L' d; a1 O) a
fldr_desc[WSO_desc_size_c + 1],
; e. \9 H C3 }: b3 G' }+ ~ *message;3 w/ r# p- y& t# ?9 s r8 y9 w
tag_t, V0 M1 x, _8 v0 ~) q' Q
new_folder;6 {; s* K2 G# `5 V8 r: N( L8 L0 e; s
6 B s; @" i9 G0 p
ITK_initialize_text_services( 0 );
; `, }$ E" R) b, _2 U status = ITK_auto_login();6 P9 W9 q, b* T) U% w0 N. U. Z
if(status!= ITK_ok)8 u2 D$ X; k% L; F& O
{
# g. `4 P3 G2 G2 U: Y3 ]3 ~) ` report_error_stack();
0 z* U/ s' i+ h0 q0 Q! z% c% g }7 x2 Q/ W& f. s7 ^
else; u1 P; V) g$ B3 U4 m. X
{
4 m$ O% T3 s* T, c, R5 U printf("iMAN login successful.\n");
+ v1 T0 J. Q9 b% E5 z }
; Y4 J3 Q4 D* m! n% |# |0 |- @5 K) `$ N/ Y& {
ITK_set_journalling(TRUE);% i2 F" o5 E0 r& L% I
; k0 r; u/ s+ H' T3 U3 M v( N; f- ]1 y if (argc > 1) strcpy(folder_name, argv[1]);
9 e5 J% j4 \1 M; ~( w5 Z e else+ C% W& H6 Y% K9 z! ~
{
3 s4 n1 M& O& V, n printf(" Specify the Input in Following format : \n");: ~8 ~1 J" ?) l/ p3 \+ k
printf("program_name folder_name folder_description\n");
( k6 F1 b0 [6 l/ U. N) S printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
5 p. y, h$ L/ q. K% A, Z" @ return ITK_ok; ) C) ^$ E1 B6 j! @
} 6 m( P) ?- Q4 m7 U" q9 p/ B/ h
3 c- d2 u2 O/ M; {( U if (argc > 2) strcpy( fldr_desc, argv[2]);
7 A% F j7 A7 p. a: `, } else strcpy( fldr_desc,"");5 D! k4 w6 q- x: E: N6 J5 `# G
, h6 x2 q- ^5 c2 O" _/ [9 @% E
status = FL_create( folder_name, fldr_desc, &new_folder);/ ?8 x T- H& K l: ?) v; K+ _2 t
if(status!= ITK_ok) report_error_stack();
8 w9 k* J2 v$ L* _2 y3 J; A7 `% d' ^/ u- P8 y( X. {
status = AOM_save(new_folder);8 t( j; K7 Y/ ]' b" [
if(status!= ITK_ok) report_error_stack();
; u! R5 M3 Z+ ^5 L! L else printf("Folder '%s' Saved; ", folder_name);( g. C4 V( G) f5 g: D$ O& d7 l6 f8 |
K+ R8 ?3 K( L8 C3 d3 {7 D
status = AOM_unlock(new_folder);
8 |8 C! Y1 {* b8 x5 d M1 R if(status!= ITK_ok) report_error_stack();
. i- U# T l/ @. h; X* q1 v else printf("Unlocked; ");9 n: c( }& A+ r9 ^* J' C- {* ]
: ~9 ?7 o( \" ?3 \9 I6 @6 p status = FL_user_update_newstuff_folder(new_folder);, A4 Q0 z; o! a& R) j, n+ K7 r
if(status!= ITK_ok) report_error_stack();$ {, _& Q. Y0 t' A7 \- h( Q
else printf("Put in Newstuff Folder.\n");, @2 I/ x" p" V* e/ u% x& a
0 L: [# u; z) @/ M
ITK_exit_module(TRUE);- B( G3 R4 y% @2 w5 Y2 W# i
return status;
9 g& x# S9 w; Q6 ~' N7 q}
. W1 w3 p3 A: S, t/ G0 M1 b |
|