|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 ^( I, |4 |: {7 t
* b$ p2 y" p( J ATeamcenter ITK二次开发源码分享:创建自定义文件夹0 i1 w3 v, }. o1 n$ i
输入的第一个参数是文件夹名称,第二个是文件夹描述。( Z2 d+ R- F$ [
& w8 h! P5 _5 k& }8 Q0 f$ w# J( A
I+ p c ^# j0 p$ f; ?# |#include <TC/tc.h>
f, q/ t8 E6 N/ l- {#include <tccore/aom.h>
" W; X4 F) x5 K#include <tc/folder.h>" p6 F3 k/ {# v7 d0 o* G
#include <tccore/workspaceobject.h>4 E9 l4 V: Y2 K! B
3 p- L( C+ y" `5 l' ?. I
#define EXIT_FAILURE 1; d* Q0 ?& C% v/ m9 p, z! R
3 R5 P4 E; p' I! M% s6 I
static void report_error_stack( void )
/ i2 m% Y3 @9 q. l0 _ {1 _) t# K- e/ c5 F( Q
int; X; y7 m. O' u* J6 k
n_errors = 0,
% X i, J1 J5 ]1 X i = 0;5 E) b9 C% n* F6 {
const int
: d6 a2 i0 G2 I *severities = NULL,
6 Z% G, N0 e! C) d; n8 S% R *statuses = NULL;2 R% R2 _3 [# X
const char* q: |' v, m+ ^; i0 A
**messages;
( w% m! E. @- [1 O# g% x0 R. V" L/ y4 X$ g& `! n3 o w+ Y( f# V% T2 f
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
9 E! o; X( c) e& F% b printf( "Error(s): \n");0 o# }6 [6 v% { X7 k7 D
for (i = 0; i < n_errors; i++) 5 S! U6 O7 }% N, L9 K# Y. y
{& z" ~* {8 e8 g, j6 }4 k
printf( " %6d: %s\n", statuses, messages );; o( ]. E+ y5 N
}% S4 o4 U0 Z7 t( s7 ?
exit(EXIT_FAILURE);
% C& |3 a8 b$ b& @" A/ L+ [1 J; D0 ~. a9 t }
: y. p1 \2 m. L+ J% m4 z; x: @9 J' n, e! l% F1 n
int ITK_user_main(int argc, char* argv[])% F$ v' l, v3 A- k
{" _5 M' J6 f0 @7 i+ d
int
. K3 E+ J/ _# |7 r0 P status;
& z- A7 e/ W& O8 S( \) Q char
8 x8 j6 \8 N2 }. m1 { folder_name[WSO_name_size_c+1],
1 u; D) J& h1 I3 Y9 | fldr_desc[WSO_desc_size_c + 1],/ u0 T; {9 _5 v1 G/ m k
*message;$ P: g# @) Y: W3 l; r+ O6 m1 X
tag_t
% K! |. N; C1 F. y new_folder;9 |$ Q1 d# G4 F9 D" z
, [1 z7 F9 z; e1 k5 o! u ITK_initialize_text_services( 0 );1 j# j9 d4 M- Z! x! h
status = ITK_auto_login();' L& O6 e0 {+ L% G
if(status!= ITK_ok)
! Y. h$ I+ B. ^ D! n& m {
+ Q# s! }! @4 M8 `5 h' \% N* y8 j report_error_stack();
: U7 F, T# e1 r9 d }
0 i5 J7 H& k4 J" T else0 v4 ^2 c3 K2 X! d; n0 M
{
h& Y% h/ }; N G8 N5 l8 X printf("iMAN login successful.\n");- W/ t8 Q$ |7 @, E4 n
}
' Z& _ ~) U% w
3 y9 Y8 g* y! \5 ?% C- T9 A+ @0 r4 { ITK_set_journalling(TRUE);+ y2 }3 n6 R- J! {
! n( I9 p, R; E6 i8 h
if (argc > 1) strcpy(folder_name, argv[1]);
9 @) c! A" g7 R) p else
. u3 t( s7 m& L8 r. f+ H, _4 b {
/ v6 t8 d& n, M+ w$ T* J printf(" Specify the Input in Following format : \n");0 R1 U. E/ [4 y8 i; O2 s/ @
printf("program_name folder_name folder_description\n");) ^( R7 k# b, B; L8 a
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
( o8 a) z4 M7 N4 Y( e$ v, c return ITK_ok;
" y. ]; D% ^3 I4 ~/ q. C: D" r9 i }
. D% @; b! \9 [$ m% P8 S. I: H0 |( P/ E% D
if (argc > 2) strcpy( fldr_desc, argv[2]);7 c8 ?% ^9 U7 Q3 Q l
else strcpy( fldr_desc,"");! N/ [3 _5 P; T1 b+ w9 }; v
$ f" b+ | I( i# H4 I+ V status = FL_create( folder_name, fldr_desc, &new_folder);" l' s5 v, g- F' O: K F' b
if(status!= ITK_ok) report_error_stack(); 1 n7 A) C1 X" Q) V% X
! n5 {5 |, ?7 i9 h1 F7 h
status = AOM_save(new_folder);+ K! e1 f7 R4 v# ?
if(status!= ITK_ok) report_error_stack();) D9 E* ~" ~0 J
else printf("Folder '%s' Saved; ", folder_name);
( }! h8 Y: M p0 q: s/ V* k8 A1 K$ @5 \2 c
status = AOM_unlock(new_folder);
6 t% D& ~4 E1 p if(status!= ITK_ok) report_error_stack();) b+ B. [+ @, [
else printf("Unlocked; ");
: J5 `0 q7 `1 r( N% S, O) q( S. U& F. a9 m" ~/ z' k/ [
status = FL_user_update_newstuff_folder(new_folder);6 `% W6 z+ G/ v9 [+ ^; v; F
if(status!= ITK_ok) report_error_stack();, ?9 N8 }" _; D5 H- _$ S2 _- \5 g6 `
else printf("Put in Newstuff Folder.\n");$ p) |: i6 ?+ L. S& n
A9 p. |* `$ Y ?1 ~3 F1 B ITK_exit_module(TRUE);& S0 \4 t1 T- |9 h* c2 Y
return status;& q- W! b. `; s4 v0 f
}. M- u' u; ]1 Y6 X% M; u F ?
|
|