|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& D/ i9 \2 q* FTeamcenter ITK二次开发源码分享: Item 创建 createpost操作7 C1 m8 n: l, m: i- k
- #include <stdarg.h>
! _/ i& P+ b+ ~. z - #include <stdio.h>3 L5 V6 ^% |, G4 z# c7 c* L9 H J
- #include <stdlib.h>* {2 P. D! J6 G9 o% p7 y8 ~$ u8 }
- #include <string.h>$ \/ C. V& g1 r/ y( n! B! q
- #include <UG_va_copy.h>& r% U5 o# K' O7 r4 _6 K
- #include <TC/emh.h>
1 o( N& }# n' u. `5 e* e - #include <ict/ict_userservice.h>. h" W. C$ @9 A- e, o, Q1 ?
- #include <itk/bmf.h>- U. s( `7 n) x( I6 t( H2 |
- #include <tc/emh.h>" b) v9 M/ ~$ q0 B; F" ], _
- #include <tc/tc.h>0 z* z1 l( }, ] Z! B
- #include <tccore/item.h>
$ [. X; e0 I+ H1 C- Z$ s1 k3 d - #include <tccore/method.h>
3 m0 o' X8 p! o9 M, x - #include <metaframework/CreateInput.hxx>7 h+ `( `) d1 H2 V* ?6 f: y2 G
' r5 K; Y# X R: P5 D5 ]- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)# J+ W; E7 J. l: N) q
- {
$ ^6 M( `6 \2 m8 G6 ], \& { - printf("\n\n A2_gtac_extension_rule \n\n");8 K6 c7 q* x! p) x& X
- p. g+ X% c' {; B$ L- int ifail = ITK_ok;
% ]) ^4 ~& V3 b- |" z4 f - 8 z( f$ c% F4 H
- va_list largs;
) J0 q9 E9 s6 \! F' U8 p - va_copy( largs, args );: u! ^8 Y, q# L
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
5 ?: y% b1 y6 M# l' Z - va_end( largs );" z; T+ o/ G9 K+ t3 ^
% Y; K: V% s. N0 c* K3 b- tag_t new_item = m->object_tag;
9 z6 O1 p) A" B/ ~ - char *uid = NULL;
' c+ j# r! [. Q - ITK__convert_tag_to_uid(new_item, &uid);# T o5 M# r1 c! ]7 a
- printf(" new_item: %s \n", uid);
0 k4 T- Y" Y, N( B9 e/ O - MEM_free(uid); u2 j; k! e" k& D$ e! ~
- 8 m3 C+ t5 V5 X, Q5 |# k' k
6 g& A n9 O2 ~3 k2 X" Y( i" m- bool isNull = true;9 c: p" w# V7 ?, I3 x, r
- tag_t new_rev = NULLTAG;' \, G! }) m7 c8 l" Q1 L& Z
- ifail = creInput->getTag("revision", new_rev, isNull);
9 r5 [, I; A' p/ c( \6 b1 g - if((isNull == FALSE)&& (ifail == ITK_ok))" h0 \6 ?- c- a4 M& k& m0 A6 t
- {% I; ?- ?+ _5 _4 a2 r# q# K+ o4 [
- printf(" new_rev: %u \n", new_rev);2 c$ w+ H- E) \. S. b
- }
& P8 ^4 t" M, S0 U, U/ k - / u. u# ~ E2 |% v T! Q: @/ g# ~, J
- tag_t master_form = NULLTAG;
$ x# I. Z3 @, `) s( J3 L - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);8 W7 _1 d( i( N- B. J% Q+ u1 U7 y( U
- if((isNull == FALSE)&& (ifail == ITK_ok))
3 b. M q9 M- S$ J - {) p. x7 ?/ }) Z4 P
- printf(" master_form: %u \n", master_form);
) o% l6 p4 ~: }7 L$ y' C - }* ?8 ~% n$ O# g
$ n9 M* B: a' S3 p- \$ L9 p4 {- std::string item_id = "";
- u* K- e$ f) H. @3 q! ], P - ifail = creInput->getString("item_id", item_id, isNull);
' j3 Z5 E& ^6 H% q - if((isNull == FALSE)&& (ifail == ITK_ok))( q! Y' a' ]5 a% E4 U
- {
4 F4 X: t, Z- F9 M+ o3 t1 P. P - printf(" item_id: %s \n", item_id.c_str());, O, z7 y4 P8 ^9 J
- }$ d8 q% i3 l. P. ] S1 r* x( {
: \7 U1 l' B$ _" w, H. p! P- std::string name = "";
% {+ g. H/ s" V) d" u( _! J - ifail = creInput->getString("object_name", name, isNull);* ?- a3 O# K. H, u1 e' U* @
- if((isNull == FALSE)&& (ifail == ITK_ok))
9 M2 ~9 g9 z6 P ?) v - {$ v; l$ W0 E4 _2 q; O% C* |7 @
- printf(" object_name: %s \n", name.c_str());
0 ~9 Z, q9 R) K( N. |8 ^* T - }
7 B/ |- T; f6 d5 d6 j7 g1 ^
. ~6 u5 w$ |, ~ w: R$ X- return ifail;;
6 N3 ]' W! e3 U! i; s4 B - }
" k: n+ ~5 B* k! p: P5 [0 K& i: S/ O
复制代码 : j7 y) m% H: S/ r
" _- }( V8 p( v& c* r& w4 X
! j g r. W) z, D1 [& k |
|