查看: 5949|回复: 0

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

[复制链接]

4

主题

3

回帖

36

积分

管理员

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

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

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

×
" c& ]* {7 w" Q. [* {
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
& ?" A. Z0 p1 D
  1. #include <stdarg.h>
      b8 g3 ^: ~2 s5 Y! w' D" ]4 h
  2. #include <stdio.h>
    + S. n& V: Z8 ~& H1 c7 ?
  3. #include <stdlib.h>
    % u: G1 J2 M  m$ T3 b+ A( \
  4. #include <string.h>5 u% h/ {9 P; W& a3 N4 E. f8 _, K5 ~  W
  5. #include <UG_va_copy.h>
    6 z: `$ G4 L" ^; n
  6. #include <TC/emh.h>
    : j8 M- y, b/ n8 Q
  7. #include <ict/ict_userservice.h>
    $ `3 h# F6 [; U# c6 s5 p+ P
  8. #include <itk/bmf.h>/ S* U- D! H# C" ^3 d
  9. #include <tc/emh.h>) U+ m- N4 l8 t8 C
  10. #include <tc/tc.h>
    - _0 `1 B$ Z& m* B
  11. #include <tccore/item.h>
    + W! ~/ a) F- r/ ?$ j+ p
  12. #include <tccore/method.h>
    ) X  }& `: e! w+ Y) ]$ t
  13. #include <metaframework/CreateInput.hxx>
    - `) \4 @1 k* `% Z
  14. ' r* }* Z3 S/ n5 ^
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)0 I: I8 e5 P  z9 X2 O$ ~6 C
  16. {
    , H7 U" V" ]9 }7 w! i! a: b
  17.     printf("\n\n A2_gtac_extension_rule \n\n");3 |3 R+ a* O) x: O( _- L; J

  18. ) I7 p8 d0 ]- _& x8 k
  19.     int ifail = ITK_ok;
    ( d' E0 h( t9 Q2 j

  20. ! Z: V$ d5 p# K. S0 O; v
  21.     va_list largs;  D* U# D1 u  [* ~9 w- I
  22.     va_copy( largs, args );- p  s% b  b9 q, }$ j
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);( r. \  K' M9 E0 @
  24.     va_end( largs );. }5 ]. L2 [& U. y9 D

  25. 7 \' y. D- z) U$ P1 Z$ s) [! _: L
  26.     tag_t new_item = m->object_tag;    # G0 H$ n: ^  I% z
  27.     char *uid = NULL;6 h& Z( K( z- t& `
  28.     ITK__convert_tag_to_uid(new_item, &uid);- o: z2 f" K* r" E9 I  {
  29.     printf("    new_item: %s \n", uid);. ]% j2 j! z5 T5 B2 s7 j
  30.     MEM_free(uid);
    , ^/ s- v% L4 Z! m7 n2 T: m

  31. 3 A0 U+ o" P/ c4 y

  32. * I" C  O. g  u, _( j- f
  33.     bool isNull = true;' K* ~' K) i6 l, q) S
  34.     tag_t new_rev = NULLTAG;
    # N9 l4 s2 k0 W. Y7 a
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    5 d$ n" U; ^2 z* I+ |
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))2 `1 }( g: _3 ^% o2 f2 v
  37.     {
    & M! S! K$ x" L5 r3 ]0 v# b
  38.         printf("    new_rev: %u \n", new_rev);: {: E5 z% E7 S2 z! @
  39.     }& U6 [! f; n$ _& W" m4 e
  40.     % ?1 Z) f+ v* \0 z1 p
  41.     tag_t master_form = NULLTAG;
    ; n$ c7 N0 B8 \# V" Y6 S
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);+ C* s7 ~, I  N5 ?
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))9 y/ ?+ i; v: C. ^  L2 W
  44.     {
    + ]0 S1 a  M) v0 C+ P
  45.         printf("    master_form: %u \n", master_form);( R* h& R# Q( Y4 X  E
  46.     }4 ^8 G) J$ H$ H( V4 I8 ?

  47. 4 [$ e8 [: I3 ^$ P' X% W
  48.     std::string item_id = "";* _3 F; r$ u, Y( r! B/ \
  49.     ifail = creInput->getString("item_id", item_id, isNull);3 X$ A3 f1 b. @+ s; \
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))
    . |5 _& c% D4 q- I9 }# O' r% P$ v
  51.     {+ G) R9 V8 J# ~2 z3 ]7 R- e' g
  52.         printf("    item_id: %s \n", item_id.c_str());' q# D7 c, {, o, T& _6 v% }- V
  53.     }
    . I" z# U/ s5 `

  54. 1 D% S" f' x4 ^& q
  55.     std::string name = "";
    9 V$ c5 T+ u- r% _7 H+ h8 i- ?, r9 A
  56.     ifail = creInput->getString("object_name", name, isNull);2 H, H& \! x* V# C) h4 k! `
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))+ n: H$ K- t7 b9 r4 L# j
  58.     {& Z8 _" ^( G5 `( i2 t2 m
  59.         printf("    object_name: %s \n", name.c_str());
    " X( l( `6 z6 Z, R
  60.     }
    % i+ i/ _! o- {+ b  Z' f* i: D
  61. 4 i3 O  }5 T9 R( ]
  62.     return ifail;;
    ' ^: G- y8 q" f/ S# T2 s8 Z: n
  63. }
    1 D  w# d% u3 m8 a5 G, ?! s
复制代码
  i# [2 f+ h2 T! b" r( w) D3 ?0 t$ @; A

& C- n9 X4 ]! ]2 L
: J" r" A* s0 e5 l
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部