|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; X% c# A3 h: f. V# F- T1 F+ G/ A
* L4 t2 s2 S; P+ P2 mTeamcenter ITK二次开发源码分享:创建自定义文件夹
( u: J& r y/ x- I3 N输入的第一个参数是文件夹名称,第二个是文件夹描述。
6 b( g: E! Y1 B) a7 R/ c0 J1 E4 e& s+ V6 d9 i4 h, \, |
: W e& A3 L# d7 G) J
#include <TC/tc.h>
$ _' Y" U+ }& f2 H#include <tccore/aom.h>. D+ ^. k# M# D0 ^3 S2 Q
#include <tc/folder.h>. K* S2 A1 ~3 q: x$ b9 D: |8 x6 [
#include <tccore/workspaceobject.h>
5 J; o$ v" g$ z" R% m# S% _0 W, D
#define EXIT_FAILURE 1& }, ~" o" }6 G+ R# U
! V( w5 Q: r5 C$ Q9 ?- Qstatic void report_error_stack( void )
D, ?8 Z1 f5 t) T0 k/ j) M9 _ {
# T0 _- L/ r6 k. q4 E: D# O int P8 h2 G! o) H" e+ s/ E
n_errors = 0,2 N* o) z2 K0 u: m
i = 0;0 }" B; D( J; f6 w
const int; K# r8 K' Z. p
*severities = NULL,
) P9 `6 B% j+ v8 y- {& W! P9 R$ Q; O7 a *statuses = NULL;/ H. x. g; s. X- |; g" k7 d8 Q8 o- B0 Y
const char
+ {! u$ ~- Z( z, D3 a7 q* o **messages;0 m- w* [, W2 \2 X T
\. [9 T7 Z. ~6 ~7 Y% `7 p
EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
. s5 i; W7 q# F J" | printf( "Error(s): \n");9 k! Z$ h j$ m4 P7 T. i- w1 \
for (i = 0; i < n_errors; i++)
" w; L+ o/ ^) Q: y" r* X {0 _' X j$ i4 q
printf( " %6d: %s\n", statuses, messages );
0 _" h5 c: ?6 Y' q. J$ j4 q+ \ } n$ x/ ^- g6 U& {9 a* e
exit(EXIT_FAILURE);: n" z- A; f: V3 q8 M- `6 v
}
0 ^0 c* O0 K" u+ j6 W
4 H. c" W S0 K' T' U! Y% \int ITK_user_main(int argc, char* argv[])
8 _4 M0 c, C$ s9 T6 [; V{% Q7 r' l5 H4 {7 t. V
int
7 k+ Y4 ]' H! ]5 Y8 G status;
# A* L' z* |* d4 e0 s; p( H char
% |$ ~5 N# C- b1 b* [' y folder_name[WSO_name_size_c+1],
. ?, ~' K! G! v1 i; E fldr_desc[WSO_desc_size_c + 1],, [2 }2 @2 P$ i
*message;
1 d4 `( s5 A+ N4 m+ \ tag_t
: Y* `. a$ E: a$ I* h new_folder;
- Y) a& e' d, h' d9 Q5 x# K- j* Z# n, w. F7 |+ k6 m( ]
ITK_initialize_text_services( 0 );
$ z* C( w8 T' U" X5 v status = ITK_auto_login();
0 ]/ g1 n3 b# `! L9 ^$ z if(status!= ITK_ok)
0 U% `6 z) w3 B {
" X! d5 b2 p( f) Z4 \) e9 J report_error_stack();% s" Q; l$ [' Z, N
}9 {7 k# r, g) n4 b( N, ?0 c/ ^
else) g1 _5 ?3 d; I; A' [
{) ~; L( A! e' ^$ M- U/ r
printf("iMAN login successful.\n");, [/ P6 c9 }/ k" R' E
}
/ L- Y6 Z1 v1 z7 P" L8 \7 ?, w2 v6 t) ]( s0 T& B6 q
ITK_set_journalling(TRUE);
# P4 V E1 z5 G/ d# S! ~( S# N4 [- ?& [
if (argc > 1) strcpy(folder_name, argv[1]);
/ I) R/ g: o) Y else
/ W- F8 h9 ` v1 i7 i- _ {$ c: ~) i5 t& q/ O
printf(" Specify the Input in Following format : \n");. h. K! ~' }) P5 [; _ R" ^$ U8 p
printf("program_name folder_name folder_description\n");" I# A! R9 V0 h/ w4 s& A
printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");+ v2 U3 u5 L/ {/ L4 R
return ITK_ok;
/ M! J' s+ U7 K' o }
! k q# b" o9 U
# s: F) C5 x+ _" z! D$ K- F* H1 I if (argc > 2) strcpy( fldr_desc, argv[2]);' v% v b. V9 ~& j/ j
else strcpy( fldr_desc,"");
3 V J, D' t! R0 |/ Y7 c' g
. _0 z4 \, q1 [! O status = FL_create( folder_name, fldr_desc, &new_folder);
: J ?8 k6 r" y if(status!= ITK_ok) report_error_stack(); & x, O( o# w( T' \7 q
# A7 N2 ^* ^' J4 \5 r
status = AOM_save(new_folder); c6 J3 y8 @' r; t6 D2 r, F
if(status!= ITK_ok) report_error_stack();4 d4 `9 b# ^- \6 P# l
else printf("Folder '%s' Saved; ", folder_name);
: N$ t3 R( W. [1 e% F5 r
( Z, q3 q% K: G% C# V status = AOM_unlock(new_folder);
- G, a+ X: T* x3 u4 J2 ~* v if(status!= ITK_ok) report_error_stack();. o9 k1 L) w2 ?; b3 R E3 c
else printf("Unlocked; ");/ g; m4 E( o" W/ T
+ C2 U4 I* i ?/ Z/ B
status = FL_user_update_newstuff_folder(new_folder);
5 y8 F# l7 l" z5 C* J7 i9 \ if(status!= ITK_ok) report_error_stack();) P7 |' M$ c5 P7 |) Z8 f7 x0 L
else printf("Put in Newstuff Folder.\n");
( Z+ k% G# Z% J# C
7 G& E8 [1 h) T! ?' M* l ITK_exit_module(TRUE);
* S' ^+ P" H0 {: }$ P3 G8 A! x return status;
" T7 I, S$ w& j) q3 w0 P$ N}
# {8 b2 j8 A6 L7 Q& j7 q2 x1 Z$ A |
|