|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 N. {" S6 n7 `4 C$ V' F+ _5 u: f1 v# |+ T1 w/ f6 l
Teamcenter ITK二次开发源码分享:创建自定义文件夹
7 o( J7 v) f5 i输入的第一个参数是文件夹名称,第二个是文件夹描述。
1 k J' \1 v. z- a0 D4 E
0 ~* h1 h4 E# o* O; ]5 W
0 ?. F% T3 X R$ |; z- ^# o#include <TC/tc.h>
2 P: p, E2 V" n5 o5 r" s; c#include <tccore/aom.h>4 p( g: T* Y |* Z i! F
#include <tc/folder.h>
% y5 O! L1 G- W( M#include <tccore/workspaceobject.h>" p8 G9 V) i5 T3 ]8 R8 }
, ]* A' y6 T9 B/ O) P
#define EXIT_FAILURE 1, a" ~% }& K: @6 z1 l$ [& h
+ v; n8 c+ y1 t8 l. {static void report_error_stack( void )
$ w* r6 T; {5 X+ \; R: _! M) L- y7 R. C {
% }8 A3 o& [$ h7 q: u H int
1 t) @ l2 s* ~ n_errors = 0,
+ R% e! ~7 h2 d% \; G' e4 j& U0 |/ B i = 0;
0 O/ B3 z" Q; g! N9 w const int
9 s) P! U! G- l; _% F. S4 r) Y *severities = NULL,: @# t' p$ f; H5 x) W
*statuses = NULL;- w& R2 g6 t$ E+ k* d
const char
1 z5 x- w8 }( Z9 t' Z0 A6 n* L0 V0 r **messages;
& k$ z( W( F* ]( d p1 P1 J, M- N$ N/ s1 @; {
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );! N. e& p$ p6 h* A
printf( "Error(s): \n");, q" [/ n* d4 m1 s/ |4 u/ q
for (i = 0; i < n_errors; i++) 9 O, J4 _6 `* V( m/ r8 o
{
) S. q/ V6 C% d- n { printf( " %6d: %s\n", statuses, messages );
K3 s$ \5 d5 W0 x+ N }: B/ b# @3 o- x. s! V; m
exit(EXIT_FAILURE);7 j( N; q# T' j% n+ d- |3 N. p/ v
}
1 P8 R8 P8 |" i' j5 c2 s [( l% c# S, _
int ITK_user_main(int argc, char* argv[])+ p4 t" h& `& s: u( r9 r
{+ O! e- r0 Y! r4 q
int
; O( ^( T/ h% Q' m! ?+ E- ] status;( v$ e- G3 V* y- a
char
* p# `% v- d# z( [0 R6 M* o T folder_name[WSO_name_size_c+1],
- i0 J2 @1 T( b1 W( Q) x" A fldr_desc[WSO_desc_size_c + 1],
+ x& K1 A, O' I: o! d *message;
0 Y" ^, @8 C0 X& a) t tag_t r3 T, u5 d( K) E7 v9 Q
new_folder;! `1 x3 Z* s8 L; a
& t; Z3 ^8 v* W
ITK_initialize_text_services( 0 );" j' h% e$ x( u7 b! R/ w/ x
status = ITK_auto_login();, k- \" |" Y' q. ~8 I% K7 g1 B
if(status!= ITK_ok)
: i. }1 t& e; e, F& I @ {
6 B+ }+ G) K: _: C; Y report_error_stack();
) `% h: D# s4 g1 K' j }
0 x( {& Y6 s& u7 L2 E W else
+ l/ k% b# q0 g3 ~ {
! Z) l$ y0 d [8 b! q' v$ o2 F) ]( V printf("iMAN login successful.\n");4 W" K, v4 S" K$ e" v
}
, h' ] y2 Y. Y# |, t
( }; E" I# {$ T2 `. q* k) r: I ITK_set_journalling(TRUE);
; U" F$ o; a( Q$ G5 D: ?6 a# \5 h. s7 B' [
if (argc > 1) strcpy(folder_name, argv[1]);
, f) A& e+ E; q( S/ O/ f0 ? A7 M else
! E" K' [- p& _2 N {$ o- ^3 j8 F% v! z5 S4 V P4 q
printf(" Specify the Input in Following format : \n");0 i' G- S& Q9 d; Y
printf("program_name folder_name folder_description\n");
$ R3 H) H \* F5 {& S( b/ k; {8 w6 [8 p printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
- d' F; R% L8 T* w return ITK_ok; 8 J( G/ ?4 S- u8 b- U
}
9 K' c1 C+ V( ~8 a, |
. W( e0 L" B$ U if (argc > 2) strcpy( fldr_desc, argv[2]);5 C; F) p6 h% o/ |& Q G$ I
else strcpy( fldr_desc,"");
+ m" R+ X+ ~5 u* u0 K. R7 f2 w
9 b4 M9 S6 g. J1 l# M, Z$ Z: S status = FL_create( folder_name, fldr_desc, &new_folder);
+ w$ R: k& S! Y7 z7 x if(status!= ITK_ok) report_error_stack(); 9 z$ y& O& {- ~% e3 p% s
" Q5 ]! s3 O; q& a3 e. N status = AOM_save(new_folder);
0 k2 c3 T- r) S+ ^ if(status!= ITK_ok) report_error_stack();
6 H. v; d, \* q0 P4 } else printf("Folder '%s' Saved; ", folder_name);
d" x) s. C; s7 S3 [. l
) z; O s" \8 A, m1 J status = AOM_unlock(new_folder);
+ y# T1 H+ m# v, j if(status!= ITK_ok) report_error_stack();
; M g+ t) i; r# S+ `- v2 K; n) n else printf("Unlocked; ");' F3 ^0 v% F3 D3 Z* @
' n2 b. m% J9 _' K9 J) v status = FL_user_update_newstuff_folder(new_folder);5 q9 U6 [# [7 G/ f" J; ? ]
if(status!= ITK_ok) report_error_stack();* m% R' ]1 N+ ^4 k2 a$ J
else printf("Put in Newstuff Folder.\n");
2 w. r% E% P; B) E9 x4 w {5 i, f3 d' o1 N+ \
ITK_exit_module(TRUE);
2 C- Y+ t9 q/ o# e return status;# R1 N* L! z5 i* |$ Q
}( P- a/ ]- C+ |& W, C f& |
|
|