|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 E! F8 H L- y0 T* Q* U+ G k5 }# p
* s. r# K; z- Q0 a
Teamcenter ITK二次开发源码分享:创建自定义文件夹' G* B" D- k. @
输入的第一个参数是文件夹名称,第二个是文件夹描述。9 a" z7 Q( N( u9 R
9 V- k8 t: f2 L5 N# N! x R
2 e" f5 l7 J3 w% T' i2 V#include <TC/tc.h>
3 {+ `- C0 G4 |. m f& w#include <tccore/aom.h>- Z5 W ]" |) C5 }2 _" n: V
#include <tc/folder.h>" F8 }. g* h; b, Y6 L1 Z
#include <tccore/workspaceobject.h>
7 X4 w h: X# d$ X/ |# j: g/ K+ G$ ~' g
#define EXIT_FAILURE 13 D& f V4 |& x! s+ q" \; Q
1 D4 ]8 R6 o" Tstatic void report_error_stack( void ), q0 e$ Z, r0 S$ _. N6 G6 i5 C! o- L
{+ O7 B$ N- }+ I, S N
int/ W' b! M5 T. i- F/ O1 v1 s
n_errors = 0,
: `# S/ |5 V$ E4 w! K4 U2 U i = 0;' ]" A% u! u, n0 u! C" l3 X5 P7 j
const int
2 a! J% c7 b- Z/ J8 M! z9 o *severities = NULL," n& |2 Y, X; d( w4 {2 A
*statuses = NULL;/ W, U( M% H K) j! u7 K* k$ P1 h1 h
const char
/ T! a- ~ L7 H **messages;
: e+ F) _* g' T# x. J
1 |, Q! y+ Q! q8 l$ V! ?9 Z0 U j) F EMH_ask_errors( &n_errors, &severities, &statuses, &messages );: A# s* R5 N% `4 D7 L( I
printf( "Error(s): \n");( ~3 Q* r% v( _9 d* {# b8 r
for (i = 0; i < n_errors; i++) / V: }# l" `. @
{
% C% P" {0 R5 F+ o/ C$ |: X printf( " %6d: %s\n", statuses, messages );
3 W. \' F" S) }) c9 P1 m; } }
! ` o4 s* E5 I; ~ D exit(EXIT_FAILURE);; Y6 H: e. [8 q" H: W
}
; @5 S1 H: o, f$ u+ O' {" ~0 Q$ l M* G+ P5 T
int ITK_user_main(int argc, char* argv[])
. T! Z3 [5 _8 Q! D{
" i/ W8 I7 G2 n; M& o3 I int
( p' K k! z; u2 I c status;
. A. {6 \8 A. H: L4 I! C1 E- f char
9 h" ]! b% f, V" U1 r$ E7 Q folder_name[WSO_name_size_c+1],) F; J' o. N; I3 @! B
fldr_desc[WSO_desc_size_c + 1],
$ m% u7 ~) }" Z" W+ J+ Y *message;
) k& n, e- `) P# W# R3 T: O/ y+ G8 _ tag_t& T# s% e2 N; k& y. \1 B
new_folder;4 D' w# J, U1 A' Y. e
. {- w- @2 j" a8 X( t
ITK_initialize_text_services( 0 );
" L. U% a' }3 s+ S status = ITK_auto_login();* T1 B0 l0 Z1 a) Y9 _/ a1 I8 ~
if(status!= ITK_ok)
% D* ~0 r# l! B- c {
: B# {, [5 o" Q report_error_stack();" f5 W) M H' F$ M5 O7 Y8 \
}5 x$ H C5 _" [/ H: O
else
- R0 m" W4 @/ _* [+ I) Z {
: h0 P; c$ J5 ^! h% r, v; X# F printf("iMAN login successful.\n");7 h% E6 N' g- o' ]+ I
}
6 y$ M; w) }- y( F, g8 q4 T5 w9 y
ITK_set_journalling(TRUE);5 w$ m- H( y# U3 |
" u0 C% h; D" R8 ^# z+ x: B1 G if (argc > 1) strcpy(folder_name, argv[1]);
' z9 w2 p z) j s2 S else! l4 |) Q ]; s* T, m( }
{
! q7 X7 R! f# J0 U ~6 M8 O printf(" Specify the Input in Following format : \n");
" S) M L+ f. X6 q$ U7 f S printf("program_name folder_name folder_description\n");2 k! i* e) m; q3 ?9 V
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");" `7 }1 M6 T: W8 ~6 s' A6 i
return ITK_ok;
7 {& U" q; R7 a: g }
& Z0 S% Q# G" Z* r! P
( N$ u$ h7 j; ]# H6 u6 u1 V if (argc > 2) strcpy( fldr_desc, argv[2]);! _2 H# C6 C9 F% Q8 P
else strcpy( fldr_desc,"");6 [! v8 |* F* X5 W- h
3 \; w% Y" B& a% X C
status = FL_create( folder_name, fldr_desc, &new_folder);/ i/ C0 N' H# v" c
if(status!= ITK_ok) report_error_stack();
Y; c/ n, h9 U0 |, z: I5 e2 h6 r6 ]4 z
status = AOM_save(new_folder);; _2 x- J$ O- W. r7 u
if(status!= ITK_ok) report_error_stack();, ^8 d+ s6 q5 N3 o- O: y
else printf("Folder '%s' Saved; ", folder_name);
6 L+ Z/ @- V4 R. R. w a" j+ |$ \0 D" C3 A* y
status = AOM_unlock(new_folder);+ ^3 q, Y! G: }' c" R/ l
if(status!= ITK_ok) report_error_stack();' \" s2 z. N, B8 s! x. [) v
else printf("Unlocked; ");
1 k* k4 I, r$ u- o- G, O% W' e2 W; Z/ s9 A1 X
status = FL_user_update_newstuff_folder(new_folder);
a# y. R* e* ]0 ?# X* N$ \; K5 _ if(status!= ITK_ok) report_error_stack();
1 M# A1 D6 c8 q( ~- k0 T. q$ W- R4 W' E else printf("Put in Newstuff Folder.\n");- A: {8 R4 Q8 V J: v! C4 M
; o8 c; W; j2 K8 S
ITK_exit_module(TRUE);" I A% P' s T8 n) T5 g7 K( H% G' c
return status;
) q, M6 H9 s1 r}
- H$ B; e2 ^0 a8 Y+ S |
|