|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* `/ h) L# Q" [# cTeamcenter ITK二次开发源码分享: Item 创建 createpost操作
. p# `7 Z B- ^1 K& X* a( X- #include <stdarg.h>: C& p& r: O Z! ]
- #include <stdio.h>
* r' R3 T: \& f* W - #include <stdlib.h>
2 u, ]% p$ M: p9 Q2 c/ o - #include <string.h>
/ s9 S8 y# g- X7 I1 Z, A - #include <UG_va_copy.h>
/ r+ ?7 W( w1 n- a7 w8 S, d5 H - #include <TC/emh.h>0 Q) N5 r6 T6 ^+ ] T* u+ n' A% U
- #include <ict/ict_userservice.h>0 A ]/ o* ?8 a4 K
- #include <itk/bmf.h>5 p: s+ |% H. o& d
- #include <tc/emh.h>
) d, A1 D; X0 @0 } z, M - #include <tc/tc.h>
R6 a! L c& k - #include <tccore/item.h>3 R" x' _7 g8 N( L3 q
- #include <tccore/method.h>7 G3 E3 i* Z& q' M# k4 Q6 F% Z
- #include <metaframework/CreateInput.hxx>
$ r" \, Y/ d4 g# o - N/ h) [; c: Z: I/ f; [ Z
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)2 X- V; n9 B( \+ ~4 z8 [
- {( f6 z5 g7 B4 c% n) {% j7 n
- printf("\n\n A2_gtac_extension_rule \n\n");
! `9 E0 c. ^/ g4 d# y - ' u8 F& u8 [) n/ y; S5 d" E8 X
- int ifail = ITK_ok;5 u9 p% L! C6 H
! E& b( p" \( q P2 O" p0 P- va_list largs;
, y+ D3 b' ~+ c - va_copy( largs, args );
3 \/ W1 T: i/ Q* d& H, k! ?* t" H - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);$ V3 E( @7 a; M) N7 W" `( ]
- va_end( largs );3 t1 i3 }9 R; x9 P. f* i
- \2 @3 w. J6 q7 _- tag_t new_item = m->object_tag;
2 q2 I/ n p1 b8 \ - char *uid = NULL;
0 u2 f1 t# ^! ? d: v# y# ?" f/ r - ITK__convert_tag_to_uid(new_item, &uid);
A6 S& ^0 u* u, _; S* E - printf(" new_item: %s \n", uid);
+ a7 @6 {5 d2 o. U8 C, m; N/ i& O - MEM_free(uid);
% e( w3 N, T& L, G+ d+ }5 ? - ( m/ v+ ~7 z/ `( c
- p8 g; x" a! @( a, M0 @
- bool isNull = true;
5 [4 d4 e3 ` s+ L+ i - tag_t new_rev = NULLTAG;) p- w/ w7 g9 J( s$ ?: p0 W- U
- ifail = creInput->getTag("revision", new_rev, isNull);2 D- J' f5 a; f7 ^# ~" z
- if((isNull == FALSE)&& (ifail == ITK_ok))+ g3 N# u- q( b, v. W
- {
3 x0 `( U+ f# B2 d( s - printf(" new_rev: %u \n", new_rev);
) U' x. x$ H, k! P1 J2 k2 _ - }
2 L3 [& j. Z; |& k - G6 K9 Y/ @4 L0 Z* t8 Z2 @" t5 R- Y
- tag_t master_form = NULLTAG;
: R" q7 s; t+ B; g1 w - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
- v4 d. d+ d3 y: d5 k( c! X1 K; | - if((isNull == FALSE)&& (ifail == ITK_ok))3 J; ^) U/ i1 F* q/ o8 r! m, s
- {3 ]- N- v" b( f/ L; n7 J$ |( F
- printf(" master_form: %u \n", master_form);/ _, Q) K' r3 j9 K: u/ y4 C
- }
y/ k+ M4 B) ]
. d1 e( ^- Z( p/ Q2 v% D- std::string item_id = "";
+ _) |" ~4 M! }" g8 L1 }9 D4 S - ifail = creInput->getString("item_id", item_id, isNull);
! w; O& `( J1 x" D - if((isNull == FALSE)&& (ifail == ITK_ok))) t! F4 X1 e( h8 Z/ y; q& n1 j
- { k1 M* U6 _$ ^/ G# ?* g. w% N
- printf(" item_id: %s \n", item_id.c_str());+ A8 W0 Z5 K' t' n
- }
5 ?4 _+ B/ q7 P6 G; p8 a6 s) V
' N: w3 l6 b$ w0 N5 y$ V- std::string name = "";: K$ w" b8 C. |! n
- ifail = creInput->getString("object_name", name, isNull);0 ]3 o% o, x( C* E/ E
- if((isNull == FALSE)&& (ifail == ITK_ok))9 n, q% g3 n- e. u
- {: ]- a* f8 { {2 y0 t+ M
- printf(" object_name: %s \n", name.c_str());! [7 c& Y4 u4 l# c: m! O% @( V
- }+ d' J1 V( U8 I) Y# I8 `: A( d
# ^; Y9 P& W8 H& ~- return ifail;;
; F+ r9 g$ C* u. i% h# ] - }1 R$ u1 t& d- _1 ?: Q" G
复制代码
, E$ ^! s; K: T. k; T( y
' R8 N* u( k2 d5 H+ c4 q# W: e$ d( Q9 r5 _/ Y& k
|
|