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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x
/ r- N5 E+ H( h0 }3 \& T5 D$ z* y
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
2 P, V' U& e3 h
  1. #include <stdarg.h>
    4 B" @, F% a, `+ r6 O/ ^8 b( R# i
  2. #include <stdio.h>* i, A0 k! u# o% D7 G
  3. #include <stdlib.h>, T8 K. z) G4 J9 ^' S
  4. #include <string.h>
    / W- g, z2 M( O3 G+ v* w& J
  5. #include <UG_va_copy.h>( [( e  a& I0 M8 ?$ B
  6. #include <TC/emh.h>
    3 H  t8 m# z' L! p  F& `- Z8 `
  7. #include <ict/ict_userservice.h>! e0 [1 }# _4 _( Z' R. v+ q
  8. #include <itk/bmf.h>
    0 z" ^. R; a2 M! a0 z# {0 S4 c$ Q
  9. #include <tc/emh.h>
    * u% C9 K) i) b
  10. #include <tc/tc.h>! v8 d( @' a" |
  11. #include <tccore/item.h>- l% _8 W/ v7 H; S5 B1 J" l7 f% P
  12. #include <tccore/method.h>
    * ^4 @6 k( ?! k' J
  13. #include <metaframework/CreateInput.hxx>9 z( ~# s: ], _5 e* I
  14. 7 `3 W: b4 A% z' C5 p( i
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)) {4 s7 m- w4 v0 A' W8 O4 }
  16. {
    , k9 m5 M6 o* O- h- m: D
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    8 d' T0 s, L9 f7 Y$ I7 e

  18. # b( l9 Y7 g; d' o3 S6 j
  19.     int ifail = ITK_ok;
    9 f5 C0 f, n4 y. L
  20. . I3 z- Z% m  k) |/ c! p" b. l
  21.     va_list largs;
    . y1 S. d: K1 G' j; `( b
  22.     va_copy( largs, args );
    5 U4 G" {2 n2 ]& z  Z
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);9 \5 g  P6 o# I# q0 L
  24.     va_end( largs );% y7 N. n4 P( g' }) d, h7 g" E6 g

  25.   |2 l. F2 a! `1 w. z& x, i) L1 W
  26.     tag_t new_item = m->object_tag;   
    2 G8 X' t% i1 a0 Q; ^2 `
  27.     char *uid = NULL;3 V; {3 V; @6 X0 h; v% N2 ]& W
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    & ]1 T; v1 R3 u
  29.     printf("    new_item: %s \n", uid);
    7 C4 n% O3 x6 b+ {
  30.     MEM_free(uid);, ^' s  e3 U' m' r
  31. 3 C: {4 `9 S' X! n# b/ o

  32. 2 r2 \7 s8 N/ X6 }4 L
  33.     bool isNull = true;
    5 }7 k# k! i, Q1 k. Y0 F- X
  34.     tag_t new_rev = NULLTAG;
    + _) p; h6 B* _2 N4 n
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
      v  a: C, w' y1 |+ S
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))) d6 e  \& O& C5 A2 j6 A
  37.     {
    ' n7 e. n% G" i0 R! I5 T5 f
  38.         printf("    new_rev: %u \n", new_rev);% L; Z4 O6 P! M/ D+ e) S
  39.     }  G9 j. {# P' V) S
  40.    
    ( Q* L9 H, `6 y1 }" s, z) f
  41.     tag_t master_form = NULLTAG;
    % N* m; G. P, \$ g6 M, i
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    * V. H6 M, N) x7 R
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    & o2 A; p$ L/ \( z9 z' l
  44.     {, L+ s2 s3 Q& F6 l( I6 c/ k
  45.         printf("    master_form: %u \n", master_form);
    & C: a* s% ^% a2 a3 C
  46.     }
    / w4 @+ W" v2 C) f+ r0 w
  47. & o0 {+ l8 T* ?
  48.     std::string item_id = "";8 V1 X' m1 x  K! q4 u5 j8 q/ @
  49.     ifail = creInput->getString("item_id", item_id, isNull);9 m" ^/ Z4 |. f. y5 u2 L
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))& y' P, L  C5 j2 n, k# Y9 W6 a
  51.     {
    1 W( ~  @7 J2 W5 H8 `; x
  52.         printf("    item_id: %s \n", item_id.c_str());5 Z( r; `( {, T* P7 O( m  d
  53.     }6 x0 j& {" K2 y+ r

  54. ( `. Y- z9 v$ R' J" I
  55.     std::string name = "";
    : l4 l: R, v. Z5 G) f( ?+ M9 G
  56.     ifail = creInput->getString("object_name", name, isNull);
    : B: t3 g: M0 H% ~
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    3 F$ N' P3 J% ^8 g- s
  58.     {$ X6 Z/ Z' o" a. V2 a
  59.         printf("    object_name: %s \n", name.c_str());
    " P! j7 x, [. B. k1 m9 f& N
  60.     }  H0 Q$ g5 Z' g7 U  I* ?: H* P

  61. 0 V: `, D+ j$ g  p5 m; j
  62.     return ifail;;0 Y9 r$ |5 N3 Z1 i0 F" r
  63. }
    - V9 e9 _( w- i( J
复制代码
7 z3 c% S* j' U) T7 j! h0 @8 T0 x
- m# e3 S' H$ y$ f

3 i: U3 k; a7 D' ^* \2 g6 c& t
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了