|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 t" f$ {% }: g
- t- } `7 _+ E& @3 ?
Teamcenter ITK二次开发源码分享:创建自定义文件夹) `- N+ c! F# Y* W4 L( [( S
输入的第一个参数是文件夹名称,第二个是文件夹描述。
) J4 b/ u, t0 p+ T* H& j. j& O9 n! M5 P& y( D7 B& d
$ J& z; K! Z3 `# R, ?#include <TC/tc.h>
# w& P% t9 o, n- Z* ^#include <tccore/aom.h>8 }2 x, G3 D! C; O j
#include <tc/folder.h> Z) V/ q9 [$ R) E2 I. z1 {
#include <tccore/workspaceobject.h>
2 ]8 H6 {' k4 x y1 a d6 I: y. O7 P
#define EXIT_FAILURE 1/ ^( J. }3 O) {0 H
5 B/ I p" g6 X) {9 c9 y! _- B+ q
static void report_error_stack( void )' X6 g9 ~$ d7 ~4 r/ V. ?9 [0 o
{, k' |1 ?# M; \; B! H4 a/ H
int& y& R3 A; K; g
n_errors = 0,+ t( _5 O) d6 W: b( y: R- `
i = 0;
- C$ I2 t- D- m9 R2 d const int
+ }! k* N, x, s *severities = NULL,
9 E5 y! ~9 W5 `3 @8 \+ n *statuses = NULL;1 B9 A! ]1 L# W9 q; s5 ^* T8 i& K
const char
/ s( \2 |+ d! f8 a **messages;" G0 c2 l0 E3 w$ {3 q, e0 k
( N5 j* i# r2 B4 _/ l
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );" u: h0 |3 \1 s$ W: L
printf( "Error(s): \n");
( I G; j; ]. {2 e* b/ ? for (i = 0; i < n_errors; i++) 4 ^( b+ l! a1 U" _ q' e4 E" L
{7 J9 w& t/ v3 w: K3 C m/ f
printf( " %6d: %s\n", statuses, messages );
$ u) J2 g8 U9 w1 a }
9 H0 E* Z) C. _. \$ O exit(EXIT_FAILURE);
5 x0 `' V* B' K }+ r t% x8 L a
, Q+ l8 C( f5 c+ I% P: m# D1 Nint ITK_user_main(int argc, char* argv[])
/ I8 K- i9 g- {/ j. K{
, N1 C# Q' _) s: ^" _: Y' b int9 Y" B* _8 u3 _% R) G
status;
, p/ G' T% V, S% A' n+ g char
; b u: R x. n7 I4 j folder_name[WSO_name_size_c+1],
' j& r* y2 t/ C* q0 |# U+ ] fldr_desc[WSO_desc_size_c + 1],
+ B: d& \8 G1 N0 b *message;
$ F# e) k/ s3 i$ [( ?' T tag_t
# { g' G$ j: y( z n new_folder;
1 Q" T% z! T9 ^2 @) N Q. _) y& B, I& p: b- Y) q! x0 ]
ITK_initialize_text_services( 0 );! {! S6 G: F) S+ K9 s0 n7 [) t
status = ITK_auto_login();' j( p! ?: p% H
if(status!= ITK_ok). ?: l) N% i4 k$ s7 Y2 x: Z! G. N
{( N% A7 T2 d! t6 |7 J# k3 Z
report_error_stack();" ^1 U% }0 i. M4 j1 k5 s1 d
}
% {+ W# m: ^$ c, R! [! Z6 K, i+ q* L else. ]7 R& p3 W9 {0 Z6 b
{9 t! N% G. J0 f1 n1 E' p( A1 T9 t: m. a
printf("iMAN login successful.\n");+ k- m2 o# [- P, k H, F
}
8 W0 B; s! f7 f, E$ O. g. f! r9 O( \# m1 L4 t: {
ITK_set_journalling(TRUE);
# i1 [5 x* t9 i4 X
2 {$ e: S3 y" H4 \ if (argc > 1) strcpy(folder_name, argv[1]);
0 i; ^( \ [3 ?8 @. |& s0 w! y1 w* x else* ?% a; B* q3 u. [
{
, A% E- N2 c* \ printf(" Specify the Input in Following format : \n");7 }' x! B. r! ~ A! ?, g
printf("program_name folder_name folder_description\n");
0 X2 b6 j+ C1 a1 t. \% O( w6 o printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");. ^' E% j& {# i
return ITK_ok; 0 i& C3 p! y/ [ G a* i
} ( d' k V2 R w8 g$ s6 J8 H% d
- v* t1 H3 D, H if (argc > 2) strcpy( fldr_desc, argv[2]);
) ^2 o$ F$ ^; Z: w9 `4 G else strcpy( fldr_desc,"");
4 [0 H, U; S8 V
: R- U: W( K6 Z: U% F2 J status = FL_create( folder_name, fldr_desc, &new_folder);
; C- w; I/ S! G3 C# J8 K if(status!= ITK_ok) report_error_stack();
, o# ~$ t, t( V6 F+ W2 U' m; G) U( V/ v6 D. u
status = AOM_save(new_folder);
# w3 z7 W# r" l3 D if(status!= ITK_ok) report_error_stack();+ D% `8 `( F: m$ ^ h, m
else printf("Folder '%s' Saved; ", folder_name);
5 v0 h2 i5 g3 }2 G i( G7 O
( r; L; B$ i( Y7 ] status = AOM_unlock(new_folder);8 P8 ?2 r! y" H0 o+ m8 G% I9 v
if(status!= ITK_ok) report_error_stack();
% c% o# k) d `9 u' b: H$ z+ Q else printf("Unlocked; ");
( |& W& Q3 |+ n- h6 H1 s9 O3 w" f ~% V0 l0 ]9 `
status = FL_user_update_newstuff_folder(new_folder);
9 ?2 R5 {+ J6 S5 \2 p if(status!= ITK_ok) report_error_stack();
/ u0 J" n% S; q4 a9 U else printf("Put in Newstuff Folder.\n");; T2 i- I6 e/ R2 ]0 l( w4 o0 p$ o
U' t' J9 G/ C- g# R
ITK_exit_module(TRUE);- _* }# u# a- P5 s/ V% G
return status;9 e4 _1 `0 `0 v3 o9 }
}2 W8 X% |* ~5 A8 d* |! v
|
|