|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; I, M2 u6 s/ @4 p. [ M8 |Teamcenter ITK二次开发源码分享: 创建一个工作流( |, C9 V+ k2 t4 G# W) @
6 I( d( g+ h0 B& ~
- /*HEAD CREATE_A_PROCESS CCC ITK */
* }; l2 l6 X2 }: K3 H - #include <stdlib.h>5 s/ |5 s) F! T8 }' i/ ^9 o8 _: t
- #include <TCcore/aom.h>
3 o8 R% P% g1 G: `! `1 P/ M. W, ~ - #include <tc/emh.h>
& u4 V; G+ d$ e) a - #include <epm/epm.h>( m5 j" m& E( Q/ `2 b
- #include <tc/tc.h>
0 `/ v5 W& ^- X w% f - #include <sa/tcfile.h>2 p ?* h1 G7 n6 a
- #include <itk/mem.h>
4 o4 C% k: C- S - 9 t+ l& d3 w5 E! G- Q# f* g) q
- #define EXIT_FAILURE 1 7 n5 H7 t; n( L/ ~6 m5 K' M4 S
- #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X)))
( f; P/ }7 X4 a A) a - static void report_error( char *file, int line, char *function, int return_code)
2 `* E( E. s0 C0 y( S; q) k$ l- S - {
, L; c+ Z; ^; I$ _ - if (return_code != ITK_ok)$ a, c; {1 C {6 w
- {
! ], p! p$ P" Z3 t - char *error_message_string;; `% J" z5 n' n& w* o: y
- EMH_get_error_string (NULLTAG, return_code, &error_message_string);# C+ E0 O! Y- Q E/ X/ R
- printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);
. Y0 W+ |; \7 j) s# P - printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line);5 {, q0 |% R, E" d: l/ }: ]1 m
- if(error_message_string) MEM_free(error_message_string);+ J* k! ?) r2 }: u, ?" ~# s4 \4 `
- printf("\nExiting program!\n");
2 }% f$ E3 h, v l8 { - exit (EXIT_FAILURE); # E6 I3 a' `; t% Q" d9 [1 [
- }( c( Q( f: r; o/ c, `1 F5 u
- }
. L3 }7 g1 N9 g) ^: _
+ p& Q; r8 k+ p M. R) l5 e+ @- #define EXIT_IF_NULL(X) (check_value(#X, (X)))
, ?2 Q" U! c, u; c. C - static void check_value( char *function, int value )
( p# t1 k2 w2 J j/ S& ? - {! T' V/ |" x2 ^
- if (value == 0)+ M1 |; w! h: L3 T
- {( o$ m! a' o( z4 i5 c! w; @. O: t
- printf ("\t%s is NULL\n", function);
/ y4 @; I+ i `0 W6 [% [ - printf("\nExiting program!\n");
; l6 H" L" H. R+ b' a% T - exit (EXIT_FAILURE);
3 G4 M; o4 X$ b* A" @ - }9 I1 H. I& A9 F# \' a# u1 |, b
- }
/ g) f) _6 f% K% k3 T, e
& t1 u2 ?+ C& S: ?7 c
. |! U. `: P* R& l- static void do_it(void)
& p; ^) Q F2 U - {
% |: I V( V: X3 y - int
& R* D3 f! T+ H% l8 ~ - attach_types[1] = {1};
7 n; h e z+ i" g7 F U: R8 M - tag_t " c2 e; u# v6 P
- rev = NULLTAG, . ]" g, Q- v' o% m z
- process_template = NULLTAG, 9 H3 Q8 \; q) e, Y0 `0 r
- process = NULLTAG;$ x+ t- b( ~7 T! r- e! k- J
- " V) K: U+ s. R Z; _
- ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );2 L( m# e! e5 a1 Y& }
- EXIT_IF_NULL( rev );
$ f. w t/ D! {/ a2 K - 6 H) L- P; T$ T/ m% C0 C- }
- ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); . }5 L [( x* v
- EXIT_IF_NULL( process_template );
. C/ i- \0 n* R - 1 p3 ~% [! Q9 J: K3 K
- , n2 }8 z7 v& L7 [, g* ]
- ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev,
+ n' ^' c0 L: q. Q6 \- A - attach_types, &process) );4 |2 ~& X. A9 |; K0 Y, n, w/ [
) F b8 o/ d' H- EXIT_IF_NULL( process );$ [5 `6 E) X g( o' r' y: f
- }4 s5 p* g4 I! R* i
- 6 O: R1 D$ s) q8 u6 _# e
- int ITK_user_main(int argc, char* argv[])
5 h7 L! Q; i/ H3 t( q0 S. X - { _1 @, n9 S4 i, j( c
- int u% C1 f0 d/ @
- status = 0; " \! L- H' |; D8 Y) ?
-
+ K& e* H" M: v, r8 V - ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );
9 w4 I* C& y% i. a4 q" b9 Y# v - status = ITK_auto_login();
3 C" s# x) }; ^- g d -
, ]) Z6 n! y8 F- ^0 o. x - if ( (status != ITK_ok)) printf("\nLogin Failed!\n\n");
6 g2 M6 B" q! [8 P: r x - else
6 d6 J+ y( z6 ]2 Q* d - {" k, R9 z2 K# X
- printf("\nLogin successful!\n\n");$ T; J2 N3 _) r! `+ ?& w
- ITK_set_journalling(TRUE);
! q) Y2 o# X9 Q( m3 K - do_it();
- Z+ E2 M3 G4 l" ]# I' P8 ^ f9 t - }
; b1 x5 {: Z8 ^- L; Y - ITK_exit_module(TRUE);
5 x) l* n1 Y& c/ z% C) Y - return status;* m: _, m5 e7 t6 V6 h
- }
复制代码 T3 g0 ]% M, ?( r0 H$ s
0 h- D' ^( C: A" X2 z
& L4 l8 e* P; @; Z& S |
|