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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x
3 r1 J/ M4 F, G, g# P. o5 W; f* w
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作+ z/ e% E/ y- E0 c* O0 H5 T  S0 L
  1. #include <stdarg.h>
    . n, f# Q9 w" D3 S3 u8 N
  2. #include <stdio.h>: ?3 B, s& K6 ^' o0 f1 q
  3. #include <stdlib.h>- C* r' i- N# z# v# q5 ]
  4. #include <string.h>
    & D* P+ A. S: V5 T6 R
  5. #include <UG_va_copy.h>
    3 k( Y6 I: z" Y: M+ h' R
  6. #include <TC/emh.h>
    + k" A; I2 @/ D% T2 x" G, t! E
  7. #include <ict/ict_userservice.h>1 X& f) y2 V  @0 s/ q5 H5 w
  8. #include <itk/bmf.h>; a2 F/ U8 a- l
  9. #include <tc/emh.h>% h. S, M6 U* n8 G6 V
  10. #include <tc/tc.h>: y0 h4 d+ B; z
  11. #include <tccore/item.h>6 t* j3 U- s) `( y/ U
  12. #include <tccore/method.h>
    % j0 n" E8 Y; p- F' k, b/ Z2 E
  13. #include <metaframework/CreateInput.hxx>9 W6 R& Z- x4 ^* A, a
  14. ! |+ ~2 i+ L1 n( H$ z
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    . F1 N* g. D4 t4 W/ {$ k, r/ A" W- W
  16. {
    1 R. M1 F4 e  c0 P' Q
  17.     printf("\n\n A2_gtac_extension_rule \n\n");
    ( U+ h5 g1 j- E

  18. ( _1 B. P4 z& \/ P
  19.     int ifail = ITK_ok;( r1 |$ m- U: w3 c7 O5 K
  20. 8 O9 d/ P6 ?: V4 @( w3 O
  21.     va_list largs;8 _9 }0 b6 V' F2 \1 y% B+ B1 \& B
  22.     va_copy( largs, args );0 J; d& b, G+ _) o0 I' L
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);, b4 V1 @% Q/ ]. Q- G; @2 p
  24.     va_end( largs );3 @% k( g4 ?* c3 \; x/ u
  25. % M( r9 }0 l# W; g! n6 ]
  26.     tag_t new_item = m->object_tag;   
    & z/ H( U: H1 n2 \7 R! V9 z1 `
  27.     char *uid = NULL;
    " N2 |5 S. A1 V( e
  28.     ITK__convert_tag_to_uid(new_item, &uid);7 s* M+ Q' Q1 O
  29.     printf("    new_item: %s \n", uid);' ^% E8 s/ z: e# m
  30.     MEM_free(uid);: M4 r2 |8 u5 s

  31. : P" [3 V- H0 g' D- p

  32. + G- F- e/ `  ?* y
  33.     bool isNull = true;
    8 o/ a) D* Q+ x* ]/ F$ F5 p+ g
  34.     tag_t new_rev = NULLTAG;6 h0 o, a4 a6 D$ f2 U1 m
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    0 }' B* g8 p# S; Q' y
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))
    4 S4 w1 P$ m9 q- {" a
  37.     {0 o: T+ h! s+ \) K
  38.         printf("    new_rev: %u \n", new_rev);
    # F8 \2 R# h, {
  39.     }7 g6 `. G/ |* O3 }
  40.     & j; a5 B2 F( C. B& P4 V: K# n  W) ^& K* N
  41.     tag_t master_form = NULLTAG;4 {6 f- n9 Q$ ~, u
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    ) M- f3 {$ ]5 W6 V9 t6 O
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))
    . M# n7 C. u) ~- J* {' a
  44.     {1 K/ M7 k  x; t, s2 q
  45.         printf("    master_form: %u \n", master_form);
    ! w) [& [4 J  h, Z$ q2 A" o
  46.     }. w. g2 J* l5 c8 U. C5 }9 o

  47. , E5 `# @8 d! p' Z: d
  48.     std::string item_id = "";
    ' B: ]" g7 I! }6 N2 s6 |/ @
  49.     ifail = creInput->getString("item_id", item_id, isNull);
    3 z) u0 V& i/ G
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))  I0 T3 y5 G, Q
  51.     {. W+ }3 [* X$ r1 l
  52.         printf("    item_id: %s \n", item_id.c_str());
    / P7 j) d5 [/ k3 O. ]8 h. j. Q( r  Y
  53.     }
    : k1 x! |/ Q8 Z" ^; N

  54. # M! @, k5 X/ c. ?
  55.     std::string name = "";. I" w  x' }2 l2 k0 q# S& h
  56.     ifail = creInput->getString("object_name", name, isNull);/ p7 n. v( r7 S/ o$ @
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))
    ; o  H1 D9 k: s+ J6 ^
  58.     {* k: v/ z. w1 M# C9 D# a  a
  59.         printf("    object_name: %s \n", name.c_str());
    1 B6 k9 x& k4 g3 a) b. k
  60.     }6 |% P' s. f: ^2 v. g9 U

  61. ' E  h" {4 j' ^( F0 b3 O  y, W1 [
  62.     return ifail;;# Y- y& p% ?3 K4 a! Z+ l9 @: E
  63. }- d* k1 B) @0 g$ ]" m- F
复制代码

4 m9 u# X; j, `! S; J8 q3 y
# @+ _. D1 G8 D% B
0 c9 ?  E  Y$ {/ g2 ~3 O# v
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了