|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 D( | d7 `; o! z8 l
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
3 K, P$ h; t2 k1 g* Z4 I; n; {1 Y- #include <stdarg.h>( q' ?; s5 o; l# Z9 {7 `0 ?
- #include <stdio.h>2 Y# J9 j, x9 Z
- #include <stdlib.h>/ M5 n7 ~3 g9 {' T
- #include <string.h>
$ x* L6 R" G, T- \0 q# E) }' V/ k - #include <UG_va_copy.h>' `1 j, R7 R0 K, [/ d! ^/ L: d+ P
- #include <TC/emh.h>
. B; r2 G2 x+ L& v, C; W$ Y - #include <ict/ict_userservice.h>
" x" D" Z: U s+ {1 @. ^5 I2 s - #include <itk/bmf.h>
1 w0 C% x4 C% T7 q; j - #include <tc/emh.h>- X) [ X* j: k4 j* o; N; _8 w
- #include <tc/tc.h># Y' C! b8 ?. l* ]7 L
- #include <tccore/item.h>0 Q F; |* ` h: e: q* W
- #include <tccore/method.h>8 |& [' [' M* n G! s
- #include <metaframework/CreateInput.hxx>
, R. P/ S9 Y3 X P+ {/ O/ n ] - 0 I6 O" i" N- |2 `
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
2 \/ i& K8 L# S) @3 T - {
( Q. j# b L6 S, q7 q5 _$ O - printf("\n\n A2_gtac_extension_rule \n\n");
' Y8 q o7 ?) Y, \7 l
3 {/ k8 F" o. a7 p- int ifail = ITK_ok;/ t9 Y9 x; n n5 ^* A9 _4 u# F
- 9 p, X$ v; V Y* ?. d" ?( k, i
- va_list largs;
( l' ]6 C" ?. Q. D6 P1 b - va_copy( largs, args );
/ K- f+ z/ I b - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);7 [, F7 s# Y7 i- I4 L3 `
- va_end( largs );
. X/ ?- J/ X2 M9 f3 F# o) {
% N9 i l& `3 I- tag_t new_item = m->object_tag;
. g* s& ~6 e0 T1 _ - char *uid = NULL;3 O+ }# _. Y( f% z. T# h# i5 e
- ITK__convert_tag_to_uid(new_item, &uid);
7 j- i, H) H$ A - printf(" new_item: %s \n", uid);6 H3 b& A- U' d! ^2 ]7 P1 |
- MEM_free(uid);# H4 y) {# [ t9 p# W7 J
* @* A9 c: n0 w4 k* y* _/ j- " a, X$ R& k( W/ K" _ J( y: T5 o
- bool isNull = true;
/ h0 H- y3 U& e' E# } - tag_t new_rev = NULLTAG;
; D1 ?/ n: u: m% t( @ ?/ W - ifail = creInput->getTag("revision", new_rev, isNull);
5 B* ~0 N5 R3 A; U% P# d# s - if((isNull == FALSE)&& (ifail == ITK_ok))
) b6 }) S0 Z6 I1 T, k/ n - {
- I, j- b0 e B* E) d, Z - printf(" new_rev: %u \n", new_rev);
& y/ ~. e& k2 y* n( @1 y - }
$ k9 N+ g1 X! j - : G2 b8 J% r$ y
- tag_t master_form = NULLTAG;
8 D( E- e2 O }9 L$ N4 _( f - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
6 H( X# F5 y9 R& {3 s - if((isNull == FALSE)&& (ifail == ITK_ok)). W+ r. C: q1 R( P, C: X; D A
- {
. e9 g% f9 z+ y7 x - printf(" master_form: %u \n", master_form);/ A7 @! E- z* L- c$ e/ h+ a/ ^
- }0 B, i* P: x! l; h* V
- 9 f2 Q+ P$ G! h* Y
- std::string item_id = "";0 J7 O/ j( ]6 y k q- L& S+ X
- ifail = creInput->getString("item_id", item_id, isNull);$ l ` h/ l* h; j6 P8 U& O7 x9 {
- if((isNull == FALSE)&& (ifail == ITK_ok))( l( r: k, G& x9 c; Q# R
- {% j" G* w: W9 K2 U" s+ ~2 ^
- printf(" item_id: %s \n", item_id.c_str());
7 F- V& K% I3 P3 |. @! | - }. D/ ]4 E, x: k, T- h( i# Z1 }5 H
- 2 _ w& ]' w \
- std::string name = "";
. P/ |8 d) s( d7 r - ifail = creInput->getString("object_name", name, isNull);% W8 \6 F, J/ g6 E* f- }
- if((isNull == FALSE)&& (ifail == ITK_ok))1 Q: h3 V3 [& N9 K/ n2 R G7 |
- {
1 G8 u4 S0 M( C& N( F6 W - printf(" object_name: %s \n", name.c_str());! B7 ~& P9 N9 v
- }
/ U3 f! ?& q1 c9 r$ T8 X
. u: q* P0 D k" X9 |- return ifail;;
, Y: a( M. Y3 Q/ l - }' W( {% V. q9 ]8 l) f
复制代码 & D7 [. c; H( \2 H- ~( f
/ f. s4 Y2 y1 W% A5 s, L
* n5 }. e8 v% `- j$ q4 y' a |
|