|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 ]% i" X& d* \
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
% g* E# a, t8 C2 q- #include <stdarg.h>
) O4 P6 |* f% Z7 v! X2 [ - #include <stdio.h>5 q- f0 M! O2 V* B5 j
- #include <stdlib.h>" g- m- o& ~, c+ U! z
- #include <string.h>
$ ]- X1 M; q# h1 ]. e! G! v9 Z - #include <UG_va_copy.h>/ u$ k4 h6 G, W% J0 Q! W) c
- #include <TC/emh.h>
7 |! P6 y9 Q w% z - #include <ict/ict_userservice.h>
3 H# e9 T' b8 q/ D% c - #include <itk/bmf.h>
+ G N, r9 f& l; K! Z' }8 i - #include <tc/emh.h>
e* R* V. W: U3 _ - #include <tc/tc.h>1 j& _+ d$ R3 P2 W5 t
- #include <tccore/item.h>4 b8 e; b5 g1 e/ U1 ]9 {2 h
- #include <tccore/method.h>+ v. l7 A) n9 B& U
- #include <metaframework/CreateInput.hxx>
3 l4 c% w( D: e- n - 2 N9 z* h. l7 e/ m( {
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)7 J& O/ ^1 Q# |. @+ P5 d: O1 Q
- {
9 `& ]' d4 d: L3 [8 m - printf("\n\n A2_gtac_extension_rule \n\n");4 ~5 L* }8 k1 T6 I" J
7 @' x3 q( U- N' _: {) W" T- int ifail = ITK_ok;
" N1 |* ?( U, | - , `6 Q5 x% D$ f w+ a' ^
- va_list largs;9 d; j! ?) _- Z# [" C
- va_copy( largs, args );
3 b [' P. E9 T4 a/ G0 o - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
: d/ @7 x9 T- x# I - va_end( largs );3 Z5 L+ `4 J9 w
- ; P/ W5 K3 P4 I) T& y
- tag_t new_item = m->object_tag; 5 h1 h2 p2 o. L
- char *uid = NULL;( F a/ W1 T6 w3 z/ D
- ITK__convert_tag_to_uid(new_item, &uid);# P+ U$ a0 D- G: H, F* \+ Z
- printf(" new_item: %s \n", uid);
: o* c6 v. D) p! @ - MEM_free(uid);
2 A' p4 y; T( d- i
3 v9 W: |0 M1 ?5 j+ S4 _- 2 s& t) m$ i$ k% M n; X4 q
- bool isNull = true;
% v: R Q, n1 ~" L9 u i. E - tag_t new_rev = NULLTAG;4 T! C, u% Z: f1 O+ {1 t# d
- ifail = creInput->getTag("revision", new_rev, isNull);
# d. Q+ \) l, _: k9 f' b, \ - if((isNull == FALSE)&& (ifail == ITK_ok)) c3 @" B5 c5 T* c) [6 O% X
- {
: k5 O7 S0 f L0 F7 O- e1 U7 g - printf(" new_rev: %u \n", new_rev);
7 g5 d% Q2 h) P - }& U3 M9 y, d3 T) ^
- 2 d" g1 n8 e1 q; d- K9 C. H
- tag_t master_form = NULLTAG;3 ]* ]; N* o, G. B1 d7 S$ X
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);& s+ Z ]$ y( o& u; T2 t0 t
- if((isNull == FALSE)&& (ifail == ITK_ok))' R8 F9 y3 P0 v
- {
( m+ L1 P- t$ w" R) F: Z. ?2 a; P5 ?/ Q - printf(" master_form: %u \n", master_form);
; D9 I6 D \9 i. E, T - }
6 z, l! ]+ N6 s" o) x8 ^) p - # b! a; M& R# T& I B. j
- std::string item_id = "";1 p4 Q3 F5 e* B' Z/ a
- ifail = creInput->getString("item_id", item_id, isNull);
" A/ h! R) P. \' n+ W+ K( U! t9 a - if((isNull == FALSE)&& (ifail == ITK_ok))
1 H% z: v k* ~: v6 Q* B" N - {2 h8 l1 j9 K" j( u9 k. j; a
- printf(" item_id: %s \n", item_id.c_str());
/ X6 b. P' {3 x- ~ - }
4 u' S: ?8 e3 k( _! r. F+ f - ' h T2 S5 H3 G! ^2 Z: v
- std::string name = "";
8 k8 G, L/ w) Z1 E1 t0 C& K - ifail = creInput->getString("object_name", name, isNull);
( }. M. G, T8 H" x( k+ X# j - if((isNull == FALSE)&& (ifail == ITK_ok))0 g, y/ R' g, V- Y/ R; _! y
- {, m1 @" k6 C. ?/ d
- printf(" object_name: %s \n", name.c_str());# @: \* u9 @' M7 n! @
- }! b: j, b) s6 Y6 I# b" N3 V6 G
( ?& k5 s& Y$ O- return ifail;;
% W% P0 z% v0 e9 l - }% Q1 T3 j- c6 [, U
复制代码 6 W4 t' J# y2 A- O. @( c `
: g) z; X, R, }. ]
% f& \( L+ p/ f' G- L+ Z- z |
|