|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
" c& ]* {7 w" Q. [* {
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
& ?" A. Z0 p1 D- #include <stdarg.h>
b8 g3 ^: ~2 s5 Y! w' D" ]4 h - #include <stdio.h>
+ S. n& V: Z8 ~& H1 c7 ? - #include <stdlib.h>
% u: G1 J2 M m$ T3 b+ A( \ - #include <string.h>5 u% h/ {9 P; W& a3 N4 E. f8 _, K5 ~ W
- #include <UG_va_copy.h>
6 z: `$ G4 L" ^; n - #include <TC/emh.h>
: j8 M- y, b/ n8 Q - #include <ict/ict_userservice.h>
$ `3 h# F6 [; U# c6 s5 p+ P - #include <itk/bmf.h>/ S* U- D! H# C" ^3 d
- #include <tc/emh.h>) U+ m- N4 l8 t8 C
- #include <tc/tc.h>
- _0 `1 B$ Z& m* B - #include <tccore/item.h>
+ W! ~/ a) F- r/ ?$ j+ p - #include <tccore/method.h>
) X }& `: e! w+ Y) ]$ t - #include <metaframework/CreateInput.hxx>
- `) \4 @1 k* `% Z - ' r* }* Z3 S/ n5 ^
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)0 I: I8 e5 P z9 X2 O$ ~6 C
- {
, H7 U" V" ]9 }7 w! i! a: b - printf("\n\n A2_gtac_extension_rule \n\n");3 |3 R+ a* O) x: O( _- L; J
) I7 p8 d0 ]- _& x8 k- int ifail = ITK_ok;
( d' E0 h( t9 Q2 j
! Z: V$ d5 p# K. S0 O; v- va_list largs; D* U# D1 u [* ~9 w- I
- va_copy( largs, args );- p s% b b9 q, }$ j
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);( r. \ K' M9 E0 @
- va_end( largs );. }5 ]. L2 [& U. y9 D
7 \' y. D- z) U$ P1 Z$ s) [! _: L- tag_t new_item = m->object_tag; # G0 H$ n: ^ I% z
- char *uid = NULL;6 h& Z( K( z- t& `
- ITK__convert_tag_to_uid(new_item, &uid);- o: z2 f" K* r" E9 I {
- printf(" new_item: %s \n", uid);. ]% j2 j! z5 T5 B2 s7 j
- MEM_free(uid);
, ^/ s- v% L4 Z! m7 n2 T: m
3 A0 U+ o" P/ c4 y
* I" C O. g u, _( j- f- bool isNull = true;' K* ~' K) i6 l, q) S
- tag_t new_rev = NULLTAG;
# N9 l4 s2 k0 W. Y7 a - ifail = creInput->getTag("revision", new_rev, isNull);
5 d$ n" U; ^2 z* I+ | - if((isNull == FALSE)&& (ifail == ITK_ok))2 `1 }( g: _3 ^% o2 f2 v
- {
& M! S! K$ x" L5 r3 ]0 v# b - printf(" new_rev: %u \n", new_rev);: {: E5 z% E7 S2 z! @
- }& U6 [! f; n$ _& W" m4 e
- % ?1 Z) f+ v* \0 z1 p
- tag_t master_form = NULLTAG;
; n$ c7 N0 B8 \# V" Y6 S - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);+ C* s7 ~, I N5 ?
- if((isNull == FALSE)&& (ifail == ITK_ok))9 y/ ?+ i; v: C. ^ L2 W
- {
+ ]0 S1 a M) v0 C+ P - printf(" master_form: %u \n", master_form);( R* h& R# Q( Y4 X E
- }4 ^8 G) J$ H$ H( V4 I8 ?
4 [$ e8 [: I3 ^$ P' X% W- std::string item_id = "";* _3 F; r$ u, Y( r! B/ \
- ifail = creInput->getString("item_id", item_id, isNull);3 X$ A3 f1 b. @+ s; \
- if((isNull == FALSE)&& (ifail == ITK_ok))
. |5 _& c% D4 q- I9 }# O' r% P$ v - {+ G) R9 V8 J# ~2 z3 ]7 R- e' g
- printf(" item_id: %s \n", item_id.c_str());' q# D7 c, {, o, T& _6 v% }- V
- }
. I" z# U/ s5 `
1 D% S" f' x4 ^& q- std::string name = "";
9 V$ c5 T+ u- r% _7 H+ h8 i- ?, r9 A - ifail = creInput->getString("object_name", name, isNull);2 H, H& \! x* V# C) h4 k! `
- if((isNull == FALSE)&& (ifail == ITK_ok))+ n: H$ K- t7 b9 r4 L# j
- {& Z8 _" ^( G5 `( i2 t2 m
- printf(" object_name: %s \n", name.c_str());
" X( l( `6 z6 Z, R - }
% i+ i/ _! o- {+ b Z' f* i: D - 4 i3 O }5 T9 R( ]
- return ifail;;
' ^: G- y8 q" f/ S# T2 s8 Z: n - }
1 D w# d% u3 m8 a5 G, ?! s
复制代码 i# [2 f+ h2 T! b" r( w) D3 ?0 t$ @; A
& C- n9 X4 ]! ]2 L
: J" r" A* s0 e5 l |
|