|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* J6 [- O+ R0 @+ ETeamcenter ITK二次开发源码分享: Item 创建 createpost操作
( s# ]! Q$ X, m, Q- #include <stdarg.h>. J) M4 A! n% D, l
- #include <stdio.h>
7 l' B8 P; u7 k& f - #include <stdlib.h>
% y" m' ^$ t1 T6 n - #include <string.h>
$ D- T. L2 c: @7 E* T3 q' ? - #include <UG_va_copy.h>; A0 g- D* ^8 X: F
- #include <TC/emh.h>
- ^+ \- V- X$ D - #include <ict/ict_userservice.h>; ~1 k! _/ D& O5 f
- #include <itk/bmf.h>
$ T0 v: H4 k$ Y- j u - #include <tc/emh.h>" m9 Z' v1 A' R) [+ O+ U: Q4 S
- #include <tc/tc.h>- [& j8 c: L& P$ @3 T
- #include <tccore/item.h>
3 w5 E6 h9 o8 H& F - #include <tccore/method.h>* h5 O& m2 j3 X
- #include <metaframework/CreateInput.hxx>
% y$ i: s; U9 v) A4 r% x
) u: \ J. a' R6 b* W3 J- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)+ K8 H- Y9 x5 b) N! ^; \. X
- {& P# W# C: {/ H; k) g
- printf("\n\n A2_gtac_extension_rule \n\n");' P* i7 C- _2 s4 ?+ u
5 {+ C K" F3 x6 n* S3 {- int ifail = ITK_ok;& l, l$ q0 `; ]: a5 k
- , D9 f8 p$ m; Y2 `& E+ X q
- va_list largs;
: w4 m* i7 ]: O5 a - va_copy( largs, args );
2 u8 X4 p5 r% h) @ - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);% d/ X) {& b$ `
- va_end( largs );
`* N8 q+ P2 m2 {5 e - . e) a. H9 C' N. x( u' U, r
- tag_t new_item = m->object_tag;
$ |- k" M: r# _ - char *uid = NULL;
) H* t# h8 ^8 v5 _2 S' x - ITK__convert_tag_to_uid(new_item, &uid);% `, K& L. k2 B
- printf(" new_item: %s \n", uid);2 c) r: s4 C8 o( o, K6 l0 y1 x* E
- MEM_free(uid);& m% ^4 L* K9 P
- 3 x/ r# ]5 O8 f, f, p4 d
- 5 f5 }: Y, o, p0 s
- bool isNull = true;
, j1 x! V8 N% F% i+ k - tag_t new_rev = NULLTAG;
$ s0 V/ ]/ ^% E5 g: W; f - ifail = creInput->getTag("revision", new_rev, isNull);
7 d1 F6 s0 o/ R - if((isNull == FALSE)&& (ifail == ITK_ok)) p! o5 i# N$ X$ k- e( [0 Z
- {3 B% y( y, m* T- U
- printf(" new_rev: %u \n", new_rev);7 ^% u9 ?. Q' q9 @" u
- }
& b; y$ s5 W9 Y - 7 B6 s/ h4 P9 U% x6 l3 v
- tag_t master_form = NULLTAG;( S. A+ K" X6 s& a2 J; r. I
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
' f; ]' }$ P5 m. s, P - if((isNull == FALSE)&& (ifail == ITK_ok))) Z: V# x Y2 T; m% j
- {
( |, Q, U, q$ [6 h7 {2 b - printf(" master_form: %u \n", master_form);
5 U5 Q8 Z; N. p$ w1 K9 r - }, E1 q# c6 C+ L# E: W: V
- / e' a0 I2 i% i: n: U$ }
- std::string item_id = "";
f& N! E2 ~- I+ G2 P& \ - ifail = creInput->getString("item_id", item_id, isNull);3 U8 j3 _+ X/ o1 R7 |9 [: M3 B
- if((isNull == FALSE)&& (ifail == ITK_ok))
! q( _' I% }! O4 {/ C - {
' S0 O& ?$ `4 L6 D' Y0 j/ [ - printf(" item_id: %s \n", item_id.c_str());
) A7 n' h* q. E( g# f; T - }
& ~( z9 k6 |5 a2 i% b - 8 G7 V# c7 F0 \1 ~
- std::string name = "";
% E& a0 `6 u9 ~ - ifail = creInput->getString("object_name", name, isNull);$ {; G2 V; P$ W: ^
- if((isNull == FALSE)&& (ifail == ITK_ok))1 R# G% P0 C$ u- T; Q
- {
* r2 T& S% D. `1 T8 f - printf(" object_name: %s \n", name.c_str());' Z/ |) }) @5 X- p( M
- }
! q3 {$ s5 \7 Q2 } - 2 ]0 t& x; T! g, T# ] o. Q* X
- return ifail;;
9 q0 [5 }4 Q/ h+ O# Y3 w! p; ]) I" u - }
3 `0 o, A4 I. m- x+ v/ s$ V
复制代码
5 G |$ B# _) D1 O
/ g0 i5 K3 q' ~! W9 B6 c/ J/ X+ ^" K6 U+ ?. D6 E
|
|