PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x
8 G3 \& y* j5 K9 b/ T$ p# l" O
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
& K' x; K* J6 @0 C0 U
  1. #include <stdarg.h>
    & ~% l1 p& M+ x% n) m
  2. #include <stdio.h>' J- P6 [; e! g
  3. #include <stdlib.h>
    7 O; V9 `. T/ P  r, d
  4. #include <string.h>
    . Y& p8 [* v' U/ q7 q
  5. #include <UG_va_copy.h>+ c/ v6 v9 W( z& M  o# y- \! ]( b& t
  6. #include <TC/emh.h>
    , N7 y& J! U. ^1 {+ g2 }% x
  7. #include <ict/ict_userservice.h>
    % K/ z2 K/ s" j
  8. #include <itk/bmf.h>
    4 p6 k6 h% g6 T. Z4 _% e5 `7 h
  9. #include <tc/emh.h>, p4 y8 i+ r7 ~% C
  10. #include <tc/tc.h>
    ! ]# u3 X0 g* }! g! {2 L) w
  11. #include <tccore/item.h>
    ( s) {2 n- Y. P; T9 N0 S  e
  12. #include <tccore/method.h>9 S. _3 ~. w+ f
  13. #include <metaframework/CreateInput.hxx>
    ' A3 b) n2 O: P4 z/ ]' C9 I

  14. ' b$ p9 O- _4 @6 Q
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    - G# L# T. l# ^# y/ l# c' c
  16. {
    . Z; ^# E' o+ W% H1 C" s; R
  17.     printf("\n\n A2_gtac_extension_rule \n\n");+ D' z8 R; u* j  I  ]  F( E5 ~

  18. " p5 j0 q7 O4 G( G4 j$ _  Z5 T$ L3 T
  19.     int ifail = ITK_ok;) G1 J) p/ W) ~& I1 n" P' S

  20. 5 h* d) D/ G/ E6 S/ w
  21.     va_list largs;
    7 h; ?5 K- z" P# J( j
  22.     va_copy( largs, args );& U9 i" Z9 A' f0 \, ~. t4 D- ?% k
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    9 u9 ^# g% g* d, R' W' D+ A/ N0 V1 v
  24.     va_end( largs );7 s) T& x8 f' f0 b

  25. - @) P& Y! |& x& s# r3 h# \7 h
  26.     tag_t new_item = m->object_tag;   
    : s( A% g: \1 f( |: b0 f/ c6 S! A$ O
  27.     char *uid = NULL;
    # g; R: t! _* l  k; q7 n
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    ) _! ^. y# |& d
  29.     printf("    new_item: %s \n", uid);$ W" h: U; z2 y9 f/ L
  30.     MEM_free(uid);
    5 n9 |/ O. p, o5 @3 l) y

  31. ) d$ K4 v4 q  |! ^
  32. 1 z, \2 V/ `$ `
  33.     bool isNull = true;0 B& S2 w- e% [' t. H8 o' T% W
  34.     tag_t new_rev = NULLTAG;
    " D  Z/ |2 M+ |6 N
  35.     ifail = creInput->getTag("revision", new_rev, isNull);: t1 |4 c' Y$ S: s3 M  F' z
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    6 n5 N6 }: _  n7 U8 Q3 j
  37.     {, u. l/ y: U$ e4 s$ G) g
  38.         printf("    new_rev: %u \n", new_rev);
    $ x) h8 k2 z/ S3 f& q  o) S  S
  39.     }1 B8 D& d* j, _0 j" I) r
  40.    
    5 f4 o9 b7 N9 ]1 \
  41.     tag_t master_form = NULLTAG;- o6 G5 q! D+ ?7 h9 d# ]/ W
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    / @* y# c9 ~3 P4 b2 \5 N9 O
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    2 G* R5 p! I; }; u2 [/ O
  44.     {7 r- `# W4 C# X0 F3 {
  45.         printf("    master_form: %u \n", master_form);
    * F) ?. I: c, k! O1 a# m) }: R7 l
  46.     }, [* J% b5 W5 `* G; G) G$ f4 F0 C$ |
  47. 3 a5 C2 d4 f: s
  48.     std::string item_id = "";
    % G: R8 g) G) Z
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    + a: r. r  |% v; w2 ?) G3 h( F1 @
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))8 n: `7 H3 \. q8 U
  51.     {' ^: r: U+ U2 h
  52.         printf("    item_id: %s \n", item_id.c_str());
    & N% P  p4 y  t
  53.     }" G9 m$ H4 |: M6 G# e7 S3 p
  54. ! ?0 {# N" N8 A
  55.     std::string name = "";
    4 E, y( R  g( l! f/ r
  56.     ifail = creInput->getString("object_name", name, isNull);
    % L9 ~3 v0 M1 x" k% U
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))- g3 }' K% o% b. h" F; Y, i
  58.     {
      _  t: u7 ]) d5 c* ]
  59.         printf("    object_name: %s \n", name.c_str());2 C9 R2 {9 h/ _0 v: W
  60.     }
    3 h) b( e1 Y0 L* W

  61. , w. Q9 [- z3 |/ l: S9 X! M0 [
  62.     return ifail;;7 T3 [2 `+ _: T3 v# e
  63. }- P$ ]( d$ }& J- E* s- u# k' k
复制代码
- M* l/ q) T' c8 K- ]

/ C) i% p& c  M' T- j2 k$ O, s  j+ F4 t) f8 q3 D2 C+ 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二次开发专题模块培训报名开始啦

    我知道了