|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; l- }) r/ {( _% h8 y+ C
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作8 L( F+ _! N- \* U& F8 _. g/ W) p
- #include <stdarg.h># e6 N+ w- k, C( V3 s5 a _
- #include <stdio.h>
, |$ F5 y6 X- \: C; w) |2 K) u- T& ] - #include <stdlib.h>2 b5 `9 Y1 { i" J8 t
- #include <string.h>
+ J8 q9 e, P# g7 p B. L- Q2 v - #include <UG_va_copy.h>
" I( V) j/ `( z - #include <TC/emh.h>
( @! T+ t$ p$ |: [ - #include <ict/ict_userservice.h> t" c B" L b* d) J( B2 W
- #include <itk/bmf.h>& n7 c* c' ]+ g4 d0 N1 k9 b2 s
- #include <tc/emh.h>
) v# w* k4 Z% @5 D: p3 g6 I - #include <tc/tc.h>
) ], l& T) e) V. p9 i9 I6 I - #include <tccore/item.h>
x0 V( p7 i4 W+ c$ n( ]! E* W - #include <tccore/method.h>: u& z6 R* ]; J2 p# ?% v: x; }$ e
- #include <metaframework/CreateInput.hxx>' z f9 ]# t' K1 y |
- " T; k6 Z+ w; h5 |
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
; c! e' ^: Q; S2 ?& V - {
% _( `, t% B5 j - printf("\n\n A2_gtac_extension_rule \n\n");% ]: p0 N$ O) Q1 ]3 _
+ l2 R8 ~+ ^* ~6 w( _% |! J; L, ~- int ifail = ITK_ok;4 B& l2 \! W( G/ t3 r3 @* `2 q
0 C1 c, i& t$ {$ e3 X+ [- va_list largs;
$ H" V( M% k6 L" D1 O; J/ p - va_copy( largs, args );& I. z* Q# R( d( Z6 K4 Q) d
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);! c' j8 }$ u: \9 U0 b
- va_end( largs );
. v! g& {6 i! E; Z0 K% E
3 [# g; C1 I7 s+ A/ i0 @5 d" L- tag_t new_item = m->object_tag; 9 e& ^! y3 w( A$ s! `; @( y. l
- char *uid = NULL;' G2 q# I, t7 m/ p) t! P; x. c0 i
- ITK__convert_tag_to_uid(new_item, &uid);
8 n; l, M+ M: z& m - printf(" new_item: %s \n", uid);
) v5 i* H$ W! p0 {/ @7 z8 X# w - MEM_free(uid);( B; A; `( M4 Y; L9 i5 Z* u" e
- 5 ^$ d7 N: P( y5 {
- & u5 U" c. R* g' b3 N$ ?
- bool isNull = true;8 L& H4 N, \" H+ l# q& Q: r' k
- tag_t new_rev = NULLTAG;
- L+ G' U- w1 g2 s/ Y( D - ifail = creInput->getTag("revision", new_rev, isNull);9 P* A9 S2 t1 P2 b' f
- if((isNull == FALSE)&& (ifail == ITK_ok))
3 n! u" Y$ I! g: W" s% v8 F - {( p/ W/ A$ q$ T
- printf(" new_rev: %u \n", new_rev);
; T' o2 F! c. p: f6 c - }
" d" Z5 G( W6 A0 p) ?, v - 5 w5 i3 g$ }: f% K0 K$ T
- tag_t master_form = NULLTAG;( |) g+ z, o# _, d' q3 C' W
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);/ c0 K8 i ~# r
- if((isNull == FALSE)&& (ifail == ITK_ok))$ j7 [' W$ j; _7 F; L. x( S3 [
- {
0 F5 A4 T* p; o9 n+ y% [ - printf(" master_form: %u \n", master_form);
( Y3 t$ w' C! |: b# E, I* Y - }! p/ t" \; Z5 m( a: J+ ]9 h
* {$ [, k( S% J9 ^- std::string item_id = "";
- I+ @. k4 w/ b9 ]; X; T/ h - ifail = creInput->getString("item_id", item_id, isNull);
" k5 k1 N# G( V8 x - if((isNull == FALSE)&& (ifail == ITK_ok))/ _7 J& j- z) ]' N# D
- {
2 Y2 q! m) ^$ y - printf(" item_id: %s \n", item_id.c_str());
& u. e B* E+ l - }
- W0 W- A# B& e+ S( L - - i4 u; _* Z. S- K+ w1 [3 K3 W' m
- std::string name = "";% @. W v5 P0 W2 g1 n
- ifail = creInput->getString("object_name", name, isNull);
0 E2 f4 C: \5 d k9 c - if((isNull == FALSE)&& (ifail == ITK_ok))5 k0 c" O) r3 U9 U3 i, R, k
- {# V* N" K8 d% l( |
- printf(" object_name: %s \n", name.c_str());
) ^$ E0 A$ F( h" Y, ?9 ? - }
5 Y0 N, I, e) T
6 z& N" e5 `) A3 k4 p: C- return ifail;;4 a, B$ O$ z8 ~( Q" u& `
- }
' A9 b3 c$ f7 y, n1 ~" x
复制代码 9 a8 @' @9 y, B2 |8 e$ z: ]0 D
# ?5 N( L1 @2 A+ j5 s5 n" K7 }
) M1 H1 H# D% d4 E1 ^ |
|