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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x

* `/ h) L# Q" [# cTeamcenter ITK二次开发源码分享: Item 创建 createpost操作
. p# `7 Z  B- ^1 K& X* a( X
  1. #include <stdarg.h>: C& p& r: O  Z! ]
  2. #include <stdio.h>
    * r' R3 T: \& f* W
  3. #include <stdlib.h>
    2 u, ]% p$ M: p9 Q2 c/ o
  4. #include <string.h>
    / s9 S8 y# g- X7 I1 Z, A
  5. #include <UG_va_copy.h>
    / r+ ?7 W( w1 n- a7 w8 S, d5 H
  6. #include <TC/emh.h>0 Q) N5 r6 T6 ^+ ]  T* u+ n' A% U
  7. #include <ict/ict_userservice.h>0 A  ]/ o* ?8 a4 K
  8. #include <itk/bmf.h>5 p: s+ |% H. o& d
  9. #include <tc/emh.h>
    ) d, A1 D; X0 @0 }  z, M
  10. #include <tc/tc.h>
      R6 a! L  c& k
  11. #include <tccore/item.h>3 R" x' _7 g8 N( L3 q
  12. #include <tccore/method.h>7 G3 E3 i* Z& q' M# k4 Q6 F% Z
  13. #include <metaframework/CreateInput.hxx>
    $ r" \, Y/ d4 g# o
  14.   N/ h) [; c: Z: I/ f; [  Z
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)2 X- V; n9 B( \+ ~4 z8 [
  16. {( f6 z5 g7 B4 c% n) {% j7 n
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    ! `9 E0 c. ^/ g4 d# y
  18. ' u8 F& u8 [) n/ y; S5 d" E8 X
  19.     int ifail = ITK_ok;5 u9 p% L! C6 H

  20. ! E& b( p" \( q  P2 O" p0 P
  21.     va_list largs;
    , y+ D3 b' ~+ c
  22.     va_copy( largs, args );
    3 \/ W1 T: i/ Q* d& H, k! ?* t" H
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);$ V3 E( @7 a; M) N7 W" `( ]
  24.     va_end( largs );3 t1 i3 }9 R; x9 P. f* i

  25. - \2 @3 w. J6 q7 _
  26.     tag_t new_item = m->object_tag;   
    2 q2 I/ n  p1 b8 \
  27.     char *uid = NULL;
    0 u2 f1 t# ^! ?  d: v# y# ?" f/ r
  28.     ITK__convert_tag_to_uid(new_item, &uid);
      A6 S& ^0 u* u, _; S* E
  29.     printf("    new_item: %s \n", uid);
    + a7 @6 {5 d2 o. U8 C, m; N/ i& O
  30.     MEM_free(uid);
    % e( w3 N, T& L, G+ d+ }5 ?
  31. ( m/ v+ ~7 z/ `( c
  32.   p8 g; x" a! @( a, M0 @
  33.     bool isNull = true;
    5 [4 d4 e3 `  s+ L+ i
  34.     tag_t new_rev = NULLTAG;) p- w/ w7 g9 J( s$ ?: p0 W- U
  35.     ifail = creInput->getTag("revision", new_rev, isNull);2 D- J' f5 a; f7 ^# ~" z
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))+ g3 N# u- q( b, v. W
  37.     {
    3 x0 `( U+ f# B2 d( s
  38.         printf("    new_rev: %u \n", new_rev);
    ) U' x. x$ H, k! P1 J2 k2 _
  39.     }
    2 L3 [& j. Z; |& k
  40.       G6 K9 Y/ @4 L0 Z* t8 Z2 @" t5 R- Y
  41.     tag_t master_form = NULLTAG;
    : R" q7 s; t+ B; g1 w
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    - v4 d. d+ d3 y: d5 k( c! X1 K; |
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))3 J; ^) U/ i1 F* q/ o8 r! m, s
  44.     {3 ]- N- v" b( f/ L; n7 J$ |( F
  45.         printf("    master_form: %u \n", master_form);/ _, Q) K' r3 j9 K: u/ y4 C
  46.     }
      y/ k+ M4 B) ]

  47. . d1 e( ^- Z( p/ Q2 v% D
  48.     std::string item_id = "";
    + _) |" ~4 M! }" g8 L1 }9 D4 S
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    ! w; O& `( J1 x" D
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))) t! F4 X1 e( h8 Z/ y; q& n1 j
  51.     {  k1 M* U6 _$ ^/ G# ?* g. w% N
  52.         printf("    item_id: %s \n", item_id.c_str());+ A8 W0 Z5 K' t' n
  53.     }
    5 ?4 _+ B/ q7 P6 G; p8 a6 s) V

  54. ' N: w3 l6 b$ w0 N5 y$ V
  55.     std::string name = "";: K$ w" b8 C. |! n
  56.     ifail = creInput->getString("object_name", name, isNull);0 ]3 o% o, x( C* E/ E
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))9 n, q% g3 n- e. u
  58.     {: ]- a* f8 {  {2 y0 t+ M
  59.         printf("    object_name: %s \n", name.c_str());! [7 c& Y4 u4 l# c: m! O% @( V
  60.     }+ d' J1 V( U8 I) Y# I8 `: A( d

  61. # ^; Y9 P& W8 H& ~
  62.     return ifail;;
    ; F+ r9 g$ C* u. i% h# ]
  63. }1 R$ u1 t& d- _1 ?: Q" G
复制代码

, E$ ^! s; K: T. k; T( y
' R8 N* u( k2 d5 H+ c4 q# W: e$ d( Q9 r5 _/ Y& k
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了