查看: 5990|回复: 0

teamcenter ITK二次开发源码分享: Item 创建 createpost操作

[复制链接]

4

主题

3

回帖

44

积分

管理员

积分
44
发表于 2014-1-15 19:33:29 | 显示全部楼层 |阅读模式

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

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

×
1 R4 ?! Q! p3 ~4 L# L. u0 I5 ]: X; O
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
; l% Q% a9 Y# F. @
  1. #include <stdarg.h>! n) l$ g# W# u+ y
  2. #include <stdio.h>, |3 H; [8 _  G& c6 J+ ]+ R& v5 e
  3. #include <stdlib.h>2 s9 Z  a( q4 R( o
  4. #include <string.h>
    ' m; n) x  B5 Z2 U, b* I9 d
  5. #include <UG_va_copy.h>6 L. I4 p7 g/ E* D
  6. #include <TC/emh.h>
    7 _; w% V. [' n2 o  E; ]( d7 G
  7. #include <ict/ict_userservice.h>0 t; ?1 i% \3 L( m. I, ~. L
  8. #include <itk/bmf.h>8 P0 x2 j" N$ x8 e2 |
  9. #include <tc/emh.h>
    / s" }, h( B8 g
  10. #include <tc/tc.h>( N" k0 @2 Y9 j$ D2 ~0 I
  11. #include <tccore/item.h>
    # i( L: o2 W' Q- N/ c/ F! {: p
  12. #include <tccore/method.h>; B1 O$ o2 g# b. Z1 X  |% H
  13. #include <metaframework/CreateInput.hxx>9 L/ U( P9 X3 I/ N8 z, A, r4 `, p

  14. 0 _% ]) b  i  y& F( t4 H+ ]
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    / R) e( j/ M, o5 B, `- q  y& n
  16. {
    ! C! `' B1 M; a6 L
  17.     printf("\n\n A2_gtac_extension_rule \n\n");" t. q4 O! i, \* j- `

  18. 7 J% Z' `7 N- M) X1 O$ z/ R
  19.     int ifail = ITK_ok;, K- _3 L  r; S: l1 ?
  20. # @7 n4 I3 Y' u4 `$ d8 s
  21.     va_list largs;% }7 G( Y8 c0 {
  22.     va_copy( largs, args );4 H9 i) `) {5 K  A8 [3 y) u
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);5 O9 }; }+ @4 I% u& `$ C
  24.     va_end( largs );
    " P- Y- {, i. N& z/ ~) s" ^
  25. " O5 q" V; O/ n
  26.     tag_t new_item = m->object_tag;   
    7 \  i0 J9 p$ e$ O. o2 l  r; ~! Y
  27.     char *uid = NULL;
    1 |  B; ~% R* t- j: H( }8 ^
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    ( y2 h4 \) D( h: A) z+ ^+ x
  29.     printf("    new_item: %s \n", uid);. B) n! U" f" g
  30.     MEM_free(uid);: A, g. L( ?3 x# }. h: L9 }# n

  31. 8 s/ e8 C' M( u) U/ F- C

  32. ' n8 P" ~" M6 K1 h
  33.     bool isNull = true;
    . A. Q1 X& j$ g- m4 {! J
  34.     tag_t new_rev = NULLTAG;
    ' `6 V. F2 [+ E3 Y
  35.     ifail = creInput->getTag("revision", new_rev, isNull);$ H* q! \- g' i# j  \2 S7 l
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))3 T/ e, h7 o- t; g7 H. w, e
  37.     {
    # I* c5 l7 T4 c: z3 [
  38.         printf("    new_rev: %u \n", new_rev);9 y# Z3 J3 P: X% o
  39.     }. o+ Y7 k( p# R
  40.    
    - a9 W% t$ [9 U% f. ]# x
  41.     tag_t master_form = NULLTAG;3 g8 V+ e* S. }* _+ q
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    - {$ i( h( T- S) x
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))' ]- i7 }: U9 ~+ g$ C; a0 L! R  v
  44.     {4 V9 J3 a% L( z+ a" I8 ~/ a
  45.         printf("    master_form: %u \n", master_form);
    # B/ |0 S1 E. F
  46.     }9 U7 A  U% L8 M: I9 r9 w

  47. 1 V; G: U4 c1 w0 z3 r8 c3 v
  48.     std::string item_id = "";
    : q9 S/ R* ]2 D& t4 z/ R, j. I' _! p
  49.     ifail = creInput->getString("item_id", item_id, isNull);9 e- [$ Z  O/ H2 d/ p, @
  50.     if((isNull == FALSE)&& (ifail == ITK_ok)): l) j# J; k  Z, A$ U5 Z: i" x
  51.     {+ [1 P6 r$ Z( G. {& w
  52.         printf("    item_id: %s \n", item_id.c_str());+ A* T$ W4 G( o8 f, j3 Q
  53.     }
      E6 z- \9 D8 o2 f* e3 q

  54. & c! s# J9 ?' z' x
  55.     std::string name = "";) O: U' }! b5 U! y* \
  56.     ifail = creInput->getString("object_name", name, isNull);
    ! S3 }6 S5 w: d: U3 U
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))9 _) Z7 N8 n& \6 W! R0 t6 h
  58.     {% [+ [6 x, P; y% @8 [
  59.         printf("    object_name: %s \n", name.c_str());; i! k+ e7 b, J0 n) E+ ~' S1 ]7 j
  60.     }5 E0 h7 d0 J8 g4 ^  W0 @" x9 O
  61. : M) p& O' [; {8 [
  62.     return ifail;;
    / i2 {. l$ @8 s, g3 ^% t
  63. }$ K  j" @" w6 q+ y& g9 ~. _2 z6 W5 ~
复制代码
! T7 ?9 C. @8 g. h
' O+ I1 A3 z5 N$ d2 e" r

. T9 F) \4 O; f' t7 [9 W( p1 S
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部