|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ l! g8 V+ b! q0 q2 LTeamcenter ITK二次开发源码分享: 创建一个工作流; R- K, W0 B& ]/ w. }
2 L8 B! m5 @& k6 m, l: r
- /*HEAD CREATE_A_PROCESS CCC ITK */1 N2 q9 b1 ~1 S: k" C
- #include <stdlib.h>8 U+ l5 d) Z: V W
- #include <TCcore/aom.h>$ P% d! J3 L, }1 U D
- #include <tc/emh.h>
( {' e1 }6 G% @ - #include <epm/epm.h>
' }) d+ O5 f* w/ n l4 @: o - #include <tc/tc.h>/ r' r$ ]. Q! D/ x- z
- #include <sa/tcfile.h>
1 ~2 i0 w6 _" l* H - #include <itk/mem.h>
" y& {" {2 d" M6 I0 a0 l - 6 M4 K$ J' L* W& w% Z/ u' a# s2 u
- #define EXIT_FAILURE 1
* b8 }/ d4 `$ ^( ?- \ X8 y6 H - #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X)))$ w1 i8 T* i( G1 l+ W5 h
- static void report_error( char *file, int line, char *function, int return_code)+ k' J' m4 t; F1 F8 [
- {
/ n; x$ O- a% S5 ^ - if (return_code != ITK_ok). w- z" ~% K9 l; p% F! j$ g2 H- s
- {# Z. Y! s" Y$ @3 i/ ^/ r* |
- char *error_message_string;: }8 P# u7 c, M
- EMH_get_error_string (NULLTAG, return_code, &error_message_string);2 [6 s* R# } c3 B" c& l& ?
- printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);9 l) w. @5 t4 U+ U/ {, \! i9 g4 G6 ~9 w
- printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line); o& H; a4 a- {
- if(error_message_string) MEM_free(error_message_string);
8 k' @0 }6 U& q$ I. ~; q - printf("\nExiting program!\n");0 F. N% f+ O8 y. T5 }/ Q
- exit (EXIT_FAILURE); 3 w; S# S+ K% q0 k
- }+ E" F3 F; R) g! a; ^- k# q
- }0 k$ L* \' e2 J/ r
- 1 h1 O. J i1 D( P9 T+ F
- #define EXIT_IF_NULL(X) (check_value(#X, (X)))
/ {) z% f3 v- Z - static void check_value( char *function, int value )* t/ }% {( I- O9 s+ }2 {! F1 q4 w: Z
- {
! ]- a" Y8 Y1 z _) @- E - if (value == 0)
4 ` w1 ]8 v& A/ j# k/ f$ b - {
& S) q F& o5 k2 M2 h! D: h& E* _9 e - printf ("\t%s is NULL\n", function);, Y. m0 M4 Z9 N) e. h8 Y
- printf("\nExiting program!\n");! `) J8 l/ ?. o5 m' [7 O! \
- exit (EXIT_FAILURE); 2 ~( a) w& c! c5 Z0 R
- }4 @: W2 P1 f8 B2 _( ]* N
- }2 e s* A% h; ] R4 P6 p4 Z
- 7 `% |" ~ y+ B1 k; T
. d, |9 |- @7 p, A7 @- static void do_it(void)% G- }/ w, ?7 v( g
- {2 W9 U9 g- w5 g$ u% T- ?
- int
/ n( k; R4 J- k/ v2 z; K; j( L4 b8 z - attach_types[1] = {1};) Y' R' @) T* J# w) W
- tag_t " l* S! J7 y1 V/ J! m2 v/ x
- rev = NULLTAG, - ]( @2 ~) g+ a) x/ p. B/ @) m
- process_template = NULLTAG, . b# M1 W3 g, u2 j5 ^/ g# I/ e
- process = NULLTAG;
9 H" f Z2 g+ W' z
3 t# w" p w: H2 W/ @- ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );% Y# v4 i" A. D$ e- r
- EXIT_IF_NULL( rev );
1 D7 t) {, N& X, j6 c - - p. T" M% `* [7 h& n- L4 Y% X. @
- ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); ! r4 v( E( V# G! x
- EXIT_IF_NULL( process_template );: x* A: [! E) P- w3 J
- # |2 n4 R! k. o& r, y* ]
- ! O2 {5 e: ]) o8 \1 }
- ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev,
# G- v. M, B9 x r6 C - attach_types, &process) );3 |# Y! V8 B) W8 X; U0 y
3 f: ^. z9 A0 W2 q- EXIT_IF_NULL( process );
$ E( `% ~4 J: S! g, b - }* H$ h5 ?; P. i6 I
- T, g$ P1 }+ G ^' ~+ A5 p9 |
- int ITK_user_main(int argc, char* argv[])
) @7 h8 ^5 K, k5 f! X$ V; ] - {. {: T* M+ G$ G7 `: s. ]
- int
, x+ |4 d9 `' i' K% ~ - status = 0; ( w/ _7 U% {0 J6 T
-
1 g! M. }4 R/ h- M: t - ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );
+ d: B5 D8 | X' o - status = ITK_auto_login();, s8 \/ Y: z) x
- 6 U) _+ Z' G! a$ n2 y5 g
- if ( (status != ITK_ok)) printf("\nLogin Failed!\n\n");
1 g) V! u( z% n" c" _0 [4 B - else
" L) L7 b: } E( B - {
9 k/ E A% i Z4 k/ x4 V$ k - printf("\nLogin successful!\n\n");
, v+ \2 k8 }4 y* G: P) e - ITK_set_journalling(TRUE); V) D7 [ |* m# ]- E
- do_it();
# u3 _+ t/ ?2 R2 ]& M - }
# c/ P3 k0 R, v) F. ^- [ - ITK_exit_module(TRUE);
+ s1 C3 Y0 d; }7 l- m: x) g - return status;
( K: W t6 i+ W2 D6 Y - }
复制代码
9 P% h. Q5 c3 j
; Q9 A% [0 E1 J% W4 R, o# h, B- h% M1 v5 B$ ^8 g5 o
|
|