|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 Z1 x! o& @& j, D. f+ C* G4 `
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 `% ]1 h) D% [- #include <stdarg.h>0 D/ e/ ^/ c- s0 \) D* B5 L
- #include <stdio.h>
# _! T2 N6 D& w) s! H; I - #include <stdlib.h>* Q4 N0 x) J h1 u3 F6 x2 S: ~
- #include <string.h>
/ D3 Y9 W0 h4 U - #include <UG_va_copy.h>6 }/ P7 k( F4 |
- #include <TC/emh.h>* M! g1 O7 G @- U0 ~3 z
- #include <ict/ict_userservice.h>
$ Z; t1 c$ o6 N. i6 t - #include <itk/bmf.h>! n2 C/ @, I* K$ D/ R. {0 w
- #include <tc/emh.h>
4 F, S' V; }% S9 T - #include <tc/tc.h>. r+ Z; R' a2 e5 p1 l G; w* {
- #include <tccore/item.h>
/ o1 j6 z" c1 i3 v/ L$ ] - #include <tccore/method.h>& p' y' J3 O) U- |9 @
- #include <metaframework/CreateInput.hxx>
3 ?2 T5 g1 C V, k7 I; i7 W - $ R g: m2 ]8 h9 }* U: L
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)7 z* a7 F& \" j6 g+ ?9 V
- {; D/ \- f$ C6 B* i. ?
- printf("\n\n A2_gtac_extension_rule \n\n");1 N# k& |+ W6 w
( F+ H ~2 |3 A( Y6 w- int ifail = ITK_ok;
: n" x }. V8 o9 Y# x$ } - 0 ~" k- `! k p( `
- va_list largs; r6 ?7 r4 |5 V" K3 d) M
- va_copy( largs, args );* g' ?& S# K; L& x7 E( ?- h5 c
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
. S- C y7 {" { - va_end( largs );6 m. d4 e, s! i
) \/ Q( T/ ]: L$ y- tag_t new_item = m->object_tag; 1 g3 U7 ]' |( X9 h
- char *uid = NULL;) ^ h1 V5 u- I; r: {) Q7 W, b. U
- ITK__convert_tag_to_uid(new_item, &uid);
; h. T, Z8 G+ x% L6 i' w5 ] - printf(" new_item: %s \n", uid);
# `/ E) N" |1 y" s$ D - MEM_free(uid);- S$ U3 D( b* P
- ) q" [2 E) o( m7 A
- # U$ c$ P; T, C" H1 ]5 z+ G# T
- bool isNull = true;! C& d% Z S( {* b" Q6 G
- tag_t new_rev = NULLTAG;
5 T0 l! Q8 B0 R! ?0 m, J( S - ifail = creInput->getTag("revision", new_rev, isNull); ]) c- k& m4 d0 l6 y
- if((isNull == FALSE)&& (ifail == ITK_ok)); J' }5 u M% p* }, Q3 }
- {0 M Y; c* j4 _; t
- printf(" new_rev: %u \n", new_rev);
T1 B& F# @& B4 J& ]- j h7 a - }
: w9 d: o! B% M! i* o9 F& q+ ^ -
; S, W! f% `5 F: j$ c- d - tag_t master_form = NULLTAG;- a3 f$ E1 h5 A& n
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);1 \8 X7 n0 A8 t, ~& u
- if((isNull == FALSE)&& (ifail == ITK_ok))
, l( T# @' Z! C0 E - {( x6 p8 p" ?3 e. i' w; Z* G' w
- printf(" master_form: %u \n", master_form); C9 [2 L8 l) P" `
- }) |+ E# \, L: @+ J
- 6 P+ s5 Y- t! |* O
- std::string item_id = "";
( Q" ^2 r, y; g" @6 o! \ - ifail = creInput->getString("item_id", item_id, isNull);
: N* N/ l+ N2 \" x# `- ?& Q+ Q h I - if((isNull == FALSE)&& (ifail == ITK_ok))' D( C% E g3 V3 } S* F
- {& A i4 v L. G
- printf(" item_id: %s \n", item_id.c_str());# _' [ K3 m8 V* E D; s) M
- }
7 @3 {' O- L* `$ U - 6 F' D' {8 ^+ ~' _' E j9 z: z; i6 @7 D
- std::string name = "";5 U* u: y# R) _, \; v1 x) B& a* Y
- ifail = creInput->getString("object_name", name, isNull);
( a1 i6 N: t3 J7 d# G9 b" S2 g - if((isNull == FALSE)&& (ifail == ITK_ok))
$ @* w6 ^9 I/ T7 z5 U5 P8 F - {
: R. v, p f) H: y# C# G* K4 B7 B! ~ - printf(" object_name: %s \n", name.c_str());9 i" I0 d# a2 j$ p9 f @
- }
3 [4 H( ~6 C5 }6 w1 }5 b
& [7 g" x, {8 S9 q4 L& I- return ifail;;# V% p' j8 a( e' T) W
- }
) t5 G, A' z% `3 a& x# R. Y
复制代码 ; n% I; \- z f
$ T7 V% B; V5 E. }) T3 |/ v' ?7 g' ]& j0 e) c4 L5 f
|
|