查看: 6207|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×

, M6 n. W" o+ B! |9 k. }9 B+ |! VTeamcenter ITK二次开发源码分享: Item 创建 createpost操作1 m) l$ @1 x, ?) t
  1. #include <stdarg.h>+ A/ r( \  @  i) G# p5 T( j
  2. #include <stdio.h>. `1 Y! ~4 a# P/ ]- }9 j
  3. #include <stdlib.h>! p- G" @9 o1 U1 N& g
  4. #include <string.h>
    8 d: V' j5 }# R! y1 K/ m# f
  5. #include <UG_va_copy.h>9 K0 ?& g9 y) w) r. ?3 ?/ c
  6. #include <TC/emh.h>
    1 ?# x! @/ q5 u9 }6 `) L- Q
  7. #include <ict/ict_userservice.h>0 L; s" k$ j6 \, j; B  q
  8. #include <itk/bmf.h>
    / D( E+ f' \* _7 [
  9. #include <tc/emh.h>
    & U- ^7 c& S& c+ B& C+ t
  10. #include <tc/tc.h>! {- v9 X0 S" Q( S3 t6 I* }8 F" u
  11. #include <tccore/item.h>
    ! k4 D, L  h" [) G
  12. #include <tccore/method.h>
    2 S! q, x4 J) }! n' t5 M# t
  13. #include <metaframework/CreateInput.hxx>
    5 F; |& c8 M. U; O" H. h+ t

  14. ) a+ N% S- V2 J( I- t  m4 N2 \
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)2 t5 b, Q, Q8 M) i# a/ B
  16. {
    7 e3 |& a. V4 [, J' |( C, P
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    ' `" |! U. @0 n8 U1 n
  18. ; _8 L. H  F4 F" e' T8 ?3 L& E
  19.     int ifail = ITK_ok;
    / }* w3 U7 w& }5 q" b1 O

  20. 5 F4 n/ I5 Q+ e- y
  21.     va_list largs;
    & E. U6 r: y& y& t. ?
  22.     va_copy( largs, args );/ Z# T8 _5 @9 z/ t8 ^
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    , @; e- A* H+ C  `( b/ ?
  24.     va_end( largs );/ q% S+ A' F& ~2 m9 u* A  D  s! Q
  25. 8 V% p& j- r, ~9 k  q; p
  26.     tag_t new_item = m->object_tag;    : L( i6 v( c$ V; W" E: b* `' X
  27.     char *uid = NULL;6 z$ q) Y, f7 |4 O
  28.     ITK__convert_tag_to_uid(new_item, &uid);. K) W+ _$ e6 w: G; U1 p4 _
  29.     printf("    new_item: %s \n", uid);
    , C6 `; s& t5 S4 {- V: e
  30.     MEM_free(uid);$ w8 d2 x+ [& y- c) c
  31. " `2 w5 q0 O1 F1 u+ F

  32.   l: O# I" y! y2 s& C+ [. R
  33.     bool isNull = true;- p/ |7 ~- ]! U- U3 ^
  34.     tag_t new_rev = NULLTAG;- @; N9 }+ r/ |5 e% W% ~# H: }
  35.     ifail = creInput->getTag("revision", new_rev, isNull);7 C4 q! \  G* C/ x/ r
  36.     if((isNull == FALSE)&& (ifail == ITK_ok)); d6 {" |5 _) V$ w5 N: y& Z
  37.     {( m, v1 H, \2 l0 n
  38.         printf("    new_rev: %u \n", new_rev);5 W/ [# a0 @7 s! l; d9 U, I
  39.     }
    9 x3 [8 O8 H' a& n; X
  40.     6 g6 V# M# B7 w6 b+ o. r/ ~- B9 |
  41.     tag_t master_form = NULLTAG;$ Q& z5 c; i# E- {; S: Q$ b
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);/ [- p5 A6 G7 A
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))4 }$ }7 Y1 D7 v7 t/ Z  G# ?4 Z
  44.     {7 y2 t% ~9 q  ?( M
  45.         printf("    master_form: %u \n", master_form);9 |' H) Q( N: ?0 \) v( N
  46.     }
    ) |+ M2 G: ?3 I3 f9 B

  47. 1 f" ]' |9 R8 X6 ~
  48.     std::string item_id = "";
    ( C( G7 M. C% }2 C% y4 [) [9 G# a
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    ; R% `3 N- j( e& p. R, F  i' c
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))
    : ]- W" u: i1 ^, J. n/ D$ m/ W+ X
  51.     {6 Y- M" ]  T+ _2 H6 c; t
  52.         printf("    item_id: %s \n", item_id.c_str());( J7 r+ Z+ ^* `4 }4 L
  53.     }
    ' }' }8 [# T9 H% C
  54. . c' R9 _% O# T0 m2 @8 J
  55.     std::string name = "";3 R4 U5 l% |( ^( w! _* i
  56.     ifail = creInput->getString("object_name", name, isNull);& Y: m- n; X  {7 L: N
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    . d+ X4 c. m; R2 \6 c4 `
  58.     {# Z+ X8 O1 g! e4 u& X. K6 C* e
  59.         printf("    object_name: %s \n", name.c_str());# `; E4 P& Z% a4 R  n
  60.     }
    : D9 Q$ i- t1 q5 r$ D4 m

  61. , C9 r4 m3 w" O
  62.     return ifail;;
    7 j; j3 l" e: Y" x6 ^8 c
  63. }
    % x6 r5 r, Z7 n* y! V
复制代码
- Y) [# R3 n  B  z5 r+ f7 r0 r& N) K
$ K- h# D' P. {% y* J

  p9 }' Y8 P, s+ s- i
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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