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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x

- m- z& {! ~6 y5 y6 h8 ATeamcenter ITK二次开发源码分享: Item 创建 createpost操作
; |: n* W3 C* z/ z) }- d) k! q, o% s
  1. #include <stdarg.h>1 d- K) C# I0 ?9 o
  2. #include <stdio.h>
    3 C9 S4 g: m) J, }) v# H
  3. #include <stdlib.h>) W# ~# Q+ b2 g
  4. #include <string.h>5 M& z6 R4 V! o# p; d! M+ r
  5. #include <UG_va_copy.h>
    * q5 ?" G) q0 G4 O
  6. #include <TC/emh.h>5 q7 P) K2 h$ _9 i1 ^/ T( H
  7. #include <ict/ict_userservice.h>) @/ L8 J8 e' X3 e
  8. #include <itk/bmf.h>
    7 V* F- Q- _7 k4 B
  9. #include <tc/emh.h>
    5 ?1 A" D& r2 x- H" L& h
  10. #include <tc/tc.h>4 x. A) z/ l3 m" U) H# x4 @( J
  11. #include <tccore/item.h>* i2 P" \. f: ?
  12. #include <tccore/method.h>- H& y1 |( C& j8 q% C* G( u5 ~- U1 a
  13. #include <metaframework/CreateInput.hxx>
    2 {, ?# h( J8 n% T
  14. % [/ @7 W" P. e8 b3 r
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)* A1 N) o& J5 s5 |
  16. {
    ! U. ^6 c5 _$ S. B3 ~# d6 o! }, g
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    1 c4 \$ M; v' `" H9 [' H

  18. 2 L, @1 c2 U: E7 p1 H
  19.     int ifail = ITK_ok;6 P$ d: F0 e  v+ p& i$ P4 R# t* G

  20. 4 S- ]$ f1 b7 O: G7 P2 {6 A
  21.     va_list largs;% O- [2 G' b- X) L, {- a$ J! U( n- V
  22.     va_copy( largs, args );7 f! A" u, e+ D8 U9 C
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    , b: x0 k6 R; Q) f9 k
  24.     va_end( largs );
    6 l& z% Z1 z( F, f% h/ p

  25. / \( q6 K2 ^( t: J
  26.     tag_t new_item = m->object_tag;   
    , n2 D& Y- G1 c/ k5 j: z
  27.     char *uid = NULL;
      f$ @& e6 W5 R
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    ( ^  ]" O) g8 E: d4 o4 B
  29.     printf("    new_item: %s \n", uid);3 k- f: ^; x& n  R! U8 o3 j+ B
  30.     MEM_free(uid);+ q6 m( T* l6 ?( o! i

  31. 5 P* h- q3 u/ K0 F

  32. 9 U4 H, x* p4 L5 g- Z% A
  33.     bool isNull = true;
    ) Z( n, U% Z5 M/ H" |6 l+ {1 g
  34.     tag_t new_rev = NULLTAG;3 Y' Y$ t: ~: k
  35.     ifail = creInput->getTag("revision", new_rev, isNull);" N' f; {5 q$ v( h. h
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    7 X1 @$ J) e! W- M1 e+ A
  37.     {
    % ]( i( U- B" _  Z
  38.         printf("    new_rev: %u \n", new_rev);; M' s2 p2 k  N# {
  39.     }
    8 O. {% c; `% o* O
  40.     " Q- [) u2 N' M5 s4 o' G# z( o
  41.     tag_t master_form = NULLTAG;
    1 x5 K: s/ ^" A0 Y, ]% Q1 w
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    ' d9 L/ H3 ~9 }) t" v7 d
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))' f: w6 l1 x% r# ?# ?$ ]
  44.     {
    5 w+ ]6 z, z2 Q. V  r
  45.         printf("    master_form: %u \n", master_form);+ @7 V8 X$ V2 T% O, U' U# E
  46.     }6 D( D1 _( m7 x; l; i) B

  47. $ w8 q( t7 D1 Z( A2 i( V8 `
  48.     std::string item_id = "";9 i5 F2 I' _+ G) ~) T6 v
  49.     ifail = creInput->getString("item_id", item_id, isNull);8 {- H1 J8 Q: W: i
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))
    & E5 W2 P* c* K
  51.     {
    0 X8 c$ d: d5 {7 F
  52.         printf("    item_id: %s \n", item_id.c_str());
    9 V3 z8 K. X5 @, Q
  53.     }
    5 H7 r0 ~' |) D' ~* R8 `; M0 n

  54. ! P- Z7 \) o' V- `  M* W4 {
  55.     std::string name = "";
    4 E% u. \7 F+ z2 S1 z8 [2 n
  56.     ifail = creInput->getString("object_name", name, isNull);
    . M- a6 n, t! Q7 ]# v! m. m
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    / F9 `, \& t, G0 [$ F/ ~" G2 s. Y: k
  58.     {( B) `) k4 s) d
  59.         printf("    object_name: %s \n", name.c_str());" m* U2 v" o" R# l) i/ R- A/ ~
  60.     }
    # r0 l7 R- N. S. j$ `4 q' {
  61. 6 s1 L" d! I$ \% e  q. _! _: p1 p* }
  62.     return ifail;;8 C" x) f, \/ A  O
  63. }
    5 O! w; }8 I' ]; N4 ^6 {" s3 Y
复制代码

& N. X& d- {% Q8 g5 w# t. F9 S; s! E/ f
- _% `: E( E6 i& [- g
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了