|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 F8 g# s6 h* z* K( v; M3 |8 i- s; b
. i! P/ w9 c5 _, N( R: O0 JTeamcenter ITK二次开发源码分享:创建自定义文件夹- A2 ]! z5 c8 B% o2 i0 d) c
输入的第一个参数是文件夹名称,第二个是文件夹描述。# K, C6 S0 ]6 {. d; o- a
$ R) e* o8 `2 }
5 F6 i# a2 `: G r* a& n% q#include <TC/tc.h>3 b- n" r" M& I
#include <tccore/aom.h>3 m( C- d" W' [* J
#include <tc/folder.h>( Y. R1 X& [4 U- X, ~
#include <tccore/workspaceobject.h>1 U- x' A' }( [; Z/ E# p5 S. |+ y
6 V) I" c( ^4 J& w#define EXIT_FAILURE 10 t6 [0 \, c6 O( y
# h2 G' W1 }2 ^( q
static void report_error_stack( void )
5 T) N0 Z. L* G: ~ {! L* S6 y# U5 [1 z: w% j+ |3 E
int
5 p/ [& A) B u4 ?! j5 ~ n_errors = 0,
6 m0 L5 n" F, ?' H& n2 F5 F! y i = 0;- t0 J0 H3 K* _4 @) M! r
const int; b, R* z& W, _1 s+ ~
*severities = NULL,
" c W& t' {& V5 ^3 ~1 Z" e *statuses = NULL;" M6 d6 ?) x/ O9 g% ]2 n
const char# ]1 d$ d5 E2 r
**messages;
# w2 I% ~2 j$ C! @1 r/ h" @ ]: Q0 ^5 a2 v, k6 u) }' F
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );) D! E. q F2 F+ s3 C, V* }
printf( "Error(s): \n");
5 w* r2 }) Z8 q7 ?% C( D# X for (i = 0; i < n_errors; i++) ; s5 z; E* C; b. R
{
4 y6 W4 K. I7 g8 T printf( " %6d: %s\n", statuses, messages );* p- L2 _6 |' ?9 Q! d7 }
}+ T% }2 @$ J+ K, a+ h
exit(EXIT_FAILURE);
5 {1 u$ z" m& h1 C }
, a( b, T$ A! `) P$ h1 E, i) @
4 f5 t& b% n% Aint ITK_user_main(int argc, char* argv[])
4 g# K+ \! V3 `0 [- B; g) T$ S{6 u) Z5 h' N, U' B. J
int- v, a4 m+ V+ r* [0 H
status;5 _& K+ ^* l/ U0 s5 B! I( P" h( M" i
char& ?, E6 P7 x# w2 u, h0 S! H, L0 p
folder_name[WSO_name_size_c+1]," @ g! Y7 X9 S8 A Q# h3 G
fldr_desc[WSO_desc_size_c + 1],
8 Q1 j6 m: m# j7 w5 b *message;% j2 N* x+ q) l4 y( v
tag_t# q3 z; g! o% b) g# p
new_folder;' g0 ]* X0 ~/ X8 W
0 [4 w# L( Z \8 v ITK_initialize_text_services( 0 );
( {- u2 d+ e& B c8 H/ E status = ITK_auto_login();
9 x% e* C, m: h6 ~6 O# h$ R" f4 d- e if(status!= ITK_ok); P& |8 Q3 N% @% }
{
+ h" _! U" W, s- b7 ^( Z report_error_stack();# {4 W) z1 S2 e7 b
}
, D* d4 ?7 b$ N else
. E- k( [! r' r1 B {7 J5 }0 B$ |0 _/ q# z
printf("iMAN login successful.\n"); ?( R5 `3 K% y
}
2 a- T! ]& ~/ G8 o3 m# {
- v2 ~, j: P* B5 I* s! n1 h# k ITK_set_journalling(TRUE);% F" |* S3 O$ r$ J8 ?
3 x3 I9 r7 E# l) p2 [5 [0 L, D
if (argc > 1) strcpy(folder_name, argv[1]);- [0 p% M+ [8 Q q& F
else8 C* P$ ?( J& I$ j1 F, a$ i/ V u
{
6 L9 v) ~: C% B$ |3 a% i& J z printf(" Specify the Input in Following format : \n");4 u0 Z; V E& I* }3 X0 z1 [) [
printf("program_name folder_name folder_description\n");
* b. z. n+ S* t printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
/ y9 U- y) n8 d7 y% }$ I4 P return ITK_ok;
# K7 r' g7 q; R+ ` }
8 G; T1 r+ m; L% {. f5 g' d1 u
7 ]7 J7 v5 ^, y7 C if (argc > 2) strcpy( fldr_desc, argv[2]);
2 h3 V# j0 Y. G) g7 C7 [/ I* V+ ~; y' D else strcpy( fldr_desc,"");8 {3 O2 x* X( c
0 p* b; d$ F/ K6 z$ @
status = FL_create( folder_name, fldr_desc, &new_folder);* V6 \/ ?& c& G' y
if(status!= ITK_ok) report_error_stack(); 3 k3 }* r% |: `! x( {2 M
- h+ n Z- a% @) _6 t: t
status = AOM_save(new_folder);8 a2 J/ A+ Z' E, @& a
if(status!= ITK_ok) report_error_stack();3 F, K, | ]- R3 j% L) x0 `. A
else printf("Folder '%s' Saved; ", folder_name);
2 v. X* H1 ^" r
! M" [# F3 t* D, Q# c1 I- J2 X$ \ status = AOM_unlock(new_folder);6 a9 m& \* Q: @4 T& Q( i
if(status!= ITK_ok) report_error_stack();1 K- k2 R5 O; U) Y: S0 L- p3 W h( G
else printf("Unlocked; ");6 y8 [+ L K( k) A3 ]5 b, Y
* A, R; H* |9 k6 l4 U
status = FL_user_update_newstuff_folder(new_folder);8 d( k: S% ], y6 b& t) m
if(status!= ITK_ok) report_error_stack();
+ ?8 j) c- ]& j' Y else printf("Put in Newstuff Folder.\n");
" {& h; I, _: L+ z# O/ S; u
2 y& g, a3 ]* K6 q/ J* x1 K% p; b ITK_exit_module(TRUE);
! ?- A1 C7 W# f" A, h: F4 ` return status;9 e/ g# L* q7 Z5 g7 A; q
}7 e' R! C4 f v' m/ X% L) B
|
|