|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ N3 l4 Z7 Q+ s6 C0 E
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 Q) @" G! b. R3 F: n' a2 M: H9 A- #include <stdarg.h>
3 G# H, ?9 z" {+ f4 {2 e - #include <stdio.h>
% l2 t4 v' e& v - #include <stdlib.h>; ]' \% i# k- b o# Z
- #include <string.h>
9 b$ R p2 R0 r! p" \ - #include <UG_va_copy.h># X. t0 ]1 U4 \! `5 @# u
- #include <TC/emh.h># \( \7 A3 V, M
- #include <ict/ict_userservice.h>; \5 k" q ]9 `9 \) [% {
- #include <itk/bmf.h>) ?& u2 C' z9 H6 ~" V
- #include <tc/emh.h>1 e. o, Q4 ^3 h1 t2 V
- #include <tc/tc.h>
0 z1 y( n9 C" T: W7 ^7 ?% d( b1 i* Z& ~7 V - #include <tccore/item.h>6 y n" K& r" h. c( {$ x. u! m
- #include <tccore/method.h>
$ h1 H0 O% ^# @- o5 f2 R# W - #include <metaframework/CreateInput.hxx>% ? t4 C# e1 g& _; ~. Y
- 5 X1 Q8 X. r/ _) t# N+ P
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
2 R! I* B) o$ H - {4 N3 ]& V; E9 N4 M, v8 Y5 g) r5 A9 Y
- printf("\n\n A2_gtac_extension_rule \n\n");
6 P3 y6 X# u7 n$ ~ - ! U- B% G. _% B
- int ifail = ITK_ok;
& U9 G- t( S6 G( g - 7 L0 b( m; ]7 p7 T: O* q: }/ J5 l
- va_list largs;" {0 }0 o. l2 z5 T6 P
- va_copy( largs, args );
2 Q; L ^5 w' j: e+ d/ y/ m2 z4 a - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);0 y. T0 ~" e. n; y' p, x6 E% @
- va_end( largs );
+ J. O7 ]9 b' D. R - : {; C+ b: z% q5 A& }1 N
- tag_t new_item = m->object_tag; " a4 C, x! w4 a( \. |
- char *uid = NULL;
* ~7 N6 Q; H4 ]' M: {5 C8 {$ V0 u - ITK__convert_tag_to_uid(new_item, &uid);* R, Z4 F, S }; Z7 w
- printf(" new_item: %s \n", uid);
i X; f7 w0 [" r* j2 w - MEM_free(uid);
/ n9 z& i6 u' Z9 L# Q: T0 f6 K - * N) h' a0 \& R" V$ ]
- $ ~; g$ j4 B6 ~
- bool isNull = true;
) v$ R, \9 I) n4 l4 { - tag_t new_rev = NULLTAG;
7 c/ i8 d6 Q6 m, y - ifail = creInput->getTag("revision", new_rev, isNull);, S! ~" o! C* j
- if((isNull == FALSE)&& (ifail == ITK_ok))
* h7 }. T) e$ y# _2 Z - {
) z$ h7 Q3 p9 d - printf(" new_rev: %u \n", new_rev);
) e$ Z; m$ W& L2 t4 q4 M - } W$ T* R; P" r3 T3 K5 X3 D
- $ Q7 {+ A5 R. ?
- tag_t master_form = NULLTAG;
& Z4 F4 w+ k5 H, ?4 U - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);* c5 ~7 Y V) ]0 D) Y+ d
- if((isNull == FALSE)&& (ifail == ITK_ok))
- \" a) ]+ @, e% E# I - {+ @% c9 W$ S* E& T
- printf(" master_form: %u \n", master_form);
3 c) i3 Y# t0 C6 B i+ } - }/ B- D6 T, Z* B/ w" W: T
: n: N8 E) @6 f$ ?* g- std::string item_id = "";
! z% L( m7 N: \( B5 ]2 e - ifail = creInput->getString("item_id", item_id, isNull);4 o9 k. @7 n- A( y# p9 l7 x0 h
- if((isNull == FALSE)&& (ifail == ITK_ok)) w" N! T5 c2 l5 l
- { \7 o% C! j& B/ b
- printf(" item_id: %s \n", item_id.c_str()); L" J/ n3 }5 L
- }
/ @& F* \" \. V2 }
6 B6 l+ a* D% t' E# @5 _, W# C; H% w- std::string name = "";
L5 Y- O' f; ~7 u0 i9 T - ifail = creInput->getString("object_name", name, isNull);
# z- c# N! K5 {; _5 X( y& X* ?9 [ - if((isNull == FALSE)&& (ifail == ITK_ok)) j3 |5 v7 ]6 s% |
- {+ Z: [- }0 c# J
- printf(" object_name: %s \n", name.c_str());
" ]5 f' {2 D+ W - }) W, X. y% X+ C' {
- 7 c s+ m! y( m! E. l% ?
- return ifail;;
T2 e3 j- q. t5 a" ? - }% E- K0 i, K# Q* g) P1 Z; u
复制代码
+ D8 v o" n; G5 I4 p1 Q
- s9 i1 ]. m- |! N: H* k7 l9 C
' A" Y& N, T9 W/ c8 R |
|