|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 B1 @0 Q% P8 E) R" c- m* _Teamcenter ITK二次开发源码分享: 创建一个工作流' l& t2 W5 k! d
+ V' n9 V$ N3 S. {: H) f" U- /*HEAD CREATE_A_PROCESS CCC ITK */1 J( a! ~4 [1 m) q. j' h& x
- #include <stdlib.h>$ k2 ~2 D1 O6 Y0 G
- #include <TCcore/aom.h>
2 g& ]( L, a5 s3 L5 b( r/ Z( h: Z+ \ - #include <tc/emh.h>
' W |$ Y" m3 U, s3 A4 c5 s/ D - #include <epm/epm.h>3 T" ^7 b6 D5 U# m5 A ]+ |
- #include <tc/tc.h>% i9 x% M/ f8 ]& E4 L7 ^) L" w
- #include <sa/tcfile.h> j- v; W+ }8 d. ~/ \9 o
- #include <itk/mem.h>5 ]1 s* p" l, t/ ~1 G
% T, s4 `* h/ G6 \. N- #define EXIT_FAILURE 1
# ^0 y# @! V0 P h% i - #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X)))
/ P" ]$ ]/ |( V/ A g: x% n' p8 t - static void report_error( char *file, int line, char *function, int return_code)
: ?; B' E- R- x- y! P* b - {
" x3 T: n8 l4 T* L- U+ J - if (return_code != ITK_ok)
; [' i- V1 [5 g7 V9 c - {
% d$ Z* Q- E' \" c/ b9 t - char *error_message_string;: H1 z! [% a) g$ T6 l9 C
- EMH_get_error_string (NULLTAG, return_code, &error_message_string);
/ z. [& z/ A$ S - printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);
, A9 R6 U# a+ \2 w8 c6 X - printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line);3 D ?3 v5 _6 T: x$ h) Z! x. a
- if(error_message_string) MEM_free(error_message_string);' ~, \. u4 B, Y
- printf("\nExiting program!\n");' U5 Y+ o( i" ~% J" |0 I
- exit (EXIT_FAILURE); 9 y9 y0 v# h/ A1 l# q; z
- }
6 S# Y5 H7 s% T6 [ - }
0 g' O9 @4 U2 g8 p0 x+ R* m3 h
: ^2 n5 K, `3 w- I$ T9 d- #define EXIT_IF_NULL(X) (check_value(#X, (X)))0 R3 ?- t' \& q/ M4 M
- static void check_value( char *function, int value )
) |" l% p* V5 G# J6 L/ J9 ~ - {, S [/ `, w+ b( W% K% l
- if (value == 0)3 t! a/ L# s. d7 c% x
- {
9 i! q- H* K: R9 S - printf ("\t%s is NULL\n", function);
2 J1 }$ r+ B8 @1 C+ B6 Y- Q3 r - printf("\nExiting program!\n");
2 o4 f+ f, o+ n+ I( Z5 k - exit (EXIT_FAILURE);
% d% S/ u u8 p/ B; Z$ V - }' Y3 A1 J7 P& b9 }- A% u- }
- }
9 g6 k6 G6 E7 l! e+ S2 z* S7 j
" E& [ A8 Y3 g4 J7 P. b
5 Q- f) @# x% j# `& K- static void do_it(void)
, V4 _* g% K: }3 j- D" D - {
6 ~! d! y" B# h1 g3 `/ X - int
& P$ W( F' p2 S2 U7 H - attach_types[1] = {1};. v m4 J/ y" _7 O- w" n# V' m7 t( s
- tag_t
/ M% [3 f2 X5 H1 h+ t b - rev = NULLTAG, 3 Y7 ?5 e6 U2 G7 z) T+ L# H
- process_template = NULLTAG, ) `( |* p4 I3 I* b+ C
- process = NULLTAG;% ]8 I$ _% U' ~
- 7 z" v2 ]$ ]1 w2 G/ u- f2 K$ d
- ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );
/ s3 z6 r) a& o# h" t9 ?9 `' P" f - EXIT_IF_NULL( rev );
7 n; C: `' }* `: y S3 I
4 V- e& w2 w# C$ x- ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) );
# a9 ~6 F5 E4 \1 J7 { - EXIT_IF_NULL( process_template );
: l D5 b0 d: o9 M9 w, v - ' R$ Z! P8 u0 W& j; g
- 9 \6 a& C: I5 W, W
- ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev,
( Y8 S' A0 {6 F2 ` - attach_types, &process) );
9 z% ^2 |" e5 O+ j' M6 d - + {# D& X R t, y- r, \
- EXIT_IF_NULL( process );$ P9 ?* s- [5 d9 V' u2 E
- }
+ \+ s- {- M9 `; m) @* z
8 L/ L3 }( F/ c! j3 M/ o8 ~- int ITK_user_main(int argc, char* argv[])
9 p9 s; a. K/ N) L - {
* V$ N+ ` Y/ H6 S% T) _' [/ Z - int
) t; i3 o; y5 a" a0 l3 n# x - status = 0;
8 s: s; N8 e0 K/ ]1 d' [ - & I6 Y$ r( z6 ~' A* C! q9 W
- ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );- B/ O! q8 ], ^! q% ^4 k: N
- status = ITK_auto_login();; r/ B* n3 L. {* i% @
-
9 b7 `: f- d: Y2 Z" r E+ D x - if ( (status != ITK_ok)) printf("\nLogin Failed!\n\n");+ ^. l! F4 U( o# N* U9 Y2 _* H
- else
+ g# z) C/ O3 Z- [4 M - {
- Z! X# g* q+ B% Z - printf("\nLogin successful!\n\n");) Q0 d; z a- N, x7 {3 d C
- ITK_set_journalling(TRUE);. u a* T; j8 t" ]- M/ v
- do_it();
. Y! X; x+ v1 ` - }9 t+ l |- G6 ^4 n: O# q( j
- ITK_exit_module(TRUE);! K1 o: {3 Z( T( d' e7 B) `9 Y) o2 u
- return status;6 e# Y) z. C1 i+ R: d! A" a, V
- }
复制代码 + i5 C0 q$ R8 E, I2 I A1 w9 @
. h* p% V1 T1 U/ ?
1 b) @3 T+ e9 v, c. V# a
|
|