|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" K; c' x& z* k* X" m3 ?Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
8 A& g; m4 w6 d2 H$ |- #include <stdarg.h>% T9 H. o" G8 y2 M* A
- #include <stdio.h>/ u- d0 @% @1 s+ T; P3 T
- #include <stdlib.h>
K6 o! C) @2 E( s2 O7 r6 D# r - #include <string.h>
/ c* ^8 P/ |1 l3 v) n) E7 P - #include <UG_va_copy.h>. \' L5 ]% @- m/ a) I+ Y
- #include <TC/emh.h>
( x) M6 ?4 T7 ?$ H2 x - #include <ict/ict_userservice.h>% k4 d+ F+ @3 @8 y |
- #include <itk/bmf.h>, G! L4 v( {; t" w }
- #include <tc/emh.h>
. j+ k" ?0 A4 T5 m: x: C - #include <tc/tc.h> f, E' {# Z- K% [" f, @0 D i7 [1 o
- #include <tccore/item.h>
9 V4 n" x F7 u/ d# \* o; f( W - #include <tccore/method.h>9 v3 o; x/ ^! i$ T. t9 r9 R9 {
- #include <metaframework/CreateInput.hxx>
0 x% y- l5 w$ S, a7 [
+ \! T( R' I5 k: C' j* o/ Y- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args). t$ J+ ?; D" l4 I$ y" {
- {3 z; }/ M* z" {6 M/ ^. t6 M
- printf("\n\n A2_gtac_extension_rule \n\n");6 z* h! e1 p2 Y
+ A2 f: c1 q- W! M8 _" p* S" H" r- int ifail = ITK_ok;+ X! f2 T% P* V; ?; Z2 G8 p, h# ~2 {5 N
- $ n: E( y* T' ^6 L) w
- va_list largs;
- w( q3 g9 j" q5 O - va_copy( largs, args );
" ^: x8 U) d9 A X3 r) i a - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
$ \2 E! ~$ ]" M - va_end( largs );" s: m% U! c5 m7 J% N5 r8 E
) N1 ^( d8 c: `8 D- tag_t new_item = m->object_tag; + M& \8 T0 z I
- char *uid = NULL;% N6 Y G" M* ~& F
- ITK__convert_tag_to_uid(new_item, &uid);
% _2 {3 r4 L$ A: X8 t) Y8 L - printf(" new_item: %s \n", uid);- Z/ M# E8 N6 p& u. E. ? A/ }, p
- MEM_free(uid);, V0 R# `- o3 ?" _
- , @, c* {5 D# f" O, g
4 O) P5 H: d. F! v3 s- bool isNull = true;, C6 r8 X' s/ A% J6 u
- tag_t new_rev = NULLTAG;
5 w+ _" _7 m% }" u1 ~ - ifail = creInput->getTag("revision", new_rev, isNull);1 [9 S7 d. A X Q5 T& X4 S
- if((isNull == FALSE)&& (ifail == ITK_ok))
H) c, d7 d3 M* Q+ d+ \2 Y" c: ] - {
7 |) Y" q6 \& u9 B% j% e" t' Q - printf(" new_rev: %u \n", new_rev);& ~3 J* l: f1 {# L7 B- D
- }$ {* P: @4 ?# p9 f4 H/ p" i: n) A
- 4 Z# J% }+ z$ _
- tag_t master_form = NULLTAG;
" \ z" R5 J) u M9 ~- Q: N - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);- F; B; t2 O+ W# j3 f0 z" d
- if((isNull == FALSE)&& (ifail == ITK_ok))
3 {! ]0 y$ h6 E - {' k2 W1 V" ]. {! E1 d, s( I
- printf(" master_form: %u \n", master_form);
6 u0 C. s9 `* e4 f* y1 l3 s L5 w: e - }: A, i1 k- C- [7 h& R2 ^) J
$ `+ v0 g @) y+ ^- std::string item_id = "";% k0 g4 w- L, W7 d& J1 W& ]
- ifail = creInput->getString("item_id", item_id, isNull);3 `; G# T! S* ] b2 @
- if((isNull == FALSE)&& (ifail == ITK_ok))
% r: D- [% C# z5 O - {. q, U" M5 H! e3 Q- U% C
- printf(" item_id: %s \n", item_id.c_str());/ v: c# o9 f3 F# `/ g; _
- }
6 H) \ K+ a4 `4 P" d! C
; @& B$ H/ I1 D! e; ^- std::string name = "";
/ @0 L* y& [6 b& }1 R - ifail = creInput->getString("object_name", name, isNull);
' ]5 D4 N# x+ q o* y - if((isNull == FALSE)&& (ifail == ITK_ok))
# |5 Q6 D! d6 a6 ? - {
- M* m$ M# w2 B' H - printf(" object_name: %s \n", name.c_str());
! z: p% n+ ]& t9 ` - }
1 Y6 K& R( ]+ d# H# O% a5 ] - , \" X- d) }% }6 Q9 G5 c
- return ifail;;2 E9 f9 G6 }7 M: E
- }
w+ E2 x# I D) x/ ]
复制代码 % d' s, V1 Z: ^! p+ \. g1 f
( i) a" M2 E8 L' ]
: |) ]' E% A3 A9 D$ ~2 K |
|