|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) m$ D, B1 s0 ~% E+ Y9 E$ w
" J% S5 b, m, f# S# b. TTeamcenter ITK二次开发源码分享:创建自定义文件夹 X% u! j/ N; s( |! X7 {
输入的第一个参数是文件夹名称,第二个是文件夹描述。
) m2 L/ u+ T/ I. k, Q# P' y& J
9 P; U! _" P5 W
6 H% e4 p6 j1 e; c1 g( b. [! p#include <TC/tc.h>$ a+ Y$ O0 F& x2 j8 x
#include <tccore/aom.h>" Z# S" t6 T, w+ K2 G/ B1 c$ C
#include <tc/folder.h>, T$ h: U9 i+ _$ H, j* v
#include <tccore/workspaceobject.h>- _" B, o( ]. J& \, \
7 |' h' @" U0 O# D/ m
#define EXIT_FAILURE 1
o! j- `- M& ]9 m+ T( {1 s2 |) u, N3 D' J) M8 i, _
static void report_error_stack( void )% o) B+ z1 D& {; H
{' @& E1 K- W- e: Q. e6 J1 B
int9 ^: B3 \" k n2 z& b
n_errors = 0,
( _0 |4 J! [9 V+ _1 o+ Z' I i = 0;
3 K$ V- L7 c; ]& u const int j0 B# c/ @, P0 e
*severities = NULL,
" Q, l; p0 Y; a8 O7 J4 J *statuses = NULL;
/ _0 ^3 v& P* C. p0 z( u- p const char. l- e4 C1 C4 p+ w7 {5 h* H# Q4 _! s
**messages;8 N0 n. U4 k6 o
/ L* M# L$ _, t: g; s EMH_ask_errors( &n_errors, &severities, &statuses, &messages );# `' t% y8 x- B5 A
printf( "Error(s): \n");
2 H- G* e o# T1 h$ | for (i = 0; i < n_errors; i++)
- G& h3 \5 B0 K3 i9 v# J {
- ^+ I$ {1 w! `0 L printf( " %6d: %s\n", statuses, messages );
! w; B4 O! O0 ?( o }
( \/ L, T4 l) W* ] a6 x4 { exit(EXIT_FAILURE);
7 m. b7 W& d. L7 S+ A }
4 t3 e1 J" H" l% \' V
; l" T* N0 {& Z0 u) o2 Rint ITK_user_main(int argc, char* argv[])+ k. l; {* s- h' \5 z" K
{
7 ?2 n- a/ a. ~7 s! E+ d: Y* n int6 A1 n" Q! h' m5 V6 p6 m
status;. u( M- S: a6 w
char7 q+ d. t5 b& x5 Q, D/ O* x
folder_name[WSO_name_size_c+1],. w4 \( a1 n9 b$ } z
fldr_desc[WSO_desc_size_c + 1],9 B3 L4 o) [( w' X/ [3 D6 N \
*message;
" ^8 c9 k+ O& I8 n" @ tag_t
6 r Z9 ^: G# L1 F1 k new_folder;" a7 t$ z& h& s/ L: k; p# P
, e- g# J3 k8 m" \ S* s( q6 X
ITK_initialize_text_services( 0 );
0 v l/ i) l: }) O status = ITK_auto_login();
9 V8 D% |: i0 _ if(status!= ITK_ok)% B! H# K, p' _# p
{- o; y3 S2 {: f$ k) U9 N" X
report_error_stack();
8 O! B1 e' K5 } }8 \+ D4 p9 _2 I T) y, Z, |
else
: Z3 F$ U; t- D( L P) B! g {/ C. B ?" Z* Y' G
printf("iMAN login successful.\n");! ~: k g; p; Q/ `6 W6 A4 L! f% x" X
}
" |4 \5 d7 `! [
" |- q' K" g2 w. Q6 t8 Y3 D( t ITK_set_journalling(TRUE);
" P+ |! e. v4 E9 c* V, N6 R' W% |
& R/ @2 K z4 H) r if (argc > 1) strcpy(folder_name, argv[1]);
+ E+ k8 l) R6 c& t else) @0 a0 r. d* W: ~9 T
{1 s2 r, d0 {( x. A- @9 |# O# P
printf(" Specify the Input in Following format : \n");" R3 q, [ L, g" b! r! d
printf("program_name folder_name folder_description\n");
2 c5 d" r( Z& L' x7 ~8 b# q6 P, X, r printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
: {* C8 K$ T# o* r return ITK_ok; 3 G8 O% d3 E9 V( B% k3 b2 }
} * g( o' D: J& m8 Z* j; C7 q
& b0 K) v/ J! j# k! q' m# U- K8 U if (argc > 2) strcpy( fldr_desc, argv[2]);
7 k0 T A5 Q% n else strcpy( fldr_desc,"");: ]1 ?" }& J, W" O
' u8 S) t% p, }) L& O status = FL_create( folder_name, fldr_desc, &new_folder);0 {! x- R' o" w% |
if(status!= ITK_ok) report_error_stack();
" ^: l- n1 ^3 X, K
5 b; L& U- E' y$ s6 J& Q) B status = AOM_save(new_folder);( r- H5 M& C9 G! R* I. \) t
if(status!= ITK_ok) report_error_stack();$ `" I0 M0 @# a
else printf("Folder '%s' Saved; ", folder_name);% S2 V; M6 I& Y2 C4 D
, V6 a2 j) b8 y. r, z9 r
status = AOM_unlock(new_folder);
9 r. d9 }: p3 h: Q& g/ C* R: C! z, n if(status!= ITK_ok) report_error_stack();6 k( z0 G) i2 [) i( e/ S( X
else printf("Unlocked; ");
" U2 R a$ i8 C( a9 [0 \ f
% L1 @. t g0 K9 j, i; E status = FL_user_update_newstuff_folder(new_folder);! f" r9 z+ }7 o3 M4 i5 m, a" M+ G
if(status!= ITK_ok) report_error_stack();
% D+ Z( N# f: L* E# h% W1 h else printf("Put in Newstuff Folder.\n");2 W+ p, d& h" M. q3 i% m L3 C
~4 u! F9 I5 d6 o7 D* Q5 j ITK_exit_module(TRUE);
2 F) f8 L2 F0 S" u: T return status;
# X& N. {0 G7 ]! `* o& h9 H8 `}6 j5 p/ H2 r0 t3 X% }/ T2 a
|
|