|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) _. X. X! V4 V+ WTeamcenter ITK二次开发源码分享: 创建一个工作流
7 U! M- [1 g) C4 ~5 a. B, g1 F. _! `- d; Z
- /*HEAD CREATE_A_PROCESS CCC ITK */
7 T2 W( ^7 ` j/ w/ o6 h - #include <stdlib.h>
0 B% L+ V% z, b, y1 `! @" X - #include <TCcore/aom.h>
$ O$ W0 h% R* p4 ?. U2 s - #include <tc/emh.h>( \# G* w+ `2 r
- #include <epm/epm.h>( w; K0 Q1 D5 H ?; ^
- #include <tc/tc.h>9 B% o5 P' U( b5 B
- #include <sa/tcfile.h>7 O9 S( R+ C. a4 r
- #include <itk/mem.h>
* ~2 ` D7 _2 o0 |9 b! T2 E - & b- L) z7 p0 M
- #define EXIT_FAILURE 1 - b, Z9 j) D X+ L
- #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X)))2 F" K$ l6 O0 B8 P$ v$ a/ \! E
- static void report_error( char *file, int line, char *function, int return_code)1 ?+ u+ x |6 e
- {
; ?* @4 q. ^' [! T - if (return_code != ITK_ok)8 _& ]) r! r, B' g
- {3 W5 z- w& P# v' {. M) I
- char *error_message_string;8 l, [* N1 }7 C% G
- EMH_get_error_string (NULLTAG, return_code, &error_message_string);. s% |0 x% ?/ }# R
- printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);1 H2 J: v) K" _4 S- `( H" X
- printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line);
6 D+ u! [; j! q& V1 v, k - if(error_message_string) MEM_free(error_message_string);5 u7 Z4 X( p2 a2 e" {
- printf("\nExiting program!\n");
/ B' ~7 L" u: d" v( v% b5 ?. ?1 h1 _ - exit (EXIT_FAILURE); 8 E2 u" n" }7 X; v
- }* H; g' P) T7 e0 ^6 H
- }
9 u$ g9 U9 H' q: T& k! t5 K2 a - 3 o; d- J1 O/ _" Z# z- G) i5 T- F
- #define EXIT_IF_NULL(X) (check_value(#X, (X)))9 }: g0 S3 t% K2 t
- static void check_value( char *function, int value )# ?7 ^5 D" p0 a* Z, a
- {/ A: B5 g7 r j9 y' t! _" h# v
- if (value == 0)
. v) } F; u8 F: m+ H& n - {, Y% [: d3 C0 H6 H
- printf ("\t%s is NULL\n", function);
" z. ^) g( }7 h* r5 \' w - printf("\nExiting program!\n");
, j4 r% Y. w4 d. K8 t. e" z - exit (EXIT_FAILURE);
7 k5 u4 f9 \4 u) m - }, R7 y! i5 D$ I
- }
2 [# m0 W9 e! c
2 y0 Z1 Y0 I% ]5 A
) {: W7 l, z1 M, k- static void do_it(void)6 M9 k2 ]1 u Q8 u Q
- {
5 U- t) z8 R/ K t: q2 l - int ! V/ l' |9 K8 T2 U8 J5 [, K1 S; ^7 ]
- attach_types[1] = {1};( M$ ^9 ]) |' `% M
- tag_t
6 ?" N) K8 A$ U" i! L0 A - rev = NULLTAG,
; f( f$ g) G) i% P - process_template = NULLTAG, " c; M! _: I( r' o7 K* V$ t
- process = NULLTAG;+ b* X. ?, p- e7 C) R# c
8 h: @2 |5 ?0 Q2 s" r# P$ n) _- ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );
$ \1 N5 {# a$ M/ e; p6 a! V - EXIT_IF_NULL( rev ); u2 \7 b+ c) _. Z" E3 E
! N6 x1 c, E% h; g0 {7 u! ~3 n- ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); 7 o2 c4 o9 h$ F1 R. a; t
- EXIT_IF_NULL( process_template );
( ~& e& A' T+ [8 ?' M3 ~, g - ) c( k' [5 u9 u/ u* ]1 O
- + i: \# b3 Y, Y
- ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev, 6 t! P' v* ~" g% B$ ^# x' A
- attach_types, &process) );
/ s3 ~! b9 U3 d" i
. Z0 D$ o/ f. L1 Y3 t- EXIT_IF_NULL( process );1 a& n3 V2 [5 {
- }! R# Y; Y. s# i
- 4 H4 g7 N% I% w; Z* Z& h6 r, y
- int ITK_user_main(int argc, char* argv[])
) W7 H& H# R0 m$ C9 T - {% {2 d4 u/ |$ b6 B/ `
- int
- S4 r& T( o \ - status = 0;
9 |) V3 o0 r8 j6 q9 d* z& C - * R5 C7 a( I. w1 F9 L: d
- ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );+ a5 S3 J6 S- ~2 r3 R" I0 e' G
- status = ITK_auto_login();
. o0 i# e/ H1 B9 H, I% N' Q - $ F* i" ^' [8 v% | {
- if ( (status != ITK_ok)) printf("\nLogin Failed!\n\n");
+ x* M3 O8 b7 |3 P- M! E" d. K/ N - else0 _1 c9 s# ^2 p
- {) K0 E/ ]8 F% _2 A. Z0 f
- printf("\nLogin successful!\n\n");) j7 T* L" l" D+ @) j2 O1 P5 T
- ITK_set_journalling(TRUE);
) \$ X- l& _8 l* | - do_it();. o- Z( u7 s, f5 B
- }
! \1 O$ j! O2 ?& I; m7 q) ? - ITK_exit_module(TRUE);
+ K! S- B. ]" @- r, w. X* ~ - return status;7 S4 |9 u8 ]; m# q: K7 B2 J; v
- }
复制代码
, A* H; \1 n9 J
* Z' |4 w: S4 S9 E# A+ h5 M7 \: l! M+ E3 M( N0 V
|
|