|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
4 u* o# n6 x5 T/ V+ o- P" p7 q: O: X- x
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作2 ?: B- U) |& q+ u& j1 W' h: c# Y
- #include <stdarg.h>
- H9 y' G: i2 o: L - #include <stdio.h>
8 ^* k' |4 j* i/ B `3 p - #include <stdlib.h>; v8 |* v4 b s, ~
- #include <string.h># F, H) [& e1 |- ~9 F3 R7 k
- #include <UG_va_copy.h>, W2 ^3 w5 X$ E; ~2 c$ e/ c! m( @
- #include <TC/emh.h>: S/ X/ j+ p4 I0 P
- #include <ict/ict_userservice.h>
1 w o) E8 l3 m8 Q/ y - #include <itk/bmf.h>1 e) U/ K4 W% j6 s% K' S. L: h
- #include <tc/emh.h>" A6 r2 l' s5 \% u% q
- #include <tc/tc.h>
" x4 C' u5 m; E" o( I' W - #include <tccore/item.h>" @2 Y% D6 q% L J1 T6 A% `
- #include <tccore/method.h>
& X/ R: Z' y' y2 |( a: I - #include <metaframework/CreateInput.hxx>( N! D8 `5 |; \. D2 i: n1 ~
4 d) B) \6 @( q8 X7 C7 g. X- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
* n8 D7 p# a# U - {
. e1 A, |1 |6 O* n - printf("\n\n A2_gtac_extension_rule \n\n");: Z- `* M) {( D) Y# R
- 6 K# N0 x- L4 r* j8 B! ]
- int ifail = ITK_ok;
3 i6 I' [' j: c
0 u( t) h7 p q' l7 U) b) h- va_list largs;
) @; D# G X0 B( x* L/ Y - va_copy( largs, args );
, B3 {! T5 l. N+ o4 S - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);! c/ V+ I* |7 W% k+ ]- J9 p9 J
- va_end( largs );$ w G. k0 b, i
- 4 l' [, A$ o @# b3 H3 c
- tag_t new_item = m->object_tag;
9 m- T. S& n# G5 j7 A) g/ M - char *uid = NULL;1 a0 y% M q( ]3 o# \8 i, h
- ITK__convert_tag_to_uid(new_item, &uid);8 E+ ^. A8 O2 f* Y/ n
- printf(" new_item: %s \n", uid);
1 q; U2 d7 i R - MEM_free(uid);
! J* a& a. m# S! ?- e7 F - $ Q" L1 H# P, R9 N2 Z& E0 A
- 3 e1 A. U) {3 Y0 s) s" u
- bool isNull = true;) R6 U! m6 B9 m' `% r4 W1 g
- tag_t new_rev = NULLTAG;; c! v; q2 N% x
- ifail = creInput->getTag("revision", new_rev, isNull);
' @) ?9 v! p" c8 Q5 p6 |: F - if((isNull == FALSE)&& (ifail == ITK_ok))" e& Q1 }$ B1 @6 s# n) U
- {
; H4 I8 f4 @( t( }3 f% V! g8 N - printf(" new_rev: %u \n", new_rev);
) f' V. l2 c+ ` - }
" {8 l- Y9 a7 r$ v- } -
% V( g. X; e$ I/ {6 Y) r( H& X! h9 s' @ - tag_t master_form = NULLTAG;1 D& c$ F; F7 B) ^
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
7 o2 g- v$ u ~% M; Q9 z - if((isNull == FALSE)&& (ifail == ITK_ok))
9 I' ^4 @$ W, S - {0 }2 r+ y+ \6 Y$ y2 N, w' Q! \0 G
- printf(" master_form: %u \n", master_form);. V. `2 a q5 z
- }
) r; {8 [1 p/ O9 p6 X
- `/ ^. A# @1 M3 H/ v0 G- std::string item_id = "";) U, r5 Y4 G2 K T h6 P6 a+ w5 l
- ifail = creInput->getString("item_id", item_id, isNull);
; D/ Q' D% {9 E7 j, _, I! [ - if((isNull == FALSE)&& (ifail == ITK_ok))5 v% B9 z2 V2 n
- {; w( C# F R2 k: ~0 J8 N; e- E+ ^
- printf(" item_id: %s \n", item_id.c_str());
1 z5 O& t9 o' }1 d - }, Q: J" W9 g% s: C5 K" [$ ?
- w' {( t4 G5 |& R
- std::string name = "";+ f6 J5 @) Y+ e; ^3 C( Y# V
- ifail = creInput->getString("object_name", name, isNull);
1 O! q* |7 L6 \6 L - if((isNull == FALSE)&& (ifail == ITK_ok))& d+ f) C% F3 e5 w# B2 T
- {
' r( `2 p- r7 H- |6 j1 n) D - printf(" object_name: %s \n", name.c_str());& i- H! {* |8 n7 M8 i$ T( [) D
- }
2 d8 g2 F0 ?7 A7 t) X - 3 O/ l) `3 Z ?' N* g
- return ifail;;
) p5 b$ G+ C9 [# e8 Y. l! l& c - }
$ D* Z% l* F/ t; Q- O
复制代码 8 ]- a, A8 o- A) [7 k$ [
& B" `- U: d' } G
8 m6 p9 e/ `! k, P% P |
|