|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 E0 R4 G% f* q6 ~, g. F4 T
) \/ j, e6 J3 p0 \Teamcenter ITK二次开发源码分享:创建自定义文件夹) }0 s1 d+ ]: O- s7 c
输入的第一个参数是文件夹名称,第二个是文件夹描述。
) K( ^' m) _, S1 y& X6 g% A. d/ }8 v: z: `7 D+ w, g
3 B8 Q5 Z6 v. `' R0 E4 Q#include <TC/tc.h>8 w. O$ W0 Q3 U( R7 o% W5 \
#include <tccore/aom.h>* c" Q- ?) W# g8 a- I4 o, P; H
#include <tc/folder.h>0 {4 {3 T/ X4 H# \1 f/ s: k9 q
#include <tccore/workspaceobject.h>% d$ Q \; k1 m v! z: t' \/ K
3 N4 b" n1 d8 j+ h+ k! D1 y+ c
#define EXIT_FAILURE 13 M! O2 {- M5 A8 K7 X
9 c9 g) q) ]! f" g! A _
static void report_error_stack( void )
7 P5 e" ` `2 ^# c1 [6 { {
% F* V# U m. f7 V8 R int5 b: i! i# U) M
n_errors = 0,2 p1 M& {3 p% R4 g. \% f* X: f
i = 0;
) j; P& g8 A6 C- C) n) P const int
1 m( P+ c' N2 \4 U *severities = NULL,
2 m: c8 y% S/ f k2 ^ *statuses = NULL;" O3 P S/ I2 d( p' P, S9 T& V
const char* M" x7 y ]' k+ e
**messages;) D3 X# a- q* A, t. v
: r5 u5 Q) {' n% E7 x EMH_ask_errors( &n_errors, &severities, &statuses, &messages );5 }/ I" n5 s5 D6 v0 b* p
printf( "Error(s): \n");; g, C% c2 F0 c; D0 l$ G8 f# h
for (i = 0; i < n_errors; i++) - f/ y6 h! Z+ t3 R
{
$ O' P- d( J( l; G6 T# p printf( " %6d: %s\n", statuses, messages );( n. A" s3 k. z( x" R; ~
}& \! ?) X) j" ~# b1 Y
exit(EXIT_FAILURE);
6 o, N( }. k) u* i/ c }% v+ j: G( Q6 o/ o7 r
# g9 n" R% \- U2 E" f* L! j7 Y
int ITK_user_main(int argc, char* argv[])9 Q, k4 |$ }1 Q1 h- S
{9 [# X' j* e* M* g$ s
int- U$ `( @! P- U- E" c: V
status;
! v- _, _) O/ z. M5 R: i char$ b/ N7 a1 ]# @5 z
folder_name[WSO_name_size_c+1],% }& Y) U, o! f( j! G4 U- m9 @
fldr_desc[WSO_desc_size_c + 1],. @( W8 o R: C/ f& P
*message; |4 I0 q* Z, ~9 e' _4 Z
tag_t
$ _4 k3 t9 n6 U2 m- R% o. s new_folder;# L' F- L; p" K2 r
`9 k& B6 N% J$ q# G
ITK_initialize_text_services( 0 );# N6 O) R: c% E
status = ITK_auto_login();' k. r2 A9 ` y6 l0 { z
if(status!= ITK_ok)
7 t* L. W$ n; w/ y- x1 N {8 B$ h6 D" p" u+ r( u/ w! J# x
report_error_stack();
- p9 p( ~* s/ U4 i% C! b& y }
5 |" j' ?4 P# ~" a1 a else
$ V P% J- h) ~/ d+ I* t3 ^& r {
6 {3 N! I6 {+ A6 z7 \$ q printf("iMAN login successful.\n");
{1 m2 e5 k& e/ K }
: N0 J. v q+ K# x" ?. ~2 p4 r9 t& x: |# [
ITK_set_journalling(TRUE);
6 y) ~5 S7 d7 q( W% r" ^' u& f9 X* A0 A' V0 k! W; l5 P
if (argc > 1) strcpy(folder_name, argv[1]);
3 |/ R2 U6 {3 K- V6 r* d3 H else
$ Y3 D. s0 L a {' c+ k8 J' R3 Q8 ?) E
printf(" Specify the Input in Following format : \n");) o5 j! v" J m, z
printf("program_name folder_name folder_description\n");
b8 X1 Y5 S* V( l/ A! ]6 { printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
d! z1 h# J. O" P6 S0 w return ITK_ok;
5 }$ M3 ]3 \3 O4 V, t& H! `) _% y }
% e3 i+ J6 a; |. r, Z! z; R, [ }# C- c0 Y" M l- o
if (argc > 2) strcpy( fldr_desc, argv[2]);
9 y7 x- j* O7 z1 T" K else strcpy( fldr_desc,"");; Q& f: x- a) F; N/ n6 v- m9 T
6 F3 K0 N. ^; Y! h! O
status = FL_create( folder_name, fldr_desc, &new_folder);
6 S% B% O5 T1 N if(status!= ITK_ok) report_error_stack(); % X3 N5 O3 F, q% I+ B- ~
9 k$ B, M, D$ q4 l+ ^. q H status = AOM_save(new_folder);
$ V" ?' M, X6 `6 r9 ?) B, b if(status!= ITK_ok) report_error_stack();
, m; m( w, Q. M else printf("Folder '%s' Saved; ", folder_name);% Q& V# y9 u" M9 d* i$ c4 u
6 Q7 u& b* w+ G$ s; x3 _ status = AOM_unlock(new_folder);
6 q4 g$ x4 `; ^$ |$ J if(status!= ITK_ok) report_error_stack();5 a1 c2 ?! ?. L
else printf("Unlocked; ");
" s7 Q" v8 F0 V3 J+ ~* F9 I. T: c4 u) G# R$ u! `
status = FL_user_update_newstuff_folder(new_folder);
) ~- t G$ y; }5 B if(status!= ITK_ok) report_error_stack();" a; b) T3 r* W7 c }3 |
else printf("Put in Newstuff Folder.\n");0 C( h( _& L* F5 M/ {
- q: F: M2 e/ e- N0 ?$ F/ E* X. E
ITK_exit_module(TRUE);% j: U2 K0 ]5 M: v Y: U
return status;. w) V' U, ^& D
}: d( f% g5 K1 I, A+ M) } S6 b
|
|