|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ R0 {9 x& F5 \1 U; c0 yTeamcenter ITK二次开发源码分享: Item 创建 createpost操作
6 r o9 k8 I" x. _9 Y8 V; t* K4 a- #include <stdarg.h>
" Z- f$ Y: X) ^. t, h - #include <stdio.h>$ z7 R' x$ j" o& ~) h) y# ?% u
- #include <stdlib.h>
, S5 h! G2 q' \ - #include <string.h>
8 H6 G: M3 }' r- ]" V. s& F - #include <UG_va_copy.h>. ^$ u: S7 J4 S% ~% W' I- H
- #include <TC/emh.h>+ W2 g. \! K# }4 o/ Y
- #include <ict/ict_userservice.h>
: I3 `' s. e# t4 ]6 M$ Z1 C- m7 l - #include <itk/bmf.h>6 C7 c% u% y( b' U+ N
- #include <tc/emh.h>
: A T% t- C7 Y1 `5 q# t5 f5 c - #include <tc/tc.h>1 D2 J$ e* e, B) v6 n" O# z
- #include <tccore/item.h>7 ~5 K! ^. L9 ]
- #include <tccore/method.h>
- s5 C' X/ f( u$ ` - #include <metaframework/CreateInput.hxx>
% M# e, b5 k0 F# W3 b
; S5 [5 h7 y1 S4 `: w- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
+ C3 f, e- \+ s& @3 D+ k' ? - {9 B$ z3 m2 }* H: V
- printf("\n\n A2_gtac_extension_rule \n\n");
" v: A. t9 s& `! H
3 {, E* m' |+ c W" m- int ifail = ITK_ok;4 W a k: [, ~4 {, j0 e9 v
- 7 Y$ h- E/ ^* d1 P6 p( X$ b
- va_list largs;
; T/ z4 ^- T7 k _4 W/ ~$ ` - va_copy( largs, args );4 r3 F, |4 l: Y, Z
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
( Z. @2 V, S" g1 ?' ] - va_end( largs );
. E4 k' M8 V2 c) E8 ~/ Y) d - # D+ n* }* j; I5 k3 d% G
- tag_t new_item = m->object_tag; % |7 B' D5 S. z, d' h. ]
- char *uid = NULL;
8 o7 A, ?# L# q0 f8 C7 O- f - ITK__convert_tag_to_uid(new_item, &uid);
+ n0 ]+ m7 e6 m/ P - printf(" new_item: %s \n", uid);
9 L6 K/ K! L- I J. E% |# i! ^1 } - MEM_free(uid);
: ~) S n, j5 Y
* q0 V8 C. k5 w0 U# I- ( P5 C% h+ k: l7 O) m
- bool isNull = true;3 h( I- H; M, s: D
- tag_t new_rev = NULLTAG;/ T* G' ^ f$ ^! [7 e
- ifail = creInput->getTag("revision", new_rev, isNull);* B2 M. o! ]4 [6 N t
- if((isNull == FALSE)&& (ifail == ITK_ok))
7 Q, c1 e m* M# ?3 E8 z - {. g2 ^2 U( ?% p0 ]' q% J- [ O
- printf(" new_rev: %u \n", new_rev);
; v- T0 n5 g N( R+ N3 `$ ] - }2 O" z! f; R* v% t/ [4 ^0 \- P2 \
- M* C" Z2 D1 @+ s; `" X
- tag_t master_form = NULLTAG;! I) n+ v* G' H6 y' K
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
! h0 z9 ]4 ]8 V3 y m! o) D - if((isNull == FALSE)&& (ifail == ITK_ok))& o* T& y- L' q
- {# A: e* r# o' u; _4 z+ q
- printf(" master_form: %u \n", master_form);/ k, r* J* {9 t1 Q
- }6 w# Z y9 q/ o6 R& A0 J
5 k2 I: E. n5 |8 U1 D, N/ e- std::string item_id = "";: w1 ]! \ q* F6 J: _- O
- ifail = creInput->getString("item_id", item_id, isNull);
% \5 F# S0 F* t/ O8 X. I( Q - if((isNull == FALSE)&& (ifail == ITK_ok))
; I) u( _# Z) }: o* g - {. J! C( s2 G# O
- printf(" item_id: %s \n", item_id.c_str());+ x& @1 y7 q& i8 z$ Z& {/ ]8 j* o
- }
" ^1 M }" B2 `4 i! x - 5 H/ s, D" B. R6 J1 q p
- std::string name = "";5 [2 \" m8 e7 G. I/ |5 H; _# c: _% J2 X
- ifail = creInput->getString("object_name", name, isNull);
7 x6 d# t0 M$ [3 S - if((isNull == FALSE)&& (ifail == ITK_ok))1 y: ~$ L1 x3 m% M/ O1 b; h* c; W
- {3 j! s* C/ Z6 j
- printf(" object_name: %s \n", name.c_str()); C7 [5 @2 e9 A7 W4 C, R
- }; ^9 j! [* p" u- O$ Z
+ [0 G _2 ]3 ~3 ]1 ]& J. P# \- return ifail;;
- i/ a( Y/ I3 ]- q6 B - }
8 R2 j& A( ]( y: X4 b
复制代码
% z1 u: \& D" v& `
4 b; ]' _1 }1 f7 A
8 s" M& v z- L# z# r |
|