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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x

$ R0 {9 x& F5 \1 U; c0 yTeamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 r  o9 k8 I" x. _9 Y8 V; t* K4 a
  1. #include <stdarg.h>
    " Z- f$ Y: X) ^. t, h
  2. #include <stdio.h>$ z7 R' x$ j" o& ~) h) y# ?% u
  3. #include <stdlib.h>
    , S5 h! G2 q' \
  4. #include <string.h>
    8 H6 G: M3 }' r- ]" V. s& F
  5. #include <UG_va_copy.h>. ^$ u: S7 J4 S% ~% W' I- H
  6. #include <TC/emh.h>+ W2 g. \! K# }4 o/ Y
  7. #include <ict/ict_userservice.h>
    : I3 `' s. e# t4 ]6 M$ Z1 C- m7 l
  8. #include <itk/bmf.h>6 C7 c% u% y( b' U+ N
  9. #include <tc/emh.h>
    : A  T% t- C7 Y1 `5 q# t5 f5 c
  10. #include <tc/tc.h>1 D2 J$ e* e, B) v6 n" O# z
  11. #include <tccore/item.h>7 ~5 K! ^. L9 ]
  12. #include <tccore/method.h>
    - s5 C' X/ f( u$ `
  13. #include <metaframework/CreateInput.hxx>
    % M# e, b5 k0 F# W3 b

  14. ; S5 [5 h7 y1 S4 `: w
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    + C3 f, e- \+ s& @3 D+ k' ?
  16. {9 B$ z3 m2 }* H: V
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    " v: A. t9 s& `! H

  18. 3 {, E* m' |+ c  W" m
  19.     int ifail = ITK_ok;4 W  a  k: [, ~4 {, j0 e9 v
  20. 7 Y$ h- E/ ^* d1 P6 p( X$ b
  21.     va_list largs;
    ; T/ z4 ^- T7 k  _4 W/ ~$ `
  22.     va_copy( largs, args );4 r3 F, |4 l: Y, Z
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    ( Z. @2 V, S" g1 ?' ]
  24.     va_end( largs );
    . E4 k' M8 V2 c) E8 ~/ Y) d
  25. # D+ n* }* j; I5 k3 d% G
  26.     tag_t new_item = m->object_tag;    % |7 B' D5 S. z, d' h. ]
  27.     char *uid = NULL;
    8 o7 A, ?# L# q0 f8 C7 O- f
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    + n0 ]+ m7 e6 m/ P
  29.     printf("    new_item: %s \n", uid);
    9 L6 K/ K! L- I  J. E% |# i! ^1 }
  30.     MEM_free(uid);
    : ~) S  n, j5 Y

  31. * q0 V8 C. k5 w0 U# I
  32. ( P5 C% h+ k: l7 O) m
  33.     bool isNull = true;3 h( I- H; M, s: D
  34.     tag_t new_rev = NULLTAG;/ T* G' ^  f$ ^! [7 e
  35.     ifail = creInput->getTag("revision", new_rev, isNull);* B2 M. o! ]4 [6 N  t
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    7 Q, c1 e  m* M# ?3 E8 z
  37.     {. g2 ^2 U( ?% p0 ]' q% J- [  O
  38.         printf("    new_rev: %u \n", new_rev);
    ; v- T0 n5 g  N( R+ N3 `$ ]
  39.     }2 O" z! f; R* v% t/ [4 ^0 \- P2 \
  40.       M* C" Z2 D1 @+ s; `" X
  41.     tag_t master_form = NULLTAG;! I) n+ v* G' H6 y' K
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    ! h0 z9 ]4 ]8 V3 y  m! o) D
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))& o* T& y- L' q
  44.     {# A: e* r# o' u; _4 z+ q
  45.         printf("    master_form: %u \n", master_form);/ k, r* J* {9 t1 Q
  46.     }6 w# Z  y9 q/ o6 R& A0 J

  47. 5 k2 I: E. n5 |8 U1 D, N/ e
  48.     std::string item_id = "";: w1 ]! \  q* F6 J: _- O
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    % \5 F# S0 F* t/ O8 X. I( Q
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))
    ; I) u( _# Z) }: o* g
  51.     {. J! C( s2 G# O
  52.         printf("    item_id: %s \n", item_id.c_str());+ x& @1 y7 q& i8 z$ Z& {/ ]8 j* o
  53.     }
    " ^1 M  }" B2 `4 i! x
  54. 5 H/ s, D" B. R6 J1 q  p
  55.     std::string name = "";5 [2 \" m8 e7 G. I/ |5 H; _# c: _% J2 X
  56.     ifail = creInput->getString("object_name", name, isNull);
    7 x6 d# t0 M$ [3 S
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))1 y: ~$ L1 x3 m% M/ O1 b; h* c; W
  58.     {3 j! s* C/ Z6 j
  59.         printf("    object_name: %s \n", name.c_str());  C7 [5 @2 e9 A7 W4 C, R
  60.     }; ^9 j! [* p" u- O$ Z

  61. + [0 G  _2 ]3 ~3 ]1 ]& J. P# \
  62.     return ifail;;
    - i/ a( Y/ I3 ]- q6 B
  63. }
    8 R2 j& A( ]( y: X4 b
复制代码

% z1 u: \& D" v& `
4 b; ]' _1 }1 f7 A
8 s" M& v  z- L# z# r
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了