|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 \$ x% V0 q5 I3 d' ]9 _
5 C4 z# R1 @' F% P! V2 `Teamcenter ITK二次开发源码分享:创建自定义文件夹4 m; X U1 x1 j
输入的第一个参数是文件夹名称,第二个是文件夹描述。# B1 _, z4 ~2 F3 u0 L
1 V# e. _7 A% A9 |6 x0 n* t
+ F9 Z% d. j3 @9 ]. M5 J
#include <TC/tc.h>
7 f6 {9 ?. Y8 W2 X9 p% d9 a# K1 k O#include <tccore/aom.h> h0 ?9 j9 F" l# x: q9 M1 R
#include <tc/folder.h>4 Z0 J1 x# g, S
#include <tccore/workspaceobject.h>. {2 I& Y) M/ Q$ }' L. w- R4 S
5 i6 _) A4 H! Q" h& d#define EXIT_FAILURE 1# h2 Z* b- ^ a0 r5 |% ] J
0 S2 o; s% p& y( Z. N$ C Y
static void report_error_stack( void )$ }2 Q1 X1 |. c
{' o6 `: ^+ d2 Q7 z
int: V* S) V8 k- [9 `- A0 S
n_errors = 0,
( i$ ]* m* H* w7 b i = 0;7 ?3 F4 y$ g. _
const int
! F1 M$ @+ Q- R& W *severities = NULL,) a* ]5 {$ i+ ]9 Q1 A
*statuses = NULL;, P+ O- M- O6 [0 I
const char
( K8 I: O, H( f **messages;, f4 M; l# E9 k* \8 l- I G
e: I& e+ ?. ]* H5 _: _3 u8 H) ]
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );* H. _: `1 u! ^% q
printf( "Error(s): \n");
% |4 J) `+ y" c& I/ H0 N7 A. t for (i = 0; i < n_errors; i++) 5 k9 s4 C3 q1 C8 b- Q2 ]
{
: n2 s4 r e' o: D3 W1 x2 _ printf( " %6d: %s\n", statuses, messages );
8 B0 z' _) y( C, o! y1 F }
, f) P+ h' s) h6 t* k l% Y* F exit(EXIT_FAILURE);* K9 i! U6 D+ X$ r/ J9 _
}
! \0 l2 `' O1 S2 Y+ s. m& C
7 y r% U0 z" c9 J$ u' w" ]% jint ITK_user_main(int argc, char* argv[])4 D& u% r* e! c
{/ Y3 H0 @' U2 X% N! C
int- ]' g% x+ Y4 y# _) r8 z
status;+ g' a5 M2 c9 T0 U: ?
char
% H+ g8 s! t1 m# W" Q folder_name[WSO_name_size_c+1],
; t5 P, e. Z$ ^& r5 A fldr_desc[WSO_desc_size_c + 1],
. T3 `0 P% |# e# Z2 p *message;
! A K- y: x9 N- c tag_t* T, O9 l/ Y2 \% q
new_folder;
: i5 N! V/ Z/ M
1 p6 d; ^ R2 o4 X- H o0 W ITK_initialize_text_services( 0 );
4 V/ z/ s/ q0 a' |* N& D% ~ status = ITK_auto_login();
; Z) ~! i7 s6 I if(status!= ITK_ok)
. e- O* I) H+ ~3 o, c# G' D {2 f( r* C4 `4 g
report_error_stack();% i6 b/ w% d' j+ l2 R6 N
}% @8 N0 V. t a, Z0 F0 q4 F
else7 @2 i3 T! x: j9 |- u3 D+ s. z
{
4 C5 {6 z. j a3 U/ ^' M; f printf("iMAN login successful.\n");
5 f- s& M# X( m2 s! [0 |/ K) i }
/ m) k& Q) }7 k1 k: D, y7 e4 Y3 V$ a* q/ \* s
ITK_set_journalling(TRUE);
9 y# U* x; j" L7 l/ o* r# r$ s& ~9 i. D0 S9 V. I0 X* d* T' W0 T+ P8 o3 s
if (argc > 1) strcpy(folder_name, argv[1]); j2 W! p) e6 O, C! _. d/ a- D
else
* S, i" G3 E8 g8 l/ O8 |# j* G+ X {
8 s* C8 B: {! s B: l2 j0 {+ o7 u printf(" Specify the Input in Following format : \n");
. z6 n! H) I4 w, H# N1 o* X' } printf("program_name folder_name folder_description\n");2 N) }3 r! i' T" c
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
6 }$ y- z( f6 M return ITK_ok; ; k E, }/ |# N; p+ {" [9 `
}
# b0 a A0 }( Z9 p' m' m1 a4 N# l3 @- n) `; \
if (argc > 2) strcpy( fldr_desc, argv[2]);
" S- C+ S8 \+ p& K( t2 Z( W else strcpy( fldr_desc,"");+ V* H# |: }1 i! f. K7 u
0 f/ L V8 m R# L* o: `& p
status = FL_create( folder_name, fldr_desc, &new_folder);0 p: h+ M$ M' D& f
if(status!= ITK_ok) report_error_stack(); ( B0 W8 Q5 P- z1 ?3 Z/ M) P1 e
" [& u1 L! Y. x: W9 T/ u status = AOM_save(new_folder);
5 b) g- c% `4 z2 X' f2 B if(status!= ITK_ok) report_error_stack();" P& M0 X2 J& n3 q8 M
else printf("Folder '%s' Saved; ", folder_name);; K \ z5 a- H+ K8 U( b3 y
- a7 o$ `/ N2 [3 i4 B& O% F
status = AOM_unlock(new_folder);/ y3 H& U5 F T
if(status!= ITK_ok) report_error_stack();
6 S* x8 E8 ~ E8 a s else printf("Unlocked; ");
: S* n9 t( O5 Z$ {. [2 p% r6 x. O' E* P- A; P' g0 F6 T
status = FL_user_update_newstuff_folder(new_folder);: ^$ o% [) k; X/ g6 Z# _
if(status!= ITK_ok) report_error_stack();
! W6 o; U6 B( `7 C- O. ~8 h else printf("Put in Newstuff Folder.\n");
1 T; f; r1 [/ ~5 |0 I
# P: L. u0 G' C ITK_exit_module(TRUE);
1 b" e7 ~# \( C return status;5 N7 v. H2 a0 y) P3 Z
}0 E9 X% |( q$ H+ {0 p
|
|