|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ r- N5 E+ H( h0 }3 \& T5 D$ z* y
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
2 P, V' U& e3 h- #include <stdarg.h>
4 B" @, F% a, `+ r6 O/ ^8 b( R# i - #include <stdio.h>* i, A0 k! u# o% D7 G
- #include <stdlib.h>, T8 K. z) G4 J9 ^' S
- #include <string.h>
/ W- g, z2 M( O3 G+ v* w& J - #include <UG_va_copy.h>( [( e a& I0 M8 ?$ B
- #include <TC/emh.h>
3 H t8 m# z' L! p F& `- Z8 ` - #include <ict/ict_userservice.h>! e0 [1 }# _4 _( Z' R. v+ q
- #include <itk/bmf.h>
0 z" ^. R; a2 M! a0 z# {0 S4 c$ Q - #include <tc/emh.h>
* u% C9 K) i) b - #include <tc/tc.h>! v8 d( @' a" |
- #include <tccore/item.h>- l% _8 W/ v7 H; S5 B1 J" l7 f% P
- #include <tccore/method.h>
* ^4 @6 k( ?! k' J - #include <metaframework/CreateInput.hxx>9 z( ~# s: ], _5 e* I
- 7 `3 W: b4 A% z' C5 p( i
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)) {4 s7 m- w4 v0 A' W8 O4 }
- {
, k9 m5 M6 o* O- h- m: D - printf("\n\n A2_gtac_extension_rule \n\n");
8 d' T0 s, L9 f7 Y$ I7 e
# b( l9 Y7 g; d' o3 S6 j- int ifail = ITK_ok;
9 f5 C0 f, n4 y. L - . I3 z- Z% m k) |/ c! p" b. l
- va_list largs;
. y1 S. d: K1 G' j; `( b - va_copy( largs, args );
5 U4 G" {2 n2 ]& z Z - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);9 \5 g P6 o# I# q0 L
- va_end( largs );% y7 N. n4 P( g' }) d, h7 g" E6 g
|2 l. F2 a! `1 w. z& x, i) L1 W- tag_t new_item = m->object_tag;
2 G8 X' t% i1 a0 Q; ^2 ` - char *uid = NULL;3 V; {3 V; @6 X0 h; v% N2 ]& W
- ITK__convert_tag_to_uid(new_item, &uid);
& ]1 T; v1 R3 u - printf(" new_item: %s \n", uid);
7 C4 n% O3 x6 b+ { - MEM_free(uid);, ^' s e3 U' m' r
- 3 C: {4 `9 S' X! n# b/ o
2 r2 \7 s8 N/ X6 }4 L- bool isNull = true;
5 }7 k# k! i, Q1 k. Y0 F- X - tag_t new_rev = NULLTAG;
+ _) p; h6 B* _2 N4 n - ifail = creInput->getTag("revision", new_rev, isNull);
v a: C, w' y1 |+ S - if((isNull == FALSE)&& (ifail == ITK_ok))) d6 e \& O& C5 A2 j6 A
- {
' n7 e. n% G" i0 R! I5 T5 f - printf(" new_rev: %u \n", new_rev);% L; Z4 O6 P! M/ D+ e) S
- } G9 j. {# P' V) S
-
( Q* L9 H, `6 y1 }" s, z) f - tag_t master_form = NULLTAG;
% N* m; G. P, \$ g6 M, i - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
* V. H6 M, N) x7 R - if((isNull == FALSE)&& (ifail == ITK_ok))
& o2 A; p$ L/ \( z9 z' l - {, L+ s2 s3 Q& F6 l( I6 c/ k
- printf(" master_form: %u \n", master_form);
& C: a* s% ^% a2 a3 C - }
/ w4 @+ W" v2 C) f+ r0 w - & o0 {+ l8 T* ?
- std::string item_id = "";8 V1 X' m1 x K! q4 u5 j8 q/ @
- ifail = creInput->getString("item_id", item_id, isNull);9 m" ^/ Z4 |. f. y5 u2 L
- if((isNull == FALSE)&& (ifail == ITK_ok))& y' P, L C5 j2 n, k# Y9 W6 a
- {
1 W( ~ @7 J2 W5 H8 `; x - printf(" item_id: %s \n", item_id.c_str());5 Z( r; `( {, T* P7 O( m d
- }6 x0 j& {" K2 y+ r
( `. Y- z9 v$ R' J" I- std::string name = "";
: l4 l: R, v. Z5 G) f( ?+ M9 G - ifail = creInput->getString("object_name", name, isNull);
: B: t3 g: M0 H% ~ - if((isNull == FALSE)&& (ifail == ITK_ok))
3 F$ N' P3 J% ^8 g- s - {$ X6 Z/ Z' o" a. V2 a
- printf(" object_name: %s \n", name.c_str());
" P! j7 x, [. B. k1 m9 f& N - } H0 Q$ g5 Z' g7 U I* ?: H* P
0 V: `, D+ j$ g p5 m; j- return ifail;;0 Y9 r$ |5 N3 Z1 i0 F" r
- }
- V9 e9 _( w- i( J
复制代码 7 z3 c% S* j' U) T7 j! h0 @8 T0 x
- m# e3 S' H$ y$ f
3 i: U3 k; a7 D' ^* \2 g6 c& t |
|