|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! B5 P) z7 b# c: G) D8 m
- ]2 } b. g' _+ D
Teamcenter ITK二次开发源码分享:创建自定义文件夹
/ O* y( I3 G9 Q, K输入的第一个参数是文件夹名称,第二个是文件夹描述。! A: G5 P- ~$ D
, q. J7 X$ E, h7 h
& d | R$ C0 a9 C7 R#include <TC/tc.h>6 ^" }4 ^: k- _6 e% F
#include <tccore/aom.h>) A0 y" O: x$ q
#include <tc/folder.h>9 \3 x& w& k: c9 a% Z3 K6 G
#include <tccore/workspaceobject.h>
2 ~. b/ m' A9 G0 Q/ \4 F+ I! K
#define EXIT_FAILURE 1
& m9 Z7 L B* y$ c- O' L% O- m
) J( t3 d0 d6 q- x; Kstatic void report_error_stack( void )7 g2 u7 o; ]* ~3 L
{
3 {1 q. w9 k* K* a6 n! Q int1 c6 I1 Z) s& T( X! q) y- q; n
n_errors = 0,5 S- y) K' n Y0 Z
i = 0;/ `* m' G! l y# `# L8 x4 T
const int7 P) l) x# M& A4 I9 [: [7 c
*severities = NULL,! c% }/ l7 U' b7 B o
*statuses = NULL;
8 o x# H! f4 O* P* B7 d& P) d const char
! g5 {% _; {! A, \! H **messages;
/ M, U c0 U( t" ~3 K
6 H1 m& |; Y" Y& v2 y EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
& y& d* y$ ?/ C printf( "Error(s): \n");( y* t* f/ @3 d% w2 B* ]
for (i = 0; i < n_errors; i++)
3 B& U5 T" c7 |2 Y' L4 B {& l8 r6 Z* U5 U' j' ^+ i' z! u
printf( " %6d: %s\n", statuses, messages );
9 `, A- `/ h$ B9 ^0 i% } }+ H, u$ \% g' O# u( r9 j- d$ D
exit(EXIT_FAILURE);
" f T5 S8 ], s2 j }& ]1 \4 T1 t: E$ P
) k$ W& P9 _8 ?1 @: j/ hint ITK_user_main(int argc, char* argv[])
5 z& s7 c, p) D* |8 {8 {{2 m7 V: Q8 B* t
int
3 t. Y) _( y8 A6 s status;/ T# i3 c' e0 F) R* h
char
0 r0 O% o; _/ g- G' F# D folder_name[WSO_name_size_c+1],
" D* n; x, T0 O6 s3 L fldr_desc[WSO_desc_size_c + 1],
9 V; H2 ^* [: g1 D$ X *message;3 \" p P3 }& |% E
tag_t; f* l3 I' Y- u, E
new_folder;/ O+ I% b9 j, w1 _' D* d, h
2 \: H$ U& Q( N- U3 w4 R7 r
ITK_initialize_text_services( 0 );
, M& F3 t% c8 B+ q status = ITK_auto_login();
0 y# T3 `/ t' m/ p2 u% i. A if(status!= ITK_ok)$ }" u( i) j* Q8 z2 H
{% D5 J! n, _* l& a1 h, M
report_error_stack();
+ E- G% K4 c j9 H }% o7 x8 j" o0 C+ Z& b8 T4 q# Z5 F
else
& o) u8 h/ V$ Z {
) v- d9 O. p$ K! f1 U printf("iMAN login successful.\n");
7 I0 H, t: Q/ U- i1 y }
" ]3 {) F2 i: b v/ C( {' K5 ^1 i- y+ a" {
ITK_set_journalling(TRUE);: }* W1 l0 O/ P& F a& O
+ ?: }2 c4 F$ p7 `1 e
if (argc > 1) strcpy(folder_name, argv[1]);0 W. e- J) g7 B; Z
else
. R+ n8 D. h1 I( m {1 G5 ?, f" n: Y; a# `
printf(" Specify the Input in Following format : \n");- U' U# Z' r/ ~/ S$ T2 W" C
printf("program_name folder_name folder_description\n");
$ f5 y1 W; ~% a- J' B printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
7 ~6 w! B8 \- A: [8 d return ITK_ok;
( `, O' l* `, u" h n& p7 L }
' b5 F# r- I' @6 S- r8 R3 _, U' j' E2 l+ y. {5 f% P5 L! D
if (argc > 2) strcpy( fldr_desc, argv[2]);
" p8 Z7 x" N+ `) U% h8 q else strcpy( fldr_desc,"");& D! m! V' `' F6 n
9 D' T( T7 z* y- N* ^
status = FL_create( folder_name, fldr_desc, &new_folder);
; L9 o3 B5 k$ Q+ G if(status!= ITK_ok) report_error_stack();
6 o& v' P; X& l: y, J& @$ c1 ~ ^+ |) q4 y" N7 r- c0 a% [
status = AOM_save(new_folder);
% ~" c" W$ u! T/ s' {% [8 i7 ` if(status!= ITK_ok) report_error_stack();
3 Y! z9 Y9 ^1 y1 W else printf("Folder '%s' Saved; ", folder_name);5 P8 a3 T) c% n8 w& @6 C0 e
& Q% c7 |5 }0 N8 {2 S3 U& G5 t status = AOM_unlock(new_folder);$ L, L7 J# A: l! x0 i
if(status!= ITK_ok) report_error_stack();
* {6 {" _& R) d: Q) K/ c( _8 j else printf("Unlocked; ");( [6 q- `& |. E5 j9 J' i
4 A( ?( B- o# W8 z6 v status = FL_user_update_newstuff_folder(new_folder);
1 F& o, y, {1 v9 E if(status!= ITK_ok) report_error_stack();
# K) R+ u) w9 a5 h3 E8 f9 x" A else printf("Put in Newstuff Folder.\n");; [) P: S) X, N5 p+ U' r
3 B: n/ Z# ?1 T1 Q% j- C
ITK_exit_module(TRUE);
9 d7 _4 y) ?; |8 i5 S& ` return status;
( c+ q3 k( O! w+ j' ?}/ ?5 n/ w; n- s9 J
|
|