|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
9 f$ a6 n2 D: H, g
4 K! b( M+ q2 u: `! E) ~
Teamcenter ITK二次开发源码分享:创建自定义文件夹$ V. ^) W; \0 n; t- P: @
输入的第一个参数是文件夹名称,第二个是文件夹描述。
9 A. m1 J4 @7 k' a( [ e
2 u/ Y8 v5 i% E% E6 j, R1 u" V t0 I1 p8 m4 i4 V9 D
#include <TC/tc.h>3 g6 S: W+ A; c- V8 u
#include <tccore/aom.h>
+ b- k c) v% z; \+ S#include <tc/folder.h>0 r: ]+ D' r; W2 e% c, B9 J7 M6 d2 K
#include <tccore/workspaceobject.h>9 \& z. L2 C5 q( r3 u# g( Y
' o% z8 p" I! D. H#define EXIT_FAILURE 1
( ~" U5 F/ l4 A9 j, D1 Q4 o/ K+ I/ v4 X; m! I
static void report_error_stack( void )
4 y3 M/ P2 H) J$ M {
* m, K# ~, y% r: s3 u, G int
- z- z6 q8 |; H# @& O$ g' S/ k n_errors = 0,
- ^0 U* s; u: J$ ~7 ?# j0 B i = 0;
% D6 j3 q0 ^" ?6 C8 N; S const int( \; z6 @) G6 b' }
*severities = NULL,
1 S; E P8 I' z' c: j9 S *statuses = NULL;3 m/ F7 Y3 o# w2 b! V, O
const char
% K$ X# |% g8 v. d4 ~ **messages;7 ?- y$ @# C/ Z. \( N9 p4 j2 v
) p6 {$ [& V' Q5 w/ P
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
3 m; v+ j* u( K0 s i, D7 N" ] printf( "Error(s): \n");, J1 ?+ c$ d. V
for (i = 0; i < n_errors; i++) @2 r/ w+ l w3 {% T) Q1 }8 I
{/ J7 A2 f& c% q: K: M
printf( " %6d: %s\n", statuses, messages );& O; r8 Y4 i! c0 G* t9 Z
}9 G$ w" ~7 M3 _. G
exit(EXIT_FAILURE);
, s1 ^ @% S7 _3 R5 [ }- v* [- B' O2 R3 M0 W
9 o4 P% b* J @8 H a, }: A. |
int ITK_user_main(int argc, char* argv[])7 q6 Z0 w5 Z' P+ f. v5 G3 E( S9 z
{
$ J& }5 L9 H4 r4 V8 J/ p4 a1 d2 d int
; T. j+ m3 B+ A: T8 h/ }3 {: Z status;
/ L) `6 R6 P0 ~* } char
# S+ y+ b; G, V3 V1 R% ] folder_name[WSO_name_size_c+1],
3 {$ d) k# S" ?4 g2 Q$ {. ~ fldr_desc[WSO_desc_size_c + 1],
4 Q' X: l" O, ` ^) ], i *message;
6 b6 g" d9 o& M9 h tag_t; u* H( _' l% u, N! Y! z1 B
new_folder;1 k6 u+ ~' L5 l1 f* ^2 K7 ?# q) w
) K7 z" K/ G0 a' S9 y5 d/ u
ITK_initialize_text_services( 0 ); ` T0 x: E1 H
status = ITK_auto_login();3 V. }& C9 a5 B e
if(status!= ITK_ok)# L$ o. g( t5 m4 H
{
6 }/ C2 N6 j+ |7 ] report_error_stack();- Q* ]/ z& V Q# q% z
}
0 W! q( x$ f5 r* i$ W else) K& Q$ A6 X1 g* [2 E
{
& k" }" O. c* p" P: l- c printf("iMAN login successful.\n");
$ X F) Q# y) b0 E }
+ V$ d6 X7 Q& q+ ^4 ]& _" R! l% U# G y# `
ITK_set_journalling(TRUE);
& D: ~5 k' O5 S. G% L: w
3 d" w4 F: `" J! u if (argc > 1) strcpy(folder_name, argv[1]);
- ]0 [7 |6 |7 f& ^) z5 D else8 A9 e; ?8 f. e. o. D
{
& E9 U4 ^! |8 }3 f printf(" Specify the Input in Following format : \n");, u2 ^2 U5 \, z, @% |" E2 h4 |8 H
printf("program_name folder_name folder_description\n");
/ ^4 x7 y, ~6 F4 @) s& o printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
" T* r- {# S k8 H' U9 e6 B2 y return ITK_ok;
" V" i0 ?# O; O: I1 I, r }
; b- [0 [0 U. x: C* \7 ^. o8 Z4 |! z1 o8 j5 v+ E" w/ D4 a
if (argc > 2) strcpy( fldr_desc, argv[2]);& f2 A X1 j7 x; b% n2 g8 i
else strcpy( fldr_desc,"");
, Q* H8 d8 _1 V8 T% e) K- z z; J5 `# c' i
status = FL_create( folder_name, fldr_desc, &new_folder);) {7 ` O P! ^
if(status!= ITK_ok) report_error_stack(); & l; ^- h3 |7 p% D2 C# j/ E
8 k8 H5 J& B+ I$ T. R; d
status = AOM_save(new_folder);) D* ~: w* P/ t5 q" y: z' N" U
if(status!= ITK_ok) report_error_stack();( H9 o; K$ z- v( y3 P! a
else printf("Folder '%s' Saved; ", folder_name);
1 } C7 a- T o
0 G' c# G& \0 T3 S+ o! n. _ status = AOM_unlock(new_folder);
+ j. V$ V" S. m$ V0 n if(status!= ITK_ok) report_error_stack();% S; T7 @, V- ]+ r. O" ]
else printf("Unlocked; ");( [5 ~' a& v# ~# ^6 x) i5 k( G
: o) N5 d% ^8 g6 v9 K
status = FL_user_update_newstuff_folder(new_folder);
; t) J! V! }, g" K* E5 |4 h6 d if(status!= ITK_ok) report_error_stack();% H5 F& r$ N3 ~; x& `
else printf("Put in Newstuff Folder.\n");3 R( ^' m6 Y3 r% @$ v
& D: @! o7 S$ y" A! K: p ITK_exit_module(TRUE);8 b& E! K; B ?9 C) F+ ]& e- x. b# w
return status;% W1 z' K9 s' x- L$ s
}
0 H) G! Y S5 ]# d7 j6 g# H |
|