PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x
0 Z1 x! o& @& j, D. f+ C* G4 `
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 `% ]1 h) D% [
  1. #include <stdarg.h>0 D/ e/ ^/ c- s0 \) D* B5 L
  2. #include <stdio.h>
    # _! T2 N6 D& w) s! H; I
  3. #include <stdlib.h>* Q4 N0 x) J  h1 u3 F6 x2 S: ~
  4. #include <string.h>
    / D3 Y9 W0 h4 U
  5. #include <UG_va_copy.h>6 }/ P7 k( F4 |
  6. #include <TC/emh.h>* M! g1 O7 G  @- U0 ~3 z
  7. #include <ict/ict_userservice.h>
    $ Z; t1 c$ o6 N. i6 t
  8. #include <itk/bmf.h>! n2 C/ @, I* K$ D/ R. {0 w
  9. #include <tc/emh.h>
    4 F, S' V; }% S9 T
  10. #include <tc/tc.h>. r+ Z; R' a2 e5 p1 l  G; w* {
  11. #include <tccore/item.h>
    / o1 j6 z" c1 i3 v/ L$ ]
  12. #include <tccore/method.h>& p' y' J3 O) U- |9 @
  13. #include <metaframework/CreateInput.hxx>
    3 ?2 T5 g1 C  V, k7 I; i7 W
  14. $ R  g: m2 ]8 h9 }* U: L
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)7 z* a7 F& \" j6 g+ ?9 V
  16. {; D/ \- f$ C6 B* i. ?
  17.     printf("\n\n A2_gtac_extension_rule \n\n");1 N# k& |+ W6 w

  18. ( F+ H  ~2 |3 A( Y6 w
  19.     int ifail = ITK_ok;
    : n" x  }. V8 o9 Y# x$ }
  20. 0 ~" k- `! k  p( `
  21.     va_list largs;  r6 ?7 r4 |5 V" K3 d) M
  22.     va_copy( largs, args );* g' ?& S# K; L& x7 E( ?- h5 c
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    . S- C  y7 {" {
  24.     va_end( largs );6 m. d4 e, s! i

  25. ) \/ Q( T/ ]: L$ y
  26.     tag_t new_item = m->object_tag;    1 g3 U7 ]' |( X9 h
  27.     char *uid = NULL;) ^  h1 V5 u- I; r: {) Q7 W, b. U
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    ; h. T, Z8 G+ x% L6 i' w5 ]
  29.     printf("    new_item: %s \n", uid);
    # `/ E) N" |1 y" s$ D
  30.     MEM_free(uid);- S$ U3 D( b* P
  31. ) q" [2 E) o( m7 A
  32. # U$ c$ P; T, C" H1 ]5 z+ G# T
  33.     bool isNull = true;! C& d% Z  S( {* b" Q6 G
  34.     tag_t new_rev = NULLTAG;
    5 T0 l! Q8 B0 R! ?0 m, J( S
  35.     ifail = creInput->getTag("revision", new_rev, isNull);  ]) c- k& m4 d0 l6 y
  36.     if((isNull == FALSE)&& (ifail == ITK_ok)); J' }5 u  M% p* }, Q3 }
  37.     {0 M  Y; c* j4 _; t
  38.         printf("    new_rev: %u \n", new_rev);
      T1 B& F# @& B4 J& ]- j  h7 a
  39.     }
    : w9 d: o! B% M! i* o9 F& q+ ^
  40.    
    ; S, W! f% `5 F: j$ c- d
  41.     tag_t master_form = NULLTAG;- a3 f$ E1 h5 A& n
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);1 \8 X7 n0 A8 t, ~& u
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    , l( T# @' Z! C0 E
  44.     {( x6 p8 p" ?3 e. i' w; Z* G' w
  45.         printf("    master_form: %u \n", master_form);  C9 [2 L8 l) P" `
  46.     }) |+ E# \, L: @+ J
  47. 6 P+ s5 Y- t! |* O
  48.     std::string item_id = "";
    ( Q" ^2 r, y; g" @6 o! \
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    : N* N/ l+ N2 \" x# `- ?& Q+ Q  h  I
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))' D( C% E  g3 V3 }  S* F
  51.     {& A  i4 v  L. G
  52.         printf("    item_id: %s \n", item_id.c_str());# _' [  K3 m8 V* E  D; s) M
  53.     }
    7 @3 {' O- L* `$ U
  54. 6 F' D' {8 ^+ ~' _' E  j9 z: z; i6 @7 D
  55.     std::string name = "";5 U* u: y# R) _, \; v1 x) B& a* Y
  56.     ifail = creInput->getString("object_name", name, isNull);
    ( a1 i6 N: t3 J7 d# G9 b" S2 g
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    $ @* w6 ^9 I/ T7 z5 U5 P8 F
  58.     {
    : R. v, p  f) H: y# C# G* K4 B7 B! ~
  59.         printf("    object_name: %s \n", name.c_str());9 i" I0 d# a2 j$ p9 f  @
  60.     }
    3 [4 H( ~6 C5 }6 w1 }5 b

  61. & [7 g" x, {8 S9 q4 L& I
  62.     return ifail;;# V% p' j8 a( e' T) W
  63. }
    ) t5 G, A' z% `3 a& x# R. Y
复制代码
; n% I; \- z  f

$ T7 V% B; V5 E. }) T3 |/ v' ?7 g' ]& j0 e) c4 L5 f
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了