|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: t6 h. |1 e8 `9 u. m( {. |
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
* t' c1 \+ |7 q; r, g7 W; x3 m- #include <stdarg.h>
8 I+ [0 y9 O# i - #include <stdio.h>3 b; e: k( @' w. v* N' U+ g, s: l% K. L
- #include <stdlib.h>( X0 d) o! ^1 Y1 ?4 B
- #include <string.h>; i+ T6 D* @+ X6 @9 X
- #include <UG_va_copy.h>. V: D; s5 Z# D: j
- #include <TC/emh.h>
& i% c) Z( q# X1 k( W$ E7 V - #include <ict/ict_userservice.h>1 B" s( G F1 X7 C a% s \' K
- #include <itk/bmf.h>
3 j2 r$ G& J# g1 L# x - #include <tc/emh.h>. n3 Y4 ^9 n5 r$ j
- #include <tc/tc.h>+ j, {3 z( M' m3 H7 ]
- #include <tccore/item.h>. B6 q' t$ L. m
- #include <tccore/method.h>
2 k5 }0 H9 J4 D& \; P/ { - #include <metaframework/CreateInput.hxx>( C" ~4 F& G1 z/ ]
& z* _7 I' R4 i) I- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
* [ L, ?: J. Q' `/ [: y5 Q9 u - {& B8 K* Y. H, r5 d
- printf("\n\n A2_gtac_extension_rule \n\n");" a; p% _3 l5 I( f: V
- 4 e/ A' |. \5 q" s3 J7 A
- int ifail = ITK_ok;! I: t) D' G% _! m, y/ X
- # q2 U; P! B' H0 H$ t* j1 j# C
- va_list largs;
# t4 O3 R' H' e8 Y/ ` - va_copy( largs, args );: [7 i. m8 W5 w' J$ a+ W
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);3 N& Y2 F5 \+ C2 z; T& o) m
- va_end( largs );1 U) ?$ `4 C6 t$ X- O+ s g, |
- ; e$ Q3 e5 t. |% \! ^9 E/ }
- tag_t new_item = m->object_tag;
, t! k0 z* o' a) ^- s- j - char *uid = NULL;
& ?, \; Y# E$ V4 j- z& H r/ l% n - ITK__convert_tag_to_uid(new_item, &uid);
1 n7 |& k* n2 u" l( u5 A - printf(" new_item: %s \n", uid);3 g1 }; }" f) F7 m
- MEM_free(uid);5 B! [* U* i, P3 H
- " Q, j' i3 o1 ?' d) N$ g: ?' Y
( ?; R3 |7 M. w8 G- bool isNull = true;* G" c" L" t G' F% f3 g# R C8 M
- tag_t new_rev = NULLTAG;
9 |$ o* I1 I0 ]- J! I - ifail = creInput->getTag("revision", new_rev, isNull);
0 o$ A) f5 v0 o; a( f; `, g - if((isNull == FALSE)&& (ifail == ITK_ok))
( L3 R" \3 z* B' }' H G - {. U! j* Q% M, m8 s% m; a4 [
- printf(" new_rev: %u \n", new_rev);
- z U" U, W( s$ v9 |1 z - }
, z; T* ]& w% D - & h( g1 f7 N* {- m& b
- tag_t master_form = NULLTAG;
! s" ^8 b; a1 Y) m9 E- F d3 k3 ?7 ~+ d - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
9 h6 H: \( \% Z( Q/ ` - if((isNull == FALSE)&& (ifail == ITK_ok))/ {* i# j9 D8 M) ]- {
- {- Z5 l7 A0 O) E. t! B: W( S
- printf(" master_form: %u \n", master_form);
' l+ ~- c y0 G( S9 \ - }
- b4 Y8 d8 E# m* H. M& ?# U( f
. l8 @ H0 S; ~) c( o6 d- std::string item_id = "";
m! B6 \+ M0 V7 m! Q, r - ifail = creInput->getString("item_id", item_id, isNull);* B2 S: X. ` s
- if((isNull == FALSE)&& (ifail == ITK_ok))
2 \ R) o$ `0 C5 d/ c4 Y0 u% y - {3 h0 {1 e: S9 y( |
- printf(" item_id: %s \n", item_id.c_str());
. L2 K1 x/ x! M1 g! t - }
% t9 E4 E. `* C! \% G' n h( E
& h. ^+ P# U" e5 e2 h9 c8 U- std::string name = "";
( ~: S3 e9 ]) T: o - ifail = creInput->getString("object_name", name, isNull);
* [% ]1 F, H$ N3 ^# Y- K - if((isNull == FALSE)&& (ifail == ITK_ok))
9 L/ A8 H: c! I" @0 g4 B - {
$ J B" Z1 V6 Y- B- j, W4 X - printf(" object_name: %s \n", name.c_str());, G" }& D) b% W2 U
- }7 Z6 _4 H5 y6 U
- 2 C! U2 i+ W; S. Q: _% {% `. N8 s& R f
- return ifail;;
+ ?) L. R, h8 V- J - }+ |3 v; P$ T6 E: ?$ P
复制代码 ; Y; _8 D6 \3 ^+ m0 V/ N3 w
6 X+ ]0 ?4 f, O' ~" ]; q9 \
( W4 V. p) L: N( ?: S- `% h% f |
|