PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x
) `! D5 ^7 ]/ C9 Q) K# Z* s
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
2 r+ N( j6 [2 W$ Q, m! ~& m
  1. #include <stdarg.h>( q) ?/ E" V1 b, w$ ]% L: e
  2. #include <stdio.h>3 j# C6 P- y# G
  3. #include <stdlib.h>  q3 B# g* f6 i/ z- g/ q% c9 n( b
  4. #include <string.h>; ?1 q3 @8 P1 o9 U4 k% r
  5. #include <UG_va_copy.h>
    1 k! f  J7 \6 t7 t! T8 o
  6. #include <TC/emh.h>, H3 h5 D8 k) F8 P" L
  7. #include <ict/ict_userservice.h>  {' M7 y, R# l, g0 u
  8. #include <itk/bmf.h>: j! Y7 H. d6 V- m$ {
  9. #include <tc/emh.h>; h, ~; s3 I& J2 Q9 c. v/ y
  10. #include <tc/tc.h>
      `( H$ j5 i, f$ G5 J
  11. #include <tccore/item.h>9 c, ?( Q0 v6 ~+ n+ |+ N
  12. #include <tccore/method.h>: S* g. x8 i0 \8 M5 y- s2 m
  13. #include <metaframework/CreateInput.hxx>
    / A1 D$ y$ x! _( ]# }
  14. : M9 P3 A- A, M6 r# o' U: X
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    2 e& z2 K5 E5 W7 J
  16. {2 X& B1 C2 V: Z' M% b9 d
  17.     printf("\n\n A2_gtac_extension_rule \n\n");/ i6 g4 g9 J9 H4 G5 v
  18. 8 O* j" y' b$ Z# r" n
  19.     int ifail = ITK_ok;
    8 j1 C0 G6 Q$ ?" D0 ?' l0 `4 S
  20. # `" O' I) V0 o9 r) w' @9 I& A
  21.     va_list largs;
    + S; q1 q5 y4 g6 N9 Z; q
  22.     va_copy( largs, args );1 h3 ^1 \, |- p5 ?/ f" ~+ r# ~  ]: a
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    & ]# O- M/ f2 ~% F1 B3 P7 s: O- v( b
  24.     va_end( largs );
    7 f/ u! `, Y+ o  _: u9 J# q

  25. 9 A* Y# R) G: _9 G8 e0 A
  26.     tag_t new_item = m->object_tag;    . V# Y" m+ n% |
  27.     char *uid = NULL;
    3 `0 L3 `# n" J- r
  28.     ITK__convert_tag_to_uid(new_item, &uid);) Z- b+ ?2 B; a; G4 V! |" |6 _
  29.     printf("    new_item: %s \n", uid);6 w4 @, Y% F% n2 w
  30.     MEM_free(uid);( j+ v( |! ?: x9 Q, u3 x
  31. % f7 V7 W1 F1 V) O0 k

  32. / x; O. f  q( [# }7 L
  33.     bool isNull = true;
    ( G- z" A" x0 n7 p
  34.     tag_t new_rev = NULLTAG;
    * Z, K9 O  B0 ]; o6 w% g
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    9 C+ h. B3 U1 N& g& ?) }
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    . K+ n8 U# d2 o) y8 k
  37.     {
    # |# c2 P( p0 F' y# U
  38.         printf("    new_rev: %u \n", new_rev);
    4 L/ t+ T4 J1 G8 u: Q
  39.     }
    - S1 x* d  J  u2 R, T
  40.     & j1 K7 @& `0 t3 V# T+ I* h7 Z) h
  41.     tag_t master_form = NULLTAG;0 G" x. q; X, A4 k; H) i
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    6 ]) K4 H5 A2 ?2 F4 u. H. q% D
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    7 u, [6 s$ @9 h/ T
  44.     {
    : ^. R  {: t( M7 `
  45.         printf("    master_form: %u \n", master_form);/ ~7 n) e# u$ c( M- {6 V
  46.     }
    . E7 {1 v( e0 V

  47. % x# ?4 i7 P4 Z
  48.     std::string item_id = "";+ Q7 ^+ {, G( ~2 f
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    ( x* e; |& {4 F0 [
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))( H/ q9 E# X5 W5 {
  51.     {7 B" g! |, P  s  [2 k
  52.         printf("    item_id: %s \n", item_id.c_str());' [* `; A3 r  ]. |* e8 l
  53.     }
    ( H% v; n1 K8 S1 b# D4 `
  54. ' E' t) r1 r, j
  55.     std::string name = "";
    : J- N4 J8 u, O: A. w& i% C8 E  {
  56.     ifail = creInput->getString("object_name", name, isNull);
    + Z- N) O; o, N8 N" i1 X7 |
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))0 J3 p! W/ e0 x
  58.     {: W  v( T/ [% a
  59.         printf("    object_name: %s \n", name.c_str());1 F  d5 P, m. s# [
  60.     }3 Q4 k4 w  _$ ^$ {) I5 h7 z
  61. $ p0 j8 H5 Z; A4 K
  62.     return ifail;;) C) X- A3 f3 B1 v
  63. }  J% l) z+ m' R/ W
复制代码

2 w5 c2 R0 t0 V& g
. q6 D# J& l: g. z0 W* J1 d5 L5 M, C! a$ `" R  Z
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了