PLM之家PLMHome-工业软件践行者

teamcenter ITK二次开发源码分享: 创建一个工作流

[复制链接]

2014-1-15 19:30:29 4935 0

admin 发表于 2014-1-15 19:30:29 |阅读模式

admin 楼主

2014-1-15 19:30:29

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x

+ l! g8 V+ b! q0 q2 LTeamcenter ITK二次开发源码分享: 创建一个工作流; R- K, W0 B& ]/ w. }
2 L8 B! m5 @& k6 m, l: r
  1. /*HEAD CREATE_A_PROCESS CCC ITK */1 N2 q9 b1 ~1 S: k" C
  2. #include <stdlib.h>8 U+ l5 d) Z: V  W
  3. #include <TCcore/aom.h>$ P% d! J3 L, }1 U  D
  4. #include <tc/emh.h>
    ( {' e1 }6 G% @
  5. #include <epm/epm.h>
    ' }) d+ O5 f* w/ n  l4 @: o
  6. #include <tc/tc.h>/ r' r$ ]. Q! D/ x- z
  7. #include <sa/tcfile.h>
    1 ~2 i0 w6 _" l* H
  8. #include <itk/mem.h>
    " y& {" {2 d" M6 I0 a0 l
  9. 6 M4 K$ J' L* W& w% Z/ u' a# s2 u
  10. #define EXIT_FAILURE 1
    * b8 }/ d4 `$ ^( ?- \  X8 y6 H
  11. #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X)))$ w1 i8 T* i( G1 l+ W5 h
  12. static void report_error( char *file, int line, char *function, int return_code)+ k' J' m4 t; F1 F8 [
  13. {
    / n; x$ O- a% S5 ^
  14.     if (return_code != ITK_ok). w- z" ~% K9 l; p% F! j$ g2 H- s
  15.     {# Z. Y! s" Y$ @3 i/ ^/ r* |
  16.         char *error_message_string;: }8 P# u7 c, M
  17.         EMH_get_error_string (NULLTAG, return_code, &error_message_string);2 [6 s* R# }  c3 B" c& l& ?
  18.         printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);9 l) w. @5 t4 U+ U/ {, \! i9 g4 G6 ~9 w
  19.         printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line);  o& H; a4 a- {
  20.         if(error_message_string) MEM_free(error_message_string);
    8 k' @0 }6 U& q$ I. ~; q
  21.         printf("\nExiting program!\n");0 F. N% f+ O8 y. T5 }/ Q
  22.         exit (EXIT_FAILURE);    3 w; S# S+ K% q0 k
  23.     }+ E" F3 F; R) g! a; ^- k# q
  24. }0 k$ L* \' e2 J/ r
  25. 1 h1 O. J  i1 D( P9 T+ F
  26. #define EXIT_IF_NULL(X) (check_value(#X, (X)))
    / {) z% f3 v- Z
  27. static void check_value( char *function, int value )* t/ }% {( I- O9 s+ }2 {! F1 q4 w: Z
  28. {
    ! ]- a" Y8 Y1 z  _) @- E
  29.     if (value == 0)
    4 `  w1 ]8 v& A/ j# k/ f$ b
  30.     {
    & S) q  F& o5 k2 M2 h! D: h& E* _9 e
  31.         printf ("\t%s is NULL\n", function);, Y. m0 M4 Z9 N) e. h8 Y
  32.         printf("\nExiting program!\n");! `) J8 l/ ?. o5 m' [7 O! \
  33.         exit (EXIT_FAILURE);    2 ~( a) w& c! c5 Z0 R
  34.     }4 @: W2 P1 f8 B2 _( ]* N
  35. }2 e  s* A% h; ]  R4 P6 p4 Z
  36. 7 `% |" ~  y+ B1 k; T

  37. . d, |9 |- @7 p, A7 @
  38. static void do_it(void)% G- }/ w, ?7 v( g
  39. {2 W9 U9 g- w5 g$ u% T- ?
  40.     int
    / n( k; R4 J- k/ v2 z; K; j( L4 b8 z
  41.         attach_types[1] = {1};) Y' R' @) T* J# w) W
  42.     tag_t " l* S! J7 y1 V/ J! m2 v/ x
  43.         rev = NULLTAG, - ]( @2 ~) g+ a) x/ p. B/ @) m
  44.         process_template = NULLTAG, . b# M1 W3 g, u2 j5 ^/ g# I/ e
  45.         process = NULLTAG;
    9 H" f  Z2 g+ W' z

  46. 3 t# w" p  w: H2 W/ @
  47.     ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );% Y# v4 i" A. D$ e- r
  48.     EXIT_IF_NULL( rev );
    1 D7 t) {, N& X, j6 c
  49. - p. T" M% `* [7 h& n- L4 Y% X. @
  50.     ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); ! r4 v( E( V# G! x
  51.     EXIT_IF_NULL( process_template );: x* A: [! E) P- w3 J
  52. # |2 n4 R! k. o& r, y* ]
  53. ! O2 {5 e: ]) o8 \1 }
  54.     ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev,
    # G- v. M, B9 x  r6 C
  55.         attach_types, &process) );3 |# Y! V8 B) W8 X; U0 y

  56. 3 f: ^. z9 A0 W2 q
  57.     EXIT_IF_NULL( process );
    $ E( `% ~4 J: S! g, b
  58. }* H$ h5 ?; P. i6 I
  59.   T, g$ P1 }+ G  ^' ~+ A5 p9 |
  60. int ITK_user_main(int argc, char* argv[])
    ) @7 h8 ^5 K, k5 f! X$ V; ]
  61. {. {: T* M+ G$ G7 `: s. ]
  62.     int
    , x+ |4 d9 `' i' K% ~
  63.         status = 0; ( w/ _7 U% {0 J6 T
  64.    
    1 g! M. }4 R/ h- M: t
  65.     ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );
    + d: B5 D8 |  X' o
  66.     status = ITK_auto_login();, s8 \/ Y: z) x
  67.    6 U) _+ Z' G! a$ n2 y5 g
  68.     if (  (status != ITK_ok)) printf("\nLogin Failed!\n\n");
    1 g) V! u( z% n" c" _0 [4 B
  69.     else
    " L) L7 b: }  E( B
  70.     {
    9 k/ E  A% i  Z4 k/ x4 V$ k
  71.         printf("\nLogin successful!\n\n");
    , v+ \2 k8 }4 y* G: P) e
  72.         ITK_set_journalling(TRUE);  V) D7 [  |* m# ]- E
  73.         do_it();
    # u3 _+ t/ ?2 R2 ]& M
  74.     }
    # c/ P3 k0 R, v) F. ^- [
  75.     ITK_exit_module(TRUE);
    + s1 C3 Y0 d; }7 l- m: x) g
  76.     return status;
    ( K: W  t6 i+ W2 D6 Y
  77. }
复制代码

9 P% h. Q5 c3 j
; Q9 A% [0 E1 J% W4 R, o# h, B- h% M1 v5 B$ ^8 g5 o
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了