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

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

[复制链接]

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

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

admin 楼主

2014-1-15 19:33:29

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

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

x
8 B7 y4 b9 F) J
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作+ T5 X0 p( {$ Q8 P' z3 H
  1. #include <stdarg.h>
    5 o. ]8 L% b7 s. i
  2. #include <stdio.h>
    3 f/ ]( }+ b' j0 C6 ~4 k
  3. #include <stdlib.h>" @* H( i# b7 T8 J/ S
  4. #include <string.h>
    7 B4 \: k) B5 U; n
  5. #include <UG_va_copy.h>
    % l1 n0 n5 a/ l5 D
  6. #include <TC/emh.h>( Q' H6 k) i) i$ o& m. I9 ]9 L
  7. #include <ict/ict_userservice.h>
    3 n1 g, F8 t5 d; ^& ^8 ~
  8. #include <itk/bmf.h>7 Y! L, K5 U( e. ^2 S+ i! K
  9. #include <tc/emh.h>
    / B0 s+ e" k3 D+ }; V
  10. #include <tc/tc.h>; Q* t* n/ e6 Q% _* l
  11. #include <tccore/item.h># [$ d  F) k* J1 T0 X( x8 k. {2 I
  12. #include <tccore/method.h>
    4 g. R& p* c8 f3 t" F7 S
  13. #include <metaframework/CreateInput.hxx>
    # D2 G# s0 L/ J1 i# W# G

  14. # q3 T( O, v% h- \7 ]) k/ W
  15. extern "C" DLLAPI int  A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
    : H! ?2 R. e1 @/ x& @
  16. {
    , p! {* r* W3 g4 i
  17.     printf("\n\n A2_gtac_extension_rule \n\n");4 ~! o8 v7 K5 C4 h, D9 p
  18. 5 h. I; g* j7 J6 i" l* m2 @
  19.     int ifail = ITK_ok;# I2 _; ~8 T; M4 z9 j7 Y
  20. " N! L  }$ W! `" P4 _
  21.     va_list largs;
    0 ?/ R/ R6 Z/ c6 {
  22.     va_copy( largs, args );8 X2 ^, t1 ]& ]; G: F! K9 d
  23.     Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);( _; a3 \& _9 E1 d. t* a# v9 ^
  24.     va_end( largs );" \: ~7 Q8 m* j. g
  25. ; z8 j& q2 O9 X
  26.     tag_t new_item = m->object_tag;    : F* [1 z$ u$ a) Y( }3 r1 p. _
  27.     char *uid = NULL;
    " L  Z4 {( `& Z: j# _3 H
  28.     ITK__convert_tag_to_uid(new_item, &uid);
    0 L4 B' }+ h7 o* O% V
  29.     printf("    new_item: %s \n", uid);
    4 E% v' q) c5 j/ q
  30.     MEM_free(uid);
    " o& T0 q& p- ^  f  L: \

  31. " R, U: W) l* w6 O8 P2 _

  32. ' ]. D% s9 @1 z; m  r
  33.     bool isNull = true;  N% k7 s4 e+ `' o
  34.     tag_t new_rev = NULLTAG;9 g( u# g2 f  C5 [1 o
  35.     ifail = creInput->getTag("revision", new_rev, isNull);
    1 R' S# N; v$ b' [/ b
  36.     if((isNull == FALSE)&& (ifail == ITK_ok))- Y; A2 O0 [) K
  37.     {! y# r4 p5 j* i0 [
  38.         printf("    new_rev: %u \n", new_rev);2 q! i7 ^) f8 E  I
  39.     }
    ' c& l# h- G5 ?5 ]- A) o2 u6 w4 ?! I2 s
  40.    
    0 k6 o) A+ c% ?, J* {
  41.     tag_t master_form = NULLTAG;
    / F: E, Z3 |1 s" ^
  42.     ifail = creInput->getTag("IMAN_master_form", master_form, isNull);' _. |+ O2 w( Q$ {1 x
  43.     if((isNull == FALSE)&& (ifail == ITK_ok))( N3 M! A# [* @: Y3 d0 y
  44.     {
    ' f2 C# D0 H( A
  45.         printf("    master_form: %u \n", master_form);- Y& x; o  u; Q0 s
  46.     }
    ; ?5 W8 e/ f2 B$ l+ J+ \/ W

  47. & M8 {9 `: `* Y2 X, t' e0 l
  48.     std::string item_id = "";% V+ `1 g& r) j
  49.     ifail = creInput->getString("item_id", item_id, isNull);# o% V" p1 }1 i4 _
  50.     if((isNull == FALSE)&& (ifail == ITK_ok))8 r2 @' R, a' R4 y" o4 y# `: P
  51.     {
    " @2 }3 ?, ~+ F5 t
  52.         printf("    item_id: %s \n", item_id.c_str());
    0 T/ `* m5 W. D  x" f
  53.     }
    8 P- i4 d$ d* o7 D
  54. # V& A9 `" h3 s2 x& C  E
  55.     std::string name = "";# T& k9 I- d* Y
  56.     ifail = creInput->getString("object_name", name, isNull);
    ' Y6 I2 O5 d* s3 X6 B/ s
  57.     if((isNull == FALSE)&& (ifail == ITK_ok))0 F6 m  A, q  s
  58.     {  C. U" `, u) u% s3 z, e, L" U- x3 {
  59.         printf("    object_name: %s \n", name.c_str());$ ?6 L$ e6 D) I# c
  60.     }
    : X3 g" V7 ~' `, B, F4 ?- i
  61. & S: D$ J. C. H- t+ u
  62.     return ifail;;
    0 g' D% l* V+ X* i6 R4 J3 g* M. U
  63. }% z; `, r8 y7 O  m# [
复制代码
. O4 e4 }+ ~5 }2 J3 u6 l, w0 M5 f. t
& v3 Y' J! P$ O: Q
1 {/ l* h$ Y# {. F4 ]
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了