|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; j) f* z! E W$ e) F g
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作! n% U9 G# Q! S; F6 p8 u
- #include <stdarg.h>9 T: n: {, j7 W; X! g* a
- #include <stdio.h>, @* }' V! K" V6 E$ |& g% o
- #include <stdlib.h>
" X* b+ U; A' |# n2 x5 A) O7 \- B! X - #include <string.h>
4 ?# h" s0 q$ ]2 E: t1 r - #include <UG_va_copy.h> y7 H2 i" `7 E/ M! V6 [
- #include <TC/emh.h>1 C5 C/ t0 u& p9 \
- #include <ict/ict_userservice.h>& ^/ k5 l9 @9 B; H2 ?( |! \9 S
- #include <itk/bmf.h>" k. d4 V v; V; R, |
- #include <tc/emh.h>
* ~9 {1 e0 P% m5 g5 P8 \8 l* A - #include <tc/tc.h>
5 y9 s9 E, Z" l& n - #include <tccore/item.h>: h! X ~$ T9 `8 k
- #include <tccore/method.h>$ t q# c# i: Y/ \0 B4 _
- #include <metaframework/CreateInput.hxx>
! j) U2 M- X. _2 \1 D* n" r
9 i9 Q! Z! D& S% f- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
) r5 L/ U. z2 p! u+ X. h - {
~& [& _, ^5 C& W3 q5 a5 A; c" k# w - printf("\n\n A2_gtac_extension_rule \n\n");$ Z# n/ b( l) ^; Z/ A
- : ^0 w. z+ K0 ^$ L8 g! R4 s4 I+ b
- int ifail = ITK_ok; e2 C+ ~* R9 L
- : x8 a8 w" j: B+ y. s- E3 p o$ e
- va_list largs;' {5 y& ?# e. w( m$ I
- va_copy( largs, args );& }7 L* t' {% P+ ? a4 Q3 @3 {) ^; y
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
" h# ^, B- K, {9 ]% W0 L+ ^ - va_end( largs );+ x: S2 v6 e( n: I
- L$ B D( }0 D4 z% L! i- tag_t new_item = m->object_tag;
0 H7 D+ ~) N* G5 I: j" {, e - char *uid = NULL;
% A0 s3 e; c9 ~ - ITK__convert_tag_to_uid(new_item, &uid);; d9 j- _* E8 j) q
- printf(" new_item: %s \n", uid);: a2 v: y, g# O# Z2 ^
- MEM_free(uid);, U" y- R9 Q& M, u, W7 k) _) F
( v6 k7 A- u# u g# t5 Z( B' ^9 l! P- 2 v X# g: m K9 m2 y- t2 p
- bool isNull = true;0 m4 t1 B8 E# {1 w, f* e- g
- tag_t new_rev = NULLTAG;
. X9 k& h! N2 b - ifail = creInput->getTag("revision", new_rev, isNull);
8 _7 X3 }$ ] q. u - if((isNull == FALSE)&& (ifail == ITK_ok)) k5 a0 n2 x/ |+ i, c* i" `% ^6 g
- {1 b$ x! J! f! i7 t, U
- printf(" new_rev: %u \n", new_rev);
K* N& U5 G1 d- p3 s0 F& | - }) Y! B+ G) Y- m, u& S$ j: l
- 6 e+ r1 t" J( [9 l6 }9 |
- tag_t master_form = NULLTAG;
5 E$ K5 C2 e ?9 I) H' `* ~ - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
6 w! W( o/ k1 g2 f: K7 S: ~ - if((isNull == FALSE)&& (ifail == ITK_ok)), y3 ^. P* R9 c# Z& t
- {4 `. j4 i0 a& r2 z! D
- printf(" master_form: %u \n", master_form);
8 u; w0 e, L- U: b0 A0 H - }
& Y7 j: R- \- ^+ G/ G* _9 W, w - 8 S0 l0 S- s0 A- W$ s v2 Z, a- d( K3 w
- std::string item_id = "";( D8 o- W5 }2 q0 i
- ifail = creInput->getString("item_id", item_id, isNull);3 w% @6 T a) N) j
- if((isNull == FALSE)&& (ifail == ITK_ok))
& b- ~4 m4 _& B$ R8 M: A( S q- h! Y - {* Y. V: R; [4 ~4 d: F3 G9 X
- printf(" item_id: %s \n", item_id.c_str());
0 a* ~! r7 @9 F* V8 H - }, s8 d* T8 D/ H8 Q; X3 w1 D) Y& u
6 Z9 I5 R+ Y! o5 j# B4 B7 e U& |- std::string name = "";- _1 Q \$ o X( n& L6 G1 e
- ifail = creInput->getString("object_name", name, isNull);9 J. V: T" I3 b5 X- M; k9 z6 O/ v" Y o
- if((isNull == FALSE)&& (ifail == ITK_ok))
~( P9 f6 A7 a) T9 p - {
, l, A3 q- G" o2 w+ b5 Z+ l - printf(" object_name: %s \n", name.c_str());
. d% D( ?' L0 {( R+ e5 b - }
$ I3 S' e5 V [! f* T2 u - 3 a8 d0 O5 h- E) \: y- b' \: C
- return ifail;;
7 u/ i/ [5 l) Q0 \+ [ - }
, s; I: V" F; P6 \0 |& S
复制代码
# O1 _* V3 |. e
5 J5 N" a7 d% A. n. I2 q
9 w+ T' K8 J2 w( ? |
|