|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
! L( @: _1 i$ [/ T9 S T& Z
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 T0 R$ ~4 E% R: r7 E- #include <stdarg.h>
0 m& V! Y; c: I" Q. U: C/ q - #include <stdio.h>; i; k- X8 Z7 e' a! l% r+ e
- #include <stdlib.h>7 m2 V; n* v q, H1 B) ?
- #include <string.h>; P7 p5 n, o f
- #include <UG_va_copy.h>1 `9 w8 _" ~% C0 q
- #include <TC/emh.h>3 o- a( C4 I- W; i/ U1 {
- #include <ict/ict_userservice.h>
4 a3 B2 w$ b6 X - #include <itk/bmf.h>2 Y# P$ q2 C) a
- #include <tc/emh.h>
. P7 B9 R' D r V - #include <tc/tc.h>
2 B" J0 d. x" M8 d" M7 Q - #include <tccore/item.h>, Z. b) @ v# g; c1 c
- #include <tccore/method.h>. s X. F' D6 S& [+ V2 ^1 H
- #include <metaframework/CreateInput.hxx>/ U, U6 `8 K9 h$ i& m* d% M
- 4 j) Y s: J2 `* d# Y1 j
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
! \# n; G4 o8 f& q& N- ` - {3 r- o6 w( m L+ R" A4 d% h
- printf("\n\n A2_gtac_extension_rule \n\n");$ [% c; N) A1 C& C& b) j7 j# ~; z
! K% w; X* [1 j- int ifail = ITK_ok;
" D8 ~+ u( N5 x* K6 T - . X% [, x9 ~' U0 s& o8 N& V4 V
- va_list largs;
" Q( O: [1 D2 k) d- x9 Z! w, e/ g4 M - va_copy( largs, args );) X$ M; M$ q2 @, w0 Z: h; v L- G$ T% U
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);' h" P6 q8 {; l! e3 z
- va_end( largs );
; H+ x* L# i4 j \8 L - ; o7 {3 R# J6 Q( M; F0 V
- tag_t new_item = m->object_tag; 0 X# ^4 S/ @1 I1 H/ J& s' |
- char *uid = NULL;
A u1 n3 v9 B - ITK__convert_tag_to_uid(new_item, &uid);6 B& {( a; N: T, N; [8 U& Y6 w
- printf(" new_item: %s \n", uid);
$ M0 Y6 U [& @# u" L1 F& ?0 x5 T( u3 A - MEM_free(uid);
6 G; q0 { T6 e5 @ - i+ w7 h" ~5 X$ Y0 p6 [
- 0 |) k i7 \ y2 H5 J4 Q# x
- bool isNull = true;0 u0 T2 l# B6 X% W
- tag_t new_rev = NULLTAG;
. P2 x4 ?1 x" t8 g' e* L - ifail = creInput->getTag("revision", new_rev, isNull);
3 e" m. d5 _0 ]% F% O. Z7 p, v* D$ h) W - if((isNull == FALSE)&& (ifail == ITK_ok))
5 l& N; A' B: J% l- u! L - {
2 e( F0 X: }1 X2 E4 S& O1 P. e - printf(" new_rev: %u \n", new_rev);0 L1 B1 H; j8 z/ M# y# G+ W, y
- }3 h3 t: l% c: k0 L; Y0 S0 ^
-
E9 p7 L m2 ~8 L' f - tag_t master_form = NULLTAG;; g' p4 n5 j9 `- O& C
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
4 ^3 g& \/ m4 Z/ ]7 I - if((isNull == FALSE)&& (ifail == ITK_ok)): z7 O' ? J, A+ F
- {
8 r) l. C! O4 _, o - printf(" master_form: %u \n", master_form);7 r: J) l/ f& x# S0 i5 l
- }
7 T% X: B! x. ?$ o" ^
* C7 h8 B3 Q& C# s' D& x- std::string item_id = "";
7 i: X. Z4 q% b - ifail = creInput->getString("item_id", item_id, isNull);
3 M- [2 D. a" E3 _! i8 T( a - if((isNull == FALSE)&& (ifail == ITK_ok)): w/ D1 U1 @ u4 ~( f; Z
- {/ {' ^9 X! q& h7 [1 L' j5 f, d3 _: S
- printf(" item_id: %s \n", item_id.c_str());
Y' ]$ H, e/ n" R - }
6 p: B+ P# c4 g
* ?, E6 u' G8 z- std::string name = "";
3 o9 q/ ^% I* P4 I+ [0 j- d - ifail = creInput->getString("object_name", name, isNull);
; i$ \, d, X+ c4 V" _4 n h - if((isNull == FALSE)&& (ifail == ITK_ok)), T8 Y# C+ F5 ^8 P. i4 Q
- {
6 y+ t0 o- b8 v" V3 |. { - printf(" object_name: %s \n", name.c_str());! c5 s6 H) [5 m i# }) {6 p
- }' {8 H* D- l& n+ E/ K7 t6 T1 ]
D6 |" ?5 q& B3 `& w- return ifail;;, b' @& K1 {0 h1 {9 `5 @
- }
1 C% A+ ]2 s6 B. x6 I
复制代码 7 \1 B: H( N7 ?# N
' z- Z' H) s d
8 f* n- k; D( u9 r6 S, j |
|