|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) Q% m7 ~) t9 x0 d% t& R" w( O e6 S+ M9 @% F
Teamcenter ITK二次开发源码分享:创建自定义文件夹! P2 f6 Y. c: `8 O, J
输入的第一个参数是文件夹名称,第二个是文件夹描述。( E8 K/ O7 @$ i9 v6 Q+ `5 N( x, w
1 z; U) @3 {. T5 @8 H Q. ~2 y
- q1 M, i: F/ y5 ]' d#include <TC/tc.h>
( E p! B" e, n4 C1 G#include <tccore/aom.h>4 I4 V5 N0 V K5 A% o5 m
#include <tc/folder.h>' U2 ?" d/ m4 C* z2 ]7 l; t
#include <tccore/workspaceobject.h>
% P+ y3 {5 E5 ]$ K1 {. g, o% F/ t5 b0 ~3 h. J( l; |3 s1 a
#define EXIT_FAILURE 1- B- |7 Z" G* A/ Y
' X1 _0 H, u; C5 u
static void report_error_stack( void )
1 B! E# ?: a4 S+ |, }3 R* u0 @8 M {
' m9 W. q- T6 _7 M$ W int
/ r+ K; | v: G7 g% u7 ]9 _ n_errors = 0,
" J3 l2 ~2 s1 x7 i6 |) F* D i = 0;
5 M+ c" T/ a* ~! e/ x5 x# W/ } const int+ \, ^3 ~# W* T5 Z: N4 p
*severities = NULL,
; o. Q8 c- @' m' r% P *statuses = NULL;1 K& H! Q/ j4 T& G8 E
const char+ P2 ?" ]: G2 `
**messages;% S+ G: Y& |! I! n
' ?/ Z; k2 ^6 c2 o8 B3 ^4 B0 s: F+ T
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );( x( H7 E, v8 L9 s' g1 x/ d$ h
printf( "Error(s): \n");
7 c7 u% t- c& w/ J for (i = 0; i < n_errors; i++) ! m& x5 x% W- g& N8 E
{
1 E. o* }) {7 x0 E+ ^ printf( " %6d: %s\n", statuses, messages );
! T& [: P$ A4 [8 H8 ]% [ }
$ I9 Y2 q- I6 V" D- F, m exit(EXIT_FAILURE);8 C3 m9 Q: j o2 k! B s# v; R
}
, s. F0 e7 \- N' f+ N- w; T& J
; n4 e% ^7 [& w, _int ITK_user_main(int argc, char* argv[])
) c! x' v9 B) W2 c# ~0 {/ T& x; x{& y, _+ L! v+ S0 K2 T% Y6 u
int7 ]+ x5 a* M# x; y5 B
status;
/ F. P. z- x8 S char
) q6 |+ {5 t5 @% y. `1 l! d folder_name[WSO_name_size_c+1],. T" r" G) W( x3 V5 ?5 }' f
fldr_desc[WSO_desc_size_c + 1],& H8 K! \* R( I6 x+ ^
*message;9 {* c$ b6 o! x! |
tag_t
, p& Y; ]( C( w4 R7 ]2 z7 u( O new_folder;
% N5 O0 q8 c9 m5 D2 [$ v; O- w/ Z* L5 W
ITK_initialize_text_services( 0 );2 G$ r5 c5 I' @& o7 k
status = ITK_auto_login();
" }& y) Z- c1 u* S. a! [ if(status!= ITK_ok)
3 Y- F Q3 T9 m8 ^6 v {, S( q4 y- m# _8 i) v1 e
report_error_stack();
4 L8 @6 @2 h0 `" H }
% `. c; z- O+ P, e; E; ^, W else$ \$ O9 f6 h6 ?! p: l" W
{! {: w& L+ [ @2 Q1 o. r" X6 U
printf("iMAN login successful.\n");& B5 T& y4 b1 K6 p }- {) i
}0 }% c$ X! ~: I3 i6 ` P2 r
8 H* \. v' b% m* T, f ITK_set_journalling(TRUE);
7 q% {4 k' Z8 q
% m- r$ y+ l4 B r if (argc > 1) strcpy(folder_name, argv[1]);7 t( a' H/ I5 N
else/ Q+ k0 p e/ I& H$ x: a
{
( t4 ~5 {9 ^7 V0 b6 U+ }& T printf(" Specify the Input in Following format : \n");
8 [ d) R0 j! c1 ^# T+ i; | printf("program_name folder_name folder_description\n");
+ [$ ~8 Z9 h( K1 y% n% x! j- O printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");, p+ J' z4 W7 t, g) P
return ITK_ok; 3 O% g6 S: w" s' T: p1 x
} % m. P7 T/ F0 [' O5 a. p
' \& q2 w; y+ R5 |) ?2 X; i `
if (argc > 2) strcpy( fldr_desc, argv[2]);
4 J! C4 V% s! }. z else strcpy( fldr_desc,"");5 M+ D8 g1 S0 y# { d/ s
$ |2 G0 V' h% u% D6 |! Q# o L1 [! o
status = FL_create( folder_name, fldr_desc, &new_folder);, K1 _9 P1 K7 b5 |! z: E( e- e
if(status!= ITK_ok) report_error_stack();
2 F7 m. J! V$ r1 s- [4 \
' ]: S/ {2 v$ }: N status = AOM_save(new_folder);
+ k8 A3 q7 f% E/ \+ G if(status!= ITK_ok) report_error_stack();6 z8 {9 I* \" x$ e5 u! C
else printf("Folder '%s' Saved; ", folder_name);0 R* S" i, W0 k
' U! F9 T: [$ ^ status = AOM_unlock(new_folder);
* F& m: W. c. v if(status!= ITK_ok) report_error_stack();% ~6 `. h& o. e' Q
else printf("Unlocked; ");
% \( c( ]5 }, v
4 c }% N" E3 u( e0 W. i status = FL_user_update_newstuff_folder(new_folder);
( r" ]+ \* h% A' q; I' Y, H( ?0 b+ p7 ]: G if(status!= ITK_ok) report_error_stack();
3 N8 }- \7 u' A& Y else printf("Put in Newstuff Folder.\n");8 q9 O8 j- r2 z, ~1 n9 ~
. a9 k6 l9 l) p3 X$ |+ z6 h
ITK_exit_module(TRUE);6 r7 g) s5 [- k
return status;" e2 ? k" u! }4 I5 N9 `
}# Z, S% l" R9 _2 ]4 ]
|
|