|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. B+ L7 \3 V8 b- {% ?! o
R2 w) |6 W7 V; ?- P* G: P) `Teamcenter ITK二次开发源码分享:创建自定义文件夹 r6 c$ {# P/ Y) N2 e2 q) `6 n
输入的第一个参数是文件夹名称,第二个是文件夹描述。& {: m3 E1 D J/ P
1 K( v7 t5 N. }+ n$ {, Z0 g" N# \
5 W ]0 E: W$ h, w
#include <TC/tc.h>4 V- y) T; I$ ] @& L
#include <tccore/aom.h>9 _, c. y6 g( V. ?
#include <tc/folder.h>
' J) ]2 B# g$ Z9 @#include <tccore/workspaceobject.h>
0 H- U, j* K* q9 f0 i; Y& V% P! A! @) X3 b7 V" f# J' p# k. |
#define EXIT_FAILURE 1/ K4 h K6 I, x$ N- Q+ Y
( b- S1 i/ o4 d9 y
static void report_error_stack( void )5 w# U. ]2 W* v, F) s9 B
{
7 `. \9 {4 s: f* i int7 _, ^! f7 _6 j/ c6 q
n_errors = 0,
; P& o) u! `$ C- C' z& \4 j: u i = 0;5 K* u- n, Y. w* S1 H
const int' b) @9 Z7 g) W! V& i: g1 |+ m
*severities = NULL, A! |3 a) y) ] R7 u
*statuses = NULL;
1 V4 W3 @7 [4 B; W) D const char3 p3 K% s/ S9 |; \) x3 c
**messages;: n% ?" w7 d5 L7 U
2 \- U2 e) @. x# W
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
% I% ?0 s1 A9 i; ]& q printf( "Error(s): \n");1 h& t: i& E, `- M8 p1 J
for (i = 0; i < n_errors; i++)
$ r( J" N- U; p j* w; K {. {& l3 Y+ p2 t6 P
printf( " %6d: %s\n", statuses, messages );
% O' B' X4 l) h h+ |& V }8 j# @( }) D& S9 T
exit(EXIT_FAILURE);
( D, g6 m. X- _3 S }
4 g6 G+ }$ j/ f) q( P# \) \
1 P6 W* q% B; A0 J# \- sint ITK_user_main(int argc, char* argv[])$ B8 p7 V6 {4 v3 W* g
{
, |6 H8 z6 X6 `6 f& F: \9 B" | int
0 A5 T" M" a' D status;
O/ f, _2 y }: ]8 z. h) n char
& N1 S( r( [8 p: n& f folder_name[WSO_name_size_c+1],5 c% q- V6 h2 W2 x0 S2 v
fldr_desc[WSO_desc_size_c + 1],+ ^. Q$ D% G+ ], T3 T8 W
*message;
9 Y4 Z# u. ?3 G r, n tag_t
3 i. D: \6 n) t& A7 p new_folder;8 D+ ~$ |5 J. ]6 u
/ G" g2 c5 V( ]* X* h! R
ITK_initialize_text_services( 0 );$ o* D) }/ k8 `3 o ~/ ]9 n
status = ITK_auto_login();
. B9 o, v: J* G if(status!= ITK_ok), G U6 a: ]- C1 z* m
{. I7 [: [. N y5 D h
report_error_stack();
1 N7 B( {) n& _3 [/ p }, \+ F& f5 @- R6 H9 \- u0 p
else
0 n' Q! w: W* B2 V3 h1 D2 c8 B( O. ` {4 p j& K! o5 z+ S+ |) z
printf("iMAN login successful.\n");: `& Y s; a; o
} t, N2 h+ e7 ?' ?: d1 q
1 _- m @9 m1 [- Z0 R% e4 m0 C ITK_set_journalling(TRUE);0 }; o$ J# C+ L! y
0 ]; U3 G R2 N/ W& N$ u$ w6 O- f if (argc > 1) strcpy(folder_name, argv[1]);
0 F I; d4 w& S' |+ G else7 S" w9 d7 k: p' R2 U* I+ [ U
{
6 R* X& Y; s- }4 G0 r% y7 H printf(" Specify the Input in Following format : \n");
4 h6 c* g& u/ y( r% M! a, ] printf("program_name folder_name folder_description\n");
! o8 e, b7 M/ @! F/ C( B& g printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");! j0 n ^4 x5 M* l* o7 {0 _
return ITK_ok;
! y" b5 w8 u5 n/ M# @. [- H } 0 n! a& V! \ n& t
3 b4 o! w+ L8 p) O
if (argc > 2) strcpy( fldr_desc, argv[2]);& @( m5 X6 m! B1 O t: B" V7 [
else strcpy( fldr_desc,"");
9 u5 j, R" ^2 E) L+ k. c4 l# D1 a. w8 ?+ q$ X1 ^
status = FL_create( folder_name, fldr_desc, &new_folder);' ^0 x d# q: p! p2 f8 s2 m+ `
if(status!= ITK_ok) report_error_stack();
D* b" x% B9 u8 ^0 {9 F3 l3 s- I6 _* }8 U7 ?8 M" e% z: p
status = AOM_save(new_folder);1 j0 P; P- k; k3 I6 `6 P3 k
if(status!= ITK_ok) report_error_stack();
0 E) ?$ t9 V* x8 W6 Y. D9 }. q6 a2 M* i else printf("Folder '%s' Saved; ", folder_name);: Y# r e T: z4 Y
/ t& Q# q1 R2 D. B2 ~5 q$ h status = AOM_unlock(new_folder);" ^* T* w+ R( z) {$ e/ ~# ?
if(status!= ITK_ok) report_error_stack();
7 r! Y9 u# |' t) x else printf("Unlocked; ");2 p! y+ L/ V4 j9 u0 I
7 b7 c2 k; U& _2 H: X. r
status = FL_user_update_newstuff_folder(new_folder);: \. [7 Q1 p1 Z$ Q$ W
if(status!= ITK_ok) report_error_stack();
+ x9 ~- K6 M- d; B; x else printf("Put in Newstuff Folder.\n");- D" C7 `/ ~+ d1 |) N2 |: S; M
) z2 j! {0 E5 E |+ M ITK_exit_module(TRUE);1 `3 B& L* G2 e# o4 \, Q
return status;4 j" Q0 u$ b% ^* [6 `+ F
}
' j0 u+ Q7 L' V" c' o |
|