查看: 6044|回复: 0

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

[复制链接]

6

主题

4

回帖

60

积分

管理员

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

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

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

×
" C0 G6 z9 {7 M0 f( J; O
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
* @* x& }4 ~  J
  1. #include <stdarg.h>3 A  \4 G, Z8 [* _. S& q8 Z9 v
  2. #include <stdio.h>0 \6 H/ U( V( B# s7 [* C
  3. #include <stdlib.h>) Z$ J+ j% x5 K2 A3 Y
  4. #include <string.h>6 ?2 ^( s! @0 j" N2 h5 }
  5. #include <UG_va_copy.h>! q  T) U$ J, ^3 |
  6. #include <TC/emh.h>
    7 K. K: j3 J7 b; b9 J3 S
  7. #include <ict/ict_userservice.h>
    + h$ z  Y1 D/ q( s9 r! U$ L% b
  8. #include <itk/bmf.h>
    ; f  s( A/ G: ~5 ]3 Y3 O' E, Y$ a
  9. #include <tc/emh.h>
    6 g% }2 s' h, p' a! ]9 o6 ]
  10. #include <tc/tc.h>
    * ^& q% K' T, G
  11. #include <tccore/item.h>' ~5 s& s( X2 e- J1 ?: ]
  12. #include <tccore/method.h>
    4 D! P- G) E" Y) e0 M. l& F
  13. #include <metaframework/CreateInput.hxx>) F8 n8 ~  Y5 f  x4 K
  14. 7 Q! X2 {8 A! F+ {8 j0 F, E- H
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args); ?4 F1 s& S+ O: p: j/ w+ Z
  16. {
    6 M! K& U0 R" M7 p$ ^
  17.     printf("\n\n A2_gtac_extension_rule \n\n");9 R/ e5 q2 x/ j8 Y- F

  18. % N- i) _3 w; g" S5 Y' n' }
  19.     int ifail = ITK_ok;+ v0 ?! o8 X5 {4 Q) g  T% M/ _

  20. 5 |- X6 P1 U% f
  21.     va_list largs;
    6 [2 x  a# _: F0 S' c  H' S* ^
  22.     va_copy( largs, args );
    5 z( K0 \3 c7 S
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);6 d0 Y- g! b" g5 Q0 S
  24.     va_end( largs );
    0 |8 [6 A  c5 z0 w

  25. + I2 X5 |7 A7 S' N9 N$ k
  26.     tag_t new_item = m->object_tag;    ( w& u: N& w" ~
  27.     char *uid = NULL;2 r" w/ S8 k+ [/ _- x6 z3 W
  28.     ITK__convert_tag_to_uid(new_item, &uid);" @9 y, x3 f# e6 a& K+ v
  29.     printf("    new_item: %s \n", uid);
    ' w3 N' ~! R1 F
  30.     MEM_free(uid);& T+ ^5 Z  ^: K

  31. , H" l7 D  H3 ?* F8 e
  32. : B8 g7 A0 K2 a5 D
  33.     bool isNull = true;
    7 H9 ^. Y. H8 e/ R
  34.     tag_t new_rev = NULLTAG;0 B; X" N4 h0 M3 B
  35.     ifail = creInput->getTag("revision", new_rev, isNull);% Z6 ^# c! Z* y- h' h: [- x) f
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    % l+ Q$ N  Q6 z9 `$ e* z! z
  37.     {
    + Q  q3 ?2 \& A9 W% J, v
  38.         printf("    new_rev: %u \n", new_rev);5 n! S" T: t4 W
  39.     }) G; R8 A7 G) |7 X5 k9 X+ J* a0 o
  40.     4 o) y6 y) Z* @7 C
  41.     tag_t master_form = NULLTAG;
    " |* `4 H2 ^+ U
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    / {* d6 J5 S0 j9 e9 a6 n
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    + a, v) X, u1 i. @) f
  44.     {# a6 e* h& W2 r% d) G. G
  45.         printf("    master_form: %u \n", master_form);" X1 C% _% e. x7 {
  46.     }& h9 t9 \. a' u6 E) R: g$ p' f

  47. 2 y( `0 E3 ^6 Z. x
  48.     std::string item_id = "";( {. C3 t/ I4 W* v8 V9 k0 X1 r
  49.     ifail = creInput->getString("item_id", item_id, isNull);% w! U+ g$ `2 o  V: x! M
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))5 \& \% K+ u3 O9 A  L+ a, _
  51.     {3 l9 d! ]3 l) }, `* i. d
  52.         printf("    item_id: %s \n", item_id.c_str());% g- ?5 C$ ^2 I
  53.     }/ }* e3 Q/ u3 U9 Q( O# I+ i

  54. 6 T. P, P7 y0 v9 {2 L
  55.     std::string name = "";
    $ w; i1 X3 S; |9 K' U- _2 W
  56.     ifail = creInput->getString("object_name", name, isNull);
    % A8 s8 ^, W! B$ y
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    ( [# g# S+ _2 v
  58.     {& M+ j4 T2 F, e& l: f6 D- P8 M+ ?
  59.         printf("    object_name: %s \n", name.c_str());
    % _) {0 Z, n; I$ m
  60.     }
    ! C0 c! K% V" }5 o$ Q5 p
  61. , [: h8 e! W8 R
  62.     return ifail;;
    3 e+ L# p+ M# b  v/ {( y
  63. }2 O5 q8 K' V. ?4 t$ p  d
复制代码
# b6 d- x3 x3 J: |/ F
* n5 N  h& L) Y8 H" }/ d
( l* R8 I3 r0 j" d9 H5 M  ^
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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