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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x

& x: Q8 Y% w4 I, \6 c! ^Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
0 v/ C# c5 w0 H7 u: c1 A( o
  1. #include <stdarg.h>* |. @1 f" v7 N3 [8 a2 L
  2. #include <stdio.h>2 J( Z8 p# I) j+ V, s( K6 ]
  3. #include <stdlib.h>
    ' v; b6 y. M6 N& u  S3 L; T: C- Q
  4. #include <string.h>
    5 t0 B3 ^3 o5 _/ s
  5. #include <UG_va_copy.h>
    ; Q! R0 I( _  G+ l3 \
  6. #include <TC/emh.h>
    5 u2 b  A0 Q: t4 J0 K$ @, z
  7. #include <ict/ict_userservice.h>" A; o2 c& W4 d* D
  8. #include <itk/bmf.h>
    . k$ r7 K8 ]. N( U0 i
  9. #include <tc/emh.h>; `6 X! S5 f1 L5 z0 ~+ C: w5 v! S! m
  10. #include <tc/tc.h># C# g7 z- x" w* h# q5 r. [8 t
  11. #include <tccore/item.h>
    # N2 _7 `1 I/ z% ?* E* ^* _) s* {
  12. #include <tccore/method.h># a# W$ }7 G* x
  13. #include <metaframework/CreateInput.hxx>
    & q+ {  p# ?6 R7 l3 L# X9 G8 T
  14. 9 B9 z% [# _' W+ @/ y% f% B. A
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    * I' q3 p0 A  }; d( c$ g: f; Y
  16. {
    5 H8 ^+ `" ~' y7 b- X$ ^
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    0 M8 [* T" C$ A6 d
  18. # X8 o8 q) k- X8 [) I, r( l" W
  19.     int ifail = ITK_ok;9 C2 j3 i& d, Q0 `  T, {! K
  20. ( k5 }* K- A' _) J9 p; [, ^! \
  21.     va_list largs;' B/ e0 d, C" J! g1 J
  22.     va_copy( largs, args );( ~  m0 i2 `( y$ }: N  f
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    - P$ J$ K( B! R4 I
  24.     va_end( largs );
    0 s2 Y/ F- u2 f4 C6 S/ m) f

  25. 7 x( M/ W! k3 m% J
  26.     tag_t new_item = m->object_tag;    6 V' a3 F$ k5 g
  27.     char *uid = NULL;
    8 G+ X: s$ h$ U; e, t
  28.     ITK__convert_tag_to_uid(new_item, &uid);8 ^0 o+ x/ G4 u7 f7 f
  29.     printf("    new_item: %s \n", uid);* a5 O4 ~5 K9 W/ p, o8 T
  30.     MEM_free(uid);; s  y/ R  q" ~( |, q0 @
  31. ( `( z* k) g9 d

  32. 4 P" y  ?* Y* B$ @+ T- J
  33.     bool isNull = true;
    4 z4 K: s6 N, |6 s  v% M4 @
  34.     tag_t new_rev = NULLTAG;' h) J& _; T$ `8 X' \/ Y9 J" D6 O
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    5 p% w2 `+ N0 B% w/ C0 F
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    ( E9 F4 s; [0 L# g
  37.     {' f6 k4 P5 U. j4 p) I! T
  38.         printf("    new_rev: %u \n", new_rev);" \! }2 z- O5 ~# J
  39.     }7 }# }* ?, Y" X0 g4 z* i4 d5 n# ^
  40.    
    ) r9 A! I) f, Z# D8 s% e1 U0 }
  41.     tag_t master_form = NULLTAG;
    & \. @/ r9 T4 b3 I: @3 Y
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    " M& ?/ P3 \$ u) r2 ]% F- E/ G
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    6 r7 Q0 f8 A3 ~, s" n9 x& v
  44.     {
    ; w3 U& Q( m$ C) H( h* `# @
  45.         printf("    master_form: %u \n", master_form);
    5 X6 t* S6 [% y4 c8 p" J' `
  46.     }( h3 U4 h; i3 A. C
  47. ' }7 ^; A; Y* R% }( ~! J  N
  48.     std::string item_id = "";8 S0 S1 y+ V' E% K1 I
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    ) T% ], t7 y) ~7 i/ G/ I) C8 R
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))
    0 l# L0 u! \* Q3 D* [
  51.     {" ?( [8 P# D7 X& a
  52.         printf("    item_id: %s \n", item_id.c_str());
    6 C2 o9 D. U/ L. [' X7 g& g
  53.     }
    . j2 i4 I/ |5 P- n
  54. / P, F% a0 C4 s% f4 F6 O9 u
  55.     std::string name = "";" K9 X5 Q3 K6 A' F  a1 U3 ]
  56.     ifail = creInput->getString("object_name", name, isNull);. A- T' l9 J; U2 o' ]7 e8 G
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))6 Q  Y/ E2 ~8 d& G1 i' V% S
  58.     {) u( t# g# B, O$ _4 l. v
  59.         printf("    object_name: %s \n", name.c_str());2 e- |0 C+ f1 L3 N
  60.     }
    " S! ~! i5 \7 m! ^/ x7 Y- G/ y2 k
  61. : D) u1 T8 h2 I' k2 \+ X7 O
  62.     return ifail;;* `" x  B) I* W3 L/ s: D
  63. }1 e1 Y- }2 N' h
复制代码
6 |; o& w( n* S3 S( I- s0 o' z$ a
7 s5 e. x& y0 l3 f# |

3 H3 d  @2 y+ L6 S6 J# p: c
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了