|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 r1 J/ M4 F, G, g# P. o5 W; f* w
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作+ z/ e% E/ y- E0 c* O0 H5 T S0 L
- #include <stdarg.h>
. n, f# Q9 w" D3 S3 u8 N - #include <stdio.h>: ?3 B, s& K6 ^' o0 f1 q
- #include <stdlib.h>- C* r' i- N# z# v# q5 ]
- #include <string.h>
& D* P+ A. S: V5 T6 R - #include <UG_va_copy.h>
3 k( Y6 I: z" Y: M+ h' R - #include <TC/emh.h>
+ k" A; I2 @/ D% T2 x" G, t! E - #include <ict/ict_userservice.h>1 X& f) y2 V @0 s/ q5 H5 w
- #include <itk/bmf.h>; a2 F/ U8 a- l
- #include <tc/emh.h>% h. S, M6 U* n8 G6 V
- #include <tc/tc.h>: y0 h4 d+ B; z
- #include <tccore/item.h>6 t* j3 U- s) `( y/ U
- #include <tccore/method.h>
% j0 n" E8 Y; p- F' k, b/ Z2 E - #include <metaframework/CreateInput.hxx>9 W6 R& Z- x4 ^* A, a
- ! |+ ~2 i+ L1 n( H$ z
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
. F1 N* g. D4 t4 W/ {$ k, r/ A" W- W - {
1 R. M1 F4 e c0 P' Q - printf("\n\n A2_gtac_extension_rule \n\n");
( U+ h5 g1 j- E
( _1 B. P4 z& \/ P- int ifail = ITK_ok;( r1 |$ m- U: w3 c7 O5 K
- 8 O9 d/ P6 ?: V4 @( w3 O
- va_list largs;8 _9 }0 b6 V' F2 \1 y% B+ B1 \& B
- va_copy( largs, args );0 J; d& b, G+ _) o0 I' L
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);, b4 V1 @% Q/ ]. Q- G; @2 p
- va_end( largs );3 @% k( g4 ?* c3 \; x/ u
- % M( r9 }0 l# W; g! n6 ]
- tag_t new_item = m->object_tag;
& z/ H( U: H1 n2 \7 R! V9 z1 ` - char *uid = NULL;
" N2 |5 S. A1 V( e - ITK__convert_tag_to_uid(new_item, &uid);7 s* M+ Q' Q1 O
- printf(" new_item: %s \n", uid);' ^% E8 s/ z: e# m
- MEM_free(uid);: M4 r2 |8 u5 s
: P" [3 V- H0 g' D- p
+ G- F- e/ ` ?* y- bool isNull = true;
8 o/ a) D* Q+ x* ]/ F$ F5 p+ g - tag_t new_rev = NULLTAG;6 h0 o, a4 a6 D$ f2 U1 m
- ifail = creInput->getTag("revision", new_rev, isNull);
0 }' B* g8 p# S; Q' y - if((isNull == FALSE)&& (ifail == ITK_ok))
4 S4 w1 P$ m9 q- {" a - {0 o: T+ h! s+ \) K
- printf(" new_rev: %u \n", new_rev);
# F8 \2 R# h, { - }7 g6 `. G/ |* O3 }
- & j; a5 B2 F( C. B& P4 V: K# n W) ^& K* N
- tag_t master_form = NULLTAG;4 {6 f- n9 Q$ ~, u
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
) M- f3 {$ ]5 W6 V9 t6 O - if((isNull == FALSE)&& (ifail == ITK_ok))
. M# n7 C. u) ~- J* {' a - {1 K/ M7 k x; t, s2 q
- printf(" master_form: %u \n", master_form);
! w) [& [4 J h, Z$ q2 A" o - }. w. g2 J* l5 c8 U. C5 }9 o
, E5 `# @8 d! p' Z: d- std::string item_id = "";
' B: ]" g7 I! }6 N2 s6 |/ @ - ifail = creInput->getString("item_id", item_id, isNull);
3 z) u0 V& i/ G - if((isNull == FALSE)&& (ifail == ITK_ok)) I0 T3 y5 G, Q
- {. W+ }3 [* X$ r1 l
- printf(" item_id: %s \n", item_id.c_str());
/ P7 j) d5 [/ k3 O. ]8 h. j. Q( r Y - }
: k1 x! |/ Q8 Z" ^; N
# M! @, k5 X/ c. ?- std::string name = "";. I" w x' }2 l2 k0 q# S& h
- ifail = creInput->getString("object_name", name, isNull);/ p7 n. v( r7 S/ o$ @
- if((isNull == FALSE)&& (ifail == ITK_ok))
; o H1 D9 k: s+ J6 ^ - {* k: v/ z. w1 M# C9 D# a a
- printf(" object_name: %s \n", name.c_str());
1 B6 k9 x& k4 g3 a) b. k - }6 |% P' s. f: ^2 v. g9 U
' E h" {4 j' ^( F0 b3 O y, W1 [- return ifail;;# Y- y& p% ?3 K4 a! Z+ l9 @: E
- }- d* k1 B) @0 g$ ]" m- F
复制代码
4 m9 u# X; j, `! S; J8 q3 y
# @+ _. D1 G8 D% B
0 c9 ? E Y$ {/ g2 ~3 O# v |
|