|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! k1 w" {1 Z# B1 C3 L) m
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作4 H1 V1 w6 c9 ?3 p) L
- #include <stdarg.h>
. ]; m& b' r: b% M - #include <stdio.h>
2 ~$ K6 m+ g: w, y" k' O - #include <stdlib.h>! t9 |, D; w" N2 e$ F
- #include <string.h>
# C3 V: A y$ O7 U& G$ O' Y3 k - #include <UG_va_copy.h>" N4 h* d) A, Z4 w5 |
- #include <TC/emh.h>/ Y. C$ \# G# B
- #include <ict/ict_userservice.h>! O) [* Y$ I) x' X
- #include <itk/bmf.h>7 q* C4 |5 `8 @& d) \, m" S
- #include <tc/emh.h>& z) N8 R6 {# A3 I
- #include <tc/tc.h>- Z2 Z7 G- Q' {. L2 r" y: y
- #include <tccore/item.h>2 Y) |2 m# R4 ? J9 g" _
- #include <tccore/method.h>
: I' i, d6 [; w+ T8 U, X - #include <metaframework/CreateInput.hxx>; t/ E9 Z+ U% L$ h. B
4 {8 K0 ^$ E5 }- P7 Q- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
2 M; D- p) m: ?6 S8 H. H: K - {
+ J+ ^% C% l5 V$ I7 G - printf("\n\n A2_gtac_extension_rule \n\n");/ }0 H5 V# a" [& c0 ^; R8 W
" |$ y6 H; c0 y& [8 X- int ifail = ITK_ok;
) S8 o' M8 M( N+ v
( V, C+ C4 | h$ B4 k- va_list largs;
3 I$ U0 j6 e1 M$ h/ h - va_copy( largs, args );
; i5 t( a$ I$ U- O - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
# p8 u! n. Z i9 R( r* W - va_end( largs ); `" W3 i+ I2 X0 Q
- ! W7 }) j* m0 z2 }- b7 |
- tag_t new_item = m->object_tag;
5 g9 M" d: O. _2 q8 a - char *uid = NULL;
7 ]3 B! ^, |' j+ z$ b" j - ITK__convert_tag_to_uid(new_item, &uid);
' ^; \- c0 W9 v4 k - printf(" new_item: %s \n", uid);
7 X! g% Q2 J3 E' ]8 l* Q - MEM_free(uid);6 P& ~: I% K+ D+ n: N
' C3 C7 d. ^# V# g( W: @
% O3 x( ]0 w+ x8 ^9 u- bool isNull = true;
. L7 N* Q, ?7 S3 Y2 M% L$ G& w7 q - tag_t new_rev = NULLTAG;1 f m \* f3 f4 ?5 x
- ifail = creInput->getTag("revision", new_rev, isNull);$ X2 K2 ^( z8 U0 Q: P- @
- if((isNull == FALSE)&& (ifail == ITK_ok))
1 F; S1 l) L! c - {- p5 Y0 v- e! I, F! f
- printf(" new_rev: %u \n", new_rev);) E P9 @- t) x- p: \- K
- }
' G8 B# F( e- p% b+ P2 ^ - $ g5 D! j6 F* }/ B, H
- tag_t master_form = NULLTAG;3 S9 Q" i' u S, [
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
% `# L* n3 t2 H& `% X' k8 V - if((isNull == FALSE)&& (ifail == ITK_ok))! m7 H2 H$ s# P% N) F
- {" M6 h; D& I+ Q% p+ a$ f( B
- printf(" master_form: %u \n", master_form);
% l: s" y* Z+ x3 _2 ^) m - }; _7 s/ W, _( y4 K
- % h* ^9 N: p& N+ R
- std::string item_id = "";
, s) P; s$ H7 Q% B8 H' i - ifail = creInput->getString("item_id", item_id, isNull);
( U4 z5 I" z- z c$ K7 G+ P - if((isNull == FALSE)&& (ifail == ITK_ok))1 h! R2 p. e d% v9 G
- {
& {: F4 {9 d7 m( {1 D( ?- |) g$ I - printf(" item_id: %s \n", item_id.c_str());
1 y; Q+ t% w7 w9 s; M - }
1 v {) m+ F7 p
' k. z7 Z& {: S6 q, R! n: A! k- std::string name = "";
! A) m9 G: j4 b) \- m9 m: c; g - ifail = creInput->getString("object_name", name, isNull);
1 L: c9 g9 |; S- I! \, \$ G5 f - if((isNull == FALSE)&& (ifail == ITK_ok))) }# b' H. @* u, x+ w& G6 x* H
- {
& r* k# T. A3 G6 u. e9 x - printf(" object_name: %s \n", name.c_str());
3 K) K1 b7 M. ] - }
3 x" }: N D! B; C5 w4 A& X
* O6 Y+ f/ o) ?- return ifail;;
5 @- A6 ~+ y2 P# C% ^7 x9 J8 {% t - }
9 g' a# L& B/ G, W8 f) Y6 Y4 N
复制代码 8 @/ V N$ A( z, T' V2 {
+ h& s4 A6 s' U+ p' `& T k1 N+ |! n
0 d+ a2 b- W4 W7 O' c( O |
|