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

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

[复制链接]

2014-1-15 19:33:29 5874 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x

3 n) f, R1 \. w& g) WTeamcenter ITK二次开发源码分享: Item 创建 createpost操作8 I; b$ c. V7 h$ h5 P0 V3 f
  1. #include <stdarg.h>
    4 g& t+ M2 P( T: V. n4 a5 E2 K
  2. #include <stdio.h>3 K  Z; q" ~! B: G7 W
  3. #include <stdlib.h>) \9 g, W1 e- V! v+ ]: N9 Y
  4. #include <string.h>+ ]+ I5 f1 ~8 M5 U# h* n4 s
  5. #include <UG_va_copy.h># [/ `( N6 [/ H
  6. #include <TC/emh.h>
    ! L' z- F. ], v7 b; o
  7. #include <ict/ict_userservice.h>( G. l* W# z; ~! B# ~' @( i5 m
  8. #include <itk/bmf.h>
    5 T/ m/ A7 m+ Y! O, ~+ e9 M' m
  9. #include <tc/emh.h>  g2 m8 D4 w8 `* Y8 h7 f" }. ]+ |
  10. #include <tc/tc.h>  ~# Z" j$ b) z1 C, ?) A
  11. #include <tccore/item.h>9 M) m! r; E  s" G3 \+ T5 H: t+ _
  12. #include <tccore/method.h>2 R1 x+ ~$ O- E; _( i
  13. #include <metaframework/CreateInput.hxx>
    & S$ ]0 B& f5 V$ J1 V4 D  q- D% i
  14. ' `. K0 N0 r( V- [! X8 R5 y: n
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)+ C1 D1 x/ f7 @, @+ n
  16. {
    # |, E+ f2 F7 Y$ b3 F  A
  17.     printf("\n\n A2_gtac_extension_rule \n\n");; c0 V( r" o. k- M2 b7 ^1 b& N) ]$ D

  18. : u) y1 N* O) D" g) [2 a
  19.     int ifail = ITK_ok;1 W! k! h5 w) s1 V

  20. ' S: x4 k! g* i' t: `
  21.     va_list largs;
      N% r" ~$ k- ^- j$ `1 t
  22.     va_copy( largs, args );3 t5 v$ R1 w' e( W5 Z7 N/ H
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    ) Z* U. ?5 [- I+ m, J) y
  24.     va_end( largs );
    6 c* E$ D. u3 L% |6 X' j

  25. 1 l) b: k/ Z5 j- S
  26.     tag_t new_item = m->object_tag;   
      R) |5 H  I: T2 Z  @
  27.     char *uid = NULL;/ [4 |# m/ _6 o+ i. G3 R8 d
  28.     ITK__convert_tag_to_uid(new_item, &uid);' J& d  P( {4 }6 z1 c7 M5 ^
  29.     printf("    new_item: %s \n", uid);
    6 K" J% X- G) ~) l5 a. {6 T: d; w
  30.     MEM_free(uid);
    2 L1 y+ e' y' h2 A

  31. - T4 j0 H. v0 `8 S6 R% b/ @# E4 b4 {/ b
  32.   H# x6 `. U/ {
  33.     bool isNull = true;
    6 S  e# G0 J  m7 L: L
  34.     tag_t new_rev = NULLTAG;: k* c" U# Z5 L
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    . [, g: U4 h( K- W( H  Q
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    - t+ K4 t2 |9 w& e2 {9 E; a
  37.     {
    6 z) a; @6 ?  c% X  E9 {  H3 F
  38.         printf("    new_rev: %u \n", new_rev);% v9 [7 |$ t5 v- R- G
  39.     }
    . t: ^" z/ p4 B6 n
  40.     $ O. p+ q* ?$ ]' A( r( x( {
  41.     tag_t master_form = NULLTAG;
    8 U: t5 q! O% X, ~
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);2 H! U/ d% w7 u8 ?& V# l# ^6 J
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    5 B4 A6 v5 o# o
  44.     {5 _! l" M5 U  \  a5 P' r
  45.         printf("    master_form: %u \n", master_form);
    7 b. k5 }& d! K! w' t
  46.     }
    0 j" k& v+ Z0 g% q1 v: c8 X, N6 r( {- G
  47. 3 t5 W$ L3 |: L
  48.     std::string item_id = "";1 C' H5 f9 `0 m" K
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    # W$ [. m# p# J* a6 [* Q; D+ L( @$ k
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))# M, G6 a: w4 }% H- l. w
  51.     {3 \) _8 A5 \* o8 J
  52.         printf("    item_id: %s \n", item_id.c_str());
    3 ]& A$ `" F4 a% c4 c8 n: J4 a1 S
  53.     }
    # q/ }* |/ G  F3 u% l+ j+ O

  54. ! T$ |0 d% h" c) ?0 x
  55.     std::string name = "";/ ?7 N  l% k* A9 Z7 [+ L2 _
  56.     ifail = creInput->getString("object_name", name, isNull);9 X' f4 n. G, n2 P# ^  ~
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    2 S  C  Z8 w, E7 `, B1 m4 r
  58.     {
    3 s+ w+ [7 `; w: K. e
  59.         printf("    object_name: %s \n", name.c_str());
    ' f3 |* j1 _9 h. n( H: Z
  60.     }
    , g1 I5 L3 p8 D8 M

  61. : H9 D+ @; O: M
  62.     return ifail;;, z9 m. a4 K- _1 M
  63. }
    * w& C4 d9 S. ]
复制代码

" Y4 t: C/ n  a% f7 ?3 y! b$ f& ?( c( A4 ]7 ?% v1 P( a- T! h! Z) |; K
7 [4 Y; _- P3 v( E- ~7 G* a
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了