|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# w$ u; L! [. N! B0 }. |
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作& o% d+ \" _$ i3 a' U
- #include <stdarg.h>9 z; d0 w, c7 A w+ ~+ H7 X
- #include <stdio.h>8 _& f* g n$ D8 M$ `
- #include <stdlib.h>0 ]1 y! h, [ m- t
- #include <string.h>
7 [) v$ D( x- K5 _5 ^) H& ~ - #include <UG_va_copy.h># S/ q4 O8 l0 ?0 @5 |% j
- #include <TC/emh.h> ?- p# p$ T1 `3 D" R3 K
- #include <ict/ict_userservice.h>
, w7 O- L1 M# M; o1 i* ^' r - #include <itk/bmf.h>
# S( [% L' W. ?, k2 F - #include <tc/emh.h>
# g3 X2 @5 F- p6 R% M; r; u8 j - #include <tc/tc.h>5 S( K% V. P; o
- #include <tccore/item.h>3 A* d4 U6 C! N; g
- #include <tccore/method.h>; a' `* n2 {7 r& b3 ?9 Z7 c
- #include <metaframework/CreateInput.hxx>
& d& N. m3 S4 [
# _( J( c n8 C R( r G. W- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)+ C7 s, u2 i* r! v, B
- {7 p* i: k) j I/ N$ b% F
- printf("\n\n A2_gtac_extension_rule \n\n");
K3 J1 g/ U, ~( `5 ?2 O' m" L
0 L/ I, C' ^4 k' p7 U- U2 b- int ifail = ITK_ok;* Z9 `9 ]$ K2 e {, P/ E
9 h W) @7 E! `- va_list largs;
- u5 Z9 p5 ]; m! G( B - va_copy( largs, args );" [ i& ?2 v8 L' h! ~
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
, A a( e( I- x) w& d: d5 r - va_end( largs );+ J3 ~0 ~( N4 U6 y# N" l, [0 M
8 a0 K! @, t; a7 I1 J- tag_t new_item = m->object_tag;
; ^" @( ^1 G3 T, |8 I# G - char *uid = NULL;
; c% y. d* P L* E) e - ITK__convert_tag_to_uid(new_item, &uid);
z( X6 H0 I! h. H3 `& _- B5 ~0 g8 n - printf(" new_item: %s \n", uid);
: Y- @( U! b9 I- q0 C - MEM_free(uid);
( V$ O6 s7 C. R - # f+ i' r. E( T4 k5 U
- : o$ o5 @; i* N8 h7 R0 v
- bool isNull = true;$ g( v' |7 Y0 e" N9 \
- tag_t new_rev = NULLTAG;1 V0 v, l( `. h7 E& [+ Y
- ifail = creInput->getTag("revision", new_rev, isNull);
1 [) f3 w+ q6 e2 ^' S- T - if((isNull == FALSE)&& (ifail == ITK_ok))
9 G6 T! s; g0 l% D9 { - {
) p# d9 ?& l! a( s2 f2 t6 x - printf(" new_rev: %u \n", new_rev);
' s5 p) U/ o% r6 i' d) G - }
+ V7 x' \' H& R) @& U5 W7 n - + f/ S( _( @. p( ]% `# H
- tag_t master_form = NULLTAG;
& E1 ^# f) l3 g& w: N$ e3 T - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);% O6 v& t# y. x: v7 p$ }
- if((isNull == FALSE)&& (ifail == ITK_ok))
5 n4 t2 V2 E V/ f# }9 T+ G* e; _% ~ - {4 L, C& R. U/ Z
- printf(" master_form: %u \n", master_form);
* L2 N& B" W5 s5 U% S- H - }
9 Y" E. ?9 u, _, [3 C( L - 0 Q' B; I* O% h; {: M) a
- std::string item_id = "";
& L6 N0 L: f5 {. P - ifail = creInput->getString("item_id", item_id, isNull);+ c$ }) S* @/ i% W# i& F) y% S+ h" E
- if((isNull == FALSE)&& (ifail == ITK_ok))
* l" A; l) [9 |7 v/ I1 R - {* m2 s- X0 K5 i" M; M
- printf(" item_id: %s \n", item_id.c_str());' z+ R6 `2 S8 L* E5 E% l/ `* p
- }
1 n6 q. o. ]+ ~6 _ - ! H$ _; A* E V% k7 ]6 X1 x7 v
- std::string name = "";
# _: p, c4 g: q - ifail = creInput->getString("object_name", name, isNull);
% D8 [% u( R: I3 Z - if((isNull == FALSE)&& (ifail == ITK_ok))
0 A. X! U: c, m; B% L8 K, p5 t+ w - {
1 e9 x( J! G( i: t. R; a - printf(" object_name: %s \n", name.c_str());
' i- Z* h: h) H# @5 B4 p: | - }. Z/ z0 k8 A8 H/ A0 @7 O
- # \- E: O: m% P9 ?4 U
- return ifail;;
7 x0 R7 ^& a% B; a. e - }
( j# M2 z9 R& A( q& ]
复制代码 + k) _! L1 L8 z" f* o
' {$ W' ]! s. F& B3 ^! n
# h% j3 M7 P/ ? |
|