|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 X- e" c7 v3 ~' ]+ BTeamcenter ITK二次开发源码分享: 创建一个工作流
9 N/ o. K! F& Y: e
0 P; p% {! F+ `( [ w+ \- /*HEAD CREATE_A_PROCESS CCC ITK */- }$ @. E! ]2 f9 k& z& W
- #include <stdlib.h>
) ]9 R$ o6 _5 x5 f - #include <TCcore/aom.h>
# F9 C" ?9 P N8 f. f+ j$ Z - #include <tc/emh.h>
7 Q+ H1 W' K0 l" D4 Z4 Q. ] - #include <epm/epm.h>
" N# Q# X2 a. z1 f- T4 k - #include <tc/tc.h>
3 h$ T1 {4 n1 d2 d - #include <sa/tcfile.h>. P/ P$ Y' w/ C
- #include <itk/mem.h>
7 o @) P6 v9 H: ~7 w5 i" r/ M
( G4 I- P5 `9 _' O- #define EXIT_FAILURE 1
$ a1 L9 U. {* ^ - #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X))). }) A+ U' a7 [/ y" B& g7 m
- static void report_error( char *file, int line, char *function, int return_code)
6 | b# g2 a4 \ _0 E - {7 q7 N% e5 R8 o* I% U7 e2 X
- if (return_code != ITK_ok)
2 w6 X. f, b! g' i! y - {; z2 H9 o1 A) e' y7 @; F M! V; a
- char *error_message_string;' Q& Y) P) K6 ^" G4 z
- EMH_get_error_string (NULLTAG, return_code, &error_message_string);. F4 c) j: M+ g( c$ q6 i" u. d! T
- printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);
6 o2 b8 G) d* t2 Q+ h) @4 z% J - printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line);2 b/ ]2 U' w. g! _
- if(error_message_string) MEM_free(error_message_string); c c: L* e$ s5 ^
- printf("\nExiting program!\n");3 Z6 _& L0 ^8 v9 h; |
- exit (EXIT_FAILURE); - n, a1 ?5 b8 \% w& ~6 a! @" {
- }8 B* k' ~5 E. B4 O
- }! p, _( R. v/ r c" G
4 u( w$ _$ `, A X$ U1 V: Q0 t! ~* Z- #define EXIT_IF_NULL(X) (check_value(#X, (X))): z! l! `( X3 C+ R* Q
- static void check_value( char *function, int value )
/ P" Q2 ?5 f7 _* N4 l - {
& T: n( T" I f& p) Y' a - if (value == 0)2 E4 |/ ]. F$ W5 t$ s* {$ L& {
- {2 h, U" n y4 t5 G
- printf ("\t%s is NULL\n", function);& i2 q. [4 U ^8 v l2 w" j- O
- printf("\nExiting program!\n");9 g: U# P9 z/ K1 E0 ~0 b
- exit (EXIT_FAILURE);
, d" |4 w. u3 U) f - }4 D+ {. y6 O4 M" I! T$ i
- }2 n+ g5 {' R' j) C: X
7 L6 Y8 E- {" \* i3 B" |- 7 [* f4 O2 Z, w: u s/ ?. Y
- static void do_it(void)' g7 u0 k. t+ L o
- {( h0 B7 l1 s0 _5 e& N
- int
* T" L8 G( T/ t- I/ B t1 [ - attach_types[1] = {1};/ i* A) d- H* I% s4 H: I) S/ W7 y
- tag_t $ U2 V8 A% a* t
- rev = NULLTAG,
9 P- _5 r" h N - process_template = NULLTAG,
8 S) B5 ]3 W3 w+ [/ y! A - process = NULLTAG;! F8 L2 B% v/ o2 N. w+ U- g i
) |4 T! A& J" [ B! \' U- ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );* y% G3 j* n0 l0 U, @
- EXIT_IF_NULL( rev );
6 B( H' M) c3 j u9 d! t
3 S: G) E" Y7 ^9 M- ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); ! s* W, q( k* q9 R6 P" b/ e
- EXIT_IF_NULL( process_template );
5 Z4 _( B/ B. E# I- A8 h
$ @& R9 y; ^5 y" j
$ _3 }5 Q9 [* ^# H- ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev, ( F5 |9 Z# V' R. ?
- attach_types, &process) );# n6 T0 r9 p8 W4 M! X6 p a7 `
$ Y5 q8 V8 l' S8 Z6 k- EXIT_IF_NULL( process );
$ h! m! o- P1 ~ - }% y" L+ p. m' s0 p0 J" \' }$ o9 ~
- ! i7 Z' g4 o; W$ n: \& i
- int ITK_user_main(int argc, char* argv[])5 Y1 M6 Z. A5 O7 H
- {% I- j9 O& I9 P: v
- int
& j h6 B( p0 g% U - status = 0;
4 i; |( F: ^" f/ S -
, I2 x _9 ^4 o/ U3 q S - ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );
2 x$ R% E; O- x O- e i - status = ITK_auto_login();; Y+ ]: P% Z0 |- {; J6 c5 g
- ' {) B7 q5 i' J: W" |
- if ( (status != ITK_ok)) printf("\nLogin Failed!\n\n");
5 B" z7 v1 p n0 g% F7 ~0 a8 W' N/ C - else% U# S( q, P$ l+ ?/ w
- {/ F& W5 |7 K/ {) t
- printf("\nLogin successful!\n\n");- C: `8 q, y3 m+ l
- ITK_set_journalling(TRUE);" u+ _1 ~- q# a* w
- do_it();/ r; F9 @6 d8 w: A7 ^! z
- }
1 x& y8 q W+ ^ - ITK_exit_module(TRUE);
/ z% j z# y" d8 ^ - return status;" B6 N7 X0 x. l7 b3 Y. ] ?% v
- }
复制代码
# A- M, S3 I1 P' W8 E
% d1 v$ ?* j: D2 T" a
$ n1 k+ w6 ~' P |
|