|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 H! h5 e! H* W& l- V
; w: i5 Z; p! W: _% R( o- M) S1 [Teamcenter ITK二次开发源码分享:创建自定义文件夹" `1 t9 ^3 W$ ]6 |- Q
输入的第一个参数是文件夹名称,第二个是文件夹描述。
# n% Z& d5 Z9 I! i! L7 ` s% e/ l; W* T; K
. O% g% K# ?8 e$ [* I# p3 J+ \#include <TC/tc.h>: ^3 j! o4 e; A! b8 O
#include <tccore/aom.h>/ I1 A, {, g2 f. O! R( T* G8 V
#include <tc/folder.h>% k0 H: d1 D- c4 d* M1 l
#include <tccore/workspaceobject.h>5 E& ?/ a: x& @& ^" p9 P
" R5 W; @$ M/ \8 \/ j#define EXIT_FAILURE 1; F3 b0 w+ M% }
; h$ N0 \5 u3 S! `! ^% M% U
static void report_error_stack( void )
" v6 o* L F y0 J/ Z {0 V' q) d* a. f: k* S6 z ~' Q
int: T3 O2 g& p# y' L- W
n_errors = 0,, o6 F/ p8 u o0 x7 }
i = 0;, t2 |8 e5 O! Q; G
const int6 a1 p4 S+ {0 y7 e/ G# |2 g7 k
*severities = NULL,
9 D V2 W5 Z3 x8 Y {, I *statuses = NULL;' t. N7 C( t: a* k* w
const char
' D6 ~ {. r, P H$ C# e **messages;7 i. G/ f: Q% s3 N6 W
$ l$ e$ d0 [+ G2 Z+ ]9 j2 ] EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
p' g9 x- R, B: t printf( "Error(s): \n");! _) B: |" Z4 f' X' l m- {
for (i = 0; i < n_errors; i++) ; d' z" A2 i) G" i3 I1 N
{
: u$ W, I% Y# O4 } printf( " %6d: %s\n", statuses, messages );
9 |5 a7 H0 } a- {( U/ K3 x }
) w/ U& o8 U- B+ @+ y3 ^) A0 h exit(EXIT_FAILURE);
, u4 T4 k" v/ k. T1 L3 U# { }
- _# q7 T, H& ?8 B( L/ \% z+ t5 e; w) l0 i
int ITK_user_main(int argc, char* argv[])
4 [& |2 S1 F& x{
5 K9 k' a8 s: H( q int1 C3 w# M* g Z4 B# p4 ^
status;
# U9 S! N6 U* Y [ J' S/ d char
/ e; O: _! B* z6 W3 c: v, ?3 C$ K- D folder_name[WSO_name_size_c+1],
3 J. M- O0 i" Y; `+ ?6 W fldr_desc[WSO_desc_size_c + 1],
$ I( S. z. M' J. A *message;
5 I& z+ w7 K6 y1 Z( h* A# | tag_t \7 C5 \7 i) f
new_folder;% o* |6 _. m4 M0 I' M L% V9 B/ }
6 _2 l j2 B; G4 v! [3 S3 f
ITK_initialize_text_services( 0 );
, @% h) W. u; Y, r) W' U6 d. D, }, ? status = ITK_auto_login();
3 N* o& U1 G R if(status!= ITK_ok)
( Y, m7 w6 i) }9 g* ]% ?" v {/ H8 y% S- p0 G
report_error_stack();
+ H) H8 P2 k4 I: | }0 k8 X$ }* d% S
else
3 K% G3 t( m7 O4 D7 o' Z0 _9 p0 e {; g2 o: E9 i9 e2 \5 Q
printf("iMAN login successful.\n");
! d. ]% ]7 T$ q. W0 H% i# O }
' ?: H5 K8 b2 n% P4 Q- \, I
, o. [3 p% [! U5 ?8 H ITK_set_journalling(TRUE);
+ J' A9 _7 m, D) T: e$ e8 T6 Y" t$ J0 f/ X& d& `
if (argc > 1) strcpy(folder_name, argv[1]);$ G/ c. ?% l8 E6 ?
else
8 u2 U; ^* f7 m0 { F* V& b) v# ` {
5 U9 s& |% F5 v7 n8 h, R# _. Q& _ printf(" Specify the Input in Following format : \n");+ f( F. b/ t% }$ Q" I; Z
printf("program_name folder_name folder_description\n");
$ V. j+ p( l+ l3 h5 L& U2 N, m* `9 b printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");; f) A: l# i# |) r0 M! f
return ITK_ok;
" m& D+ k% m# m( H- m/ c }
# o- c: g! P3 l- @9 ^# J9 ]8 j j X$ ]: D4 [5 H% t5 I# s, j
if (argc > 2) strcpy( fldr_desc, argv[2]);% R9 s, e, ?+ c3 ?: `7 k9 t
else strcpy( fldr_desc,"");- a: O3 ]1 p$ _# E
) W$ V! }# x+ D+ x status = FL_create( folder_name, fldr_desc, &new_folder);+ h: z: o7 C5 U% f$ G- Z
if(status!= ITK_ok) report_error_stack(); 2 R' F% U9 X" t/ `: o0 O1 h
+ M$ C, |. X+ \7 L; {; t status = AOM_save(new_folder);
8 K. Q3 C; L) ]7 ]$ v) E+ H if(status!= ITK_ok) report_error_stack();5 Y9 {8 z) F7 A- \$ g6 w! e4 m
else printf("Folder '%s' Saved; ", folder_name);
4 q. A/ |0 ~4 z; { F' [2 e7 H) F4 h- u3 T! h& L
status = AOM_unlock(new_folder);
6 N" n) T% T0 _" j, u if(status!= ITK_ok) report_error_stack();
7 a/ d/ A& Y, Z i3 P% Y else printf("Unlocked; ");
- B+ u# k- }# T# W# V# Y# F7 a4 w A, t+ w9 ?! t
status = FL_user_update_newstuff_folder(new_folder);- c) n& l- b9 ]/ w h
if(status!= ITK_ok) report_error_stack();
( Q2 i; Q. j- a7 Y N else printf("Put in Newstuff Folder.\n");1 N3 `' B3 z8 R
9 A) W7 s5 R5 |7 o1 M& U
ITK_exit_module(TRUE);
% ?: C3 D5 R6 K return status;
8 u8 z: f' v1 N- v* {}# U- q5 U V ^
|
|