查看: 6123|回复: 0

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

[复制链接]

6

主题

4

回帖

60

积分

管理员

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

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

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

×
! L( @: _1 i$ [/ T9 S  T& Z
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 T0 R$ ~4 E% R: r7 E
  1. #include <stdarg.h>
    0 m& V! Y; c: I" Q. U: C/ q
  2. #include <stdio.h>; i; k- X8 Z7 e' a! l% r+ e
  3. #include <stdlib.h>7 m2 V; n* v  q, H1 B) ?
  4. #include <string.h>; P7 p5 n, o  f
  5. #include <UG_va_copy.h>1 `9 w8 _" ~% C0 q
  6. #include <TC/emh.h>3 o- a( C4 I- W; i/ U1 {
  7. #include <ict/ict_userservice.h>
    4 a3 B2 w$ b6 X
  8. #include <itk/bmf.h>2 Y# P$ q2 C) a
  9. #include <tc/emh.h>
    . P7 B9 R' D  r  V
  10. #include <tc/tc.h>
    2 B" J0 d. x" M8 d" M7 Q
  11. #include <tccore/item.h>, Z. b) @  v# g; c1 c
  12. #include <tccore/method.h>. s  X. F' D6 S& [+ V2 ^1 H
  13. #include <metaframework/CreateInput.hxx>/ U, U6 `8 K9 h$ i& m* d% M
  14. 4 j) Y  s: J2 `* d# Y1 j
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    ! \# n; G4 o8 f& q& N- `
  16. {3 r- o6 w( m  L+ R" A4 d% h
  17.     printf("\n\n A2_gtac_extension_rule \n\n");$ [% c; N) A1 C& C& b) j7 j# ~; z

  18. ! K% w; X* [1 j
  19.     int ifail = ITK_ok;
    " D8 ~+ u( N5 x* K6 T
  20. . X% [, x9 ~' U0 s& o8 N& V4 V
  21.     va_list largs;
    " Q( O: [1 D2 k) d- x9 Z! w, e/ g4 M
  22.     va_copy( largs, args );) X$ M; M$ q2 @, w0 Z: h; v  L- G$ T% U
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);' h" P6 q8 {; l! e3 z
  24.     va_end( largs );
    ; H+ x* L# i4 j  \8 L
  25. ; o7 {3 R# J6 Q( M; F0 V
  26.     tag_t new_item = m->object_tag;    0 X# ^4 S/ @1 I1 H/ J& s' |
  27.     char *uid = NULL;
      A  u1 n3 v9 B
  28.     ITK__convert_tag_to_uid(new_item, &uid);6 B& {( a; N: T, N; [8 U& Y6 w
  29.     printf("    new_item: %s \n", uid);
    $ M0 Y6 U  [& @# u" L1 F& ?0 x5 T( u3 A
  30.     MEM_free(uid);
    6 G; q0 {  T6 e5 @
  31.   i+ w7 h" ~5 X$ Y0 p6 [
  32. 0 |) k  i7 \  y2 H5 J4 Q# x
  33.     bool isNull = true;0 u0 T2 l# B6 X% W
  34.     tag_t new_rev = NULLTAG;
    . P2 x4 ?1 x" t8 g' e* L
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    3 e" m. d5 _0 ]% F% O. Z7 p, v* D$ h) W
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    5 l& N; A' B: J% l- u! L
  37.     {
    2 e( F0 X: }1 X2 E4 S& O1 P. e
  38.         printf("    new_rev: %u \n", new_rev);0 L1 B1 H; j8 z/ M# y# G+ W, y
  39.     }3 h3 t: l% c: k0 L; Y0 S0 ^
  40.    
      E9 p7 L  m2 ~8 L' f
  41.     tag_t master_form = NULLTAG;; g' p4 n5 j9 `- O& C
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    4 ^3 g& \/ m4 Z/ ]7 I
  43.     if((isNull == FALSE)&& (ifail == ITK_ok)): z7 O' ?  J, A+ F
  44.     {
    8 r) l. C! O4 _, o
  45.         printf("    master_form: %u \n", master_form);7 r: J) l/ f& x# S0 i5 l
  46.     }
    7 T% X: B! x. ?$ o" ^

  47. * C7 h8 B3 Q& C# s' D& x
  48.     std::string item_id = "";
    7 i: X. Z4 q% b
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    3 M- [2 D. a" E3 _! i8 T( a
  50.     if((isNull == FALSE)&& (ifail == ITK_ok)): w/ D1 U1 @  u4 ~( f; Z
  51.     {/ {' ^9 X! q& h7 [1 L' j5 f, d3 _: S
  52.         printf("    item_id: %s \n", item_id.c_str());
      Y' ]$ H, e/ n" R
  53.     }
    6 p: B+ P# c4 g

  54. * ?, E6 u' G8 z
  55.     std::string name = "";
    3 o9 q/ ^% I* P4 I+ [0 j- d
  56.     ifail = creInput->getString("object_name", name, isNull);
    ; i$ \, d, X+ c4 V" _4 n  h
  57.     if((isNull == FALSE)&& (ifail == ITK_ok)), T8 Y# C+ F5 ^8 P. i4 Q
  58.     {
    6 y+ t0 o- b8 v" V3 |. {
  59.         printf("    object_name: %s \n", name.c_str());! c5 s6 H) [5 m  i# }) {6 p
  60.     }' {8 H* D- l& n+ E/ K7 t6 T1 ]

  61.   D6 |" ?5 q& B3 `& w
  62.     return ifail;;, b' @& K1 {0 h1 {9 `5 @
  63. }
    1 C% A+ ]2 s6 B. x6 I
复制代码
7 \1 B: H( N7 ?# N

' z- Z' H) s  d
8 f* n- k; D( u9 r6 S, j
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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