|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# O& k2 G- y$ n {0 I# i' o, oTeamcenter ITK二次开发源码分享: Item 创建 createpost操作
. \: P+ P" {) |6 o9 ~- T) O& {8 e- #include <stdarg.h>( l5 c) u+ I4 n4 S
- #include <stdio.h>8 Q8 K, B# C4 L2 c. d
- #include <stdlib.h>" G% ^/ T( x1 j2 ~7 t% C1 r
- #include <string.h>
% n$ B9 r( g0 B - #include <UG_va_copy.h>0 E# d' C6 x4 ?8 R/ q$ P C7 Z" S
- #include <TC/emh.h>
" d; C! ]3 J4 y# X - #include <ict/ict_userservice.h>
/ Q& a# E- k' N) X - #include <itk/bmf.h>5 O4 j7 \4 ~5 c9 }' ]! S
- #include <tc/emh.h>; \* }# c3 d8 K V. }
- #include <tc/tc.h>1 N, v' H! o1 D3 r9 ?( H
- #include <tccore/item.h>
6 ?5 S8 o1 r! C+ |- E, ? - #include <tccore/method.h>
; Z) Y% ]+ q/ Q" j1 s - #include <metaframework/CreateInput.hxx>! D- P+ _" Z* T7 D- X, v
0 q3 G9 i( t/ f7 p- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)& A- X1 W. j- b+ I% H/ U, J
- {4 M/ Q8 U2 |% t. }
- printf("\n\n A2_gtac_extension_rule \n\n"); r0 N5 c7 Z* W; p! h/ s
/ V, f, ?6 E; n3 `0 P- int ifail = ITK_ok;
1 ]. K* P4 ?6 S! s* v
7 N& R6 W7 l8 H6 V8 ?! \, q+ H- va_list largs;
2 S' g3 a# |# ], ^) r$ P ^ - va_copy( largs, args );. Q, Y4 T9 h* o6 j* v1 P
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);# y: P! n* ], e3 E9 T
- va_end( largs );
& U+ A6 n# A: K o
; c7 F7 X8 n4 T1 P! ~0 R( V& }- tag_t new_item = m->object_tag;
1 Z G+ @3 D, Q) |/ S - char *uid = NULL;/ U8 g0 n* c& a5 j# I }
- ITK__convert_tag_to_uid(new_item, &uid);1 V4 L& o5 g( `* L9 y# h; |
- printf(" new_item: %s \n", uid);, m' I! C* `( `9 g0 p0 B- P
- MEM_free(uid);9 x4 y9 q. j, s* w" v) X
5 _+ d: h3 h! C9 n# ?
6 [- A; M6 v7 N/ Q# M- bool isNull = true;3 c2 B( Q" `1 b+ s1 G
- tag_t new_rev = NULLTAG;
# Z, v C* ^9 p3 z( l - ifail = creInput->getTag("revision", new_rev, isNull);3 v. K6 P/ P% c; \
- if((isNull == FALSE)&& (ifail == ITK_ok))' v8 R# h. y' U8 o' l" p
- {( [: h) D' C+ b! f6 M# a
- printf(" new_rev: %u \n", new_rev); S, {9 ~( ], C! G4 ^& _
- }$ p, h! @% T, ~3 ?
-
& v8 G+ H( }( n7 [ E ~& y& ~6 v: C - tag_t master_form = NULLTAG;! @0 _+ ]" _ F0 ]
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);& k6 O4 ~ i- n" u; Z' I: c# `' |
- if((isNull == FALSE)&& (ifail == ITK_ok))- s# `$ c" N- h% g1 E7 ], \/ H! R: {
- {3 b+ {0 |' r3 i, o+ o
- printf(" master_form: %u \n", master_form);$ B! J* d- C6 C+ @
- }
b" X2 Q. F4 u# [8 Y: w1 n
. b' n) {: y8 q% M" \6 S; {& ^- std::string item_id = "";( h9 K! y" N! @. } A. _6 W
- ifail = creInput->getString("item_id", item_id, isNull);
: j, u3 ^5 Q6 J1 {) @ - if((isNull == FALSE)&& (ifail == ITK_ok))- T' p8 T& F" q0 g
- {7 c3 T( O! O" X7 Z' G' V1 t# c
- printf(" item_id: %s \n", item_id.c_str());9 |( [& J( V4 _
- }1 t3 L) d2 W( t9 m# I
+ P/ I! b$ c' G- std::string name = "";7 |4 Z) W( X) ?1 C% ?2 f
- ifail = creInput->getString("object_name", name, isNull);) l$ t$ V$ e& @
- if((isNull == FALSE)&& (ifail == ITK_ok))' D' {0 h" A$ H
- {
) H% p5 L% m# v: k# x# B - printf(" object_name: %s \n", name.c_str());( Y4 c$ D' k4 J& j% [2 p$ v
- }
+ G# U. I9 W/ m2 q+ ^8 `' G - " m* z' p3 K& W6 B7 ~
- return ifail;;6 \) v- s' }2 B: @5 n% X
- }7 D& e$ n; Y8 {' ^$ {
复制代码
2 }+ u6 ]: o* f$ _2 n) w9 I- T$ z
5 j0 F* n' [* g9 y. T( q; R8 P8 K |
|