|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& Z3 n/ |8 t0 C1 \Teamcenter ITK二次开发源码分享: Item 创建 createpost操作7 I5 x( k0 z4 c2 a
- #include <stdarg.h>' E) q: x) z2 Y( x
- #include <stdio.h>
2 c! u- P* e3 X; o. F - #include <stdlib.h>
/ E- J$ S0 }( X3 I% | - #include <string.h>
^# V5 L9 @5 c8 Y/ O8 r - #include <UG_va_copy.h>6 Y/ K* ]4 ?: O$ b' r5 r/ i
- #include <TC/emh.h>
6 `' {6 ^0 f7 s: z5 v7 b' R" W - #include <ict/ict_userservice.h>+ I7 H" Q7 w0 J, l6 `! N( ]
- #include <itk/bmf.h>8 u* P4 J6 o0 u; h
- #include <tc/emh.h>& p, G/ \/ P. j
- #include <tc/tc.h>
9 p3 G* u* f6 N! L8 Z2 _ - #include <tccore/item.h>
) R1 v: F) \0 Q( X/ k - #include <tccore/method.h>
5 c/ n( b% g- j4 I+ R- f/ G$ w0 e - #include <metaframework/CreateInput.hxx>
* _" w. y) ^% F/ q- H
% @9 H9 K% [" o1 `. v( G3 M- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args): }' S) { @& w4 Q- l
- {! o0 q% G) B" W: u
- printf("\n\n A2_gtac_extension_rule \n\n");" |) C1 I3 c+ A' u
7 I/ |. _7 Z; Q( L- int ifail = ITK_ok;
1 v/ t2 e F& F6 H8 _/ \3 p
+ M3 U: G7 ^) L! `: c- va_list largs;
+ @) Y2 ]0 o8 h' `) h - va_copy( largs, args );; P2 o3 G1 o. o
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
8 B& {! z* z6 Q0 |7 X - va_end( largs );) l7 U" D# M6 J/ G$ C
) X( `& j& R; x* }$ m, z# G" \- tag_t new_item = m->object_tag;
0 B1 C; a; ] v. z5 F - char *uid = NULL;
/ ^) n9 g& [ n+ L - ITK__convert_tag_to_uid(new_item, &uid);" {9 l. ?' g5 ? y1 D4 T
- printf(" new_item: %s \n", uid);6 k, f. T6 @$ F. T S. e
- MEM_free(uid);
2 m* {& q/ C# m1 a - ; b1 B1 Q: x! r+ V) |. n
- 4 i% ], Q! ~+ P* X
- bool isNull = true;0 b! Z: a. S3 ]( g0 [+ i/ [
- tag_t new_rev = NULLTAG;
y Z, ?7 A' @4 l# q - ifail = creInput->getTag("revision", new_rev, isNull);
1 a( g. x9 W7 }$ D/ F& ~ - if((isNull == FALSE)&& (ifail == ITK_ok))
q5 w, _- P8 x& }# Y - {
- M# @4 {/ [$ K4 N$ j7 u) v- ] - printf(" new_rev: %u \n", new_rev);
7 @" G$ E) S8 [- R' f( [+ [( F# ?8 n, S - }
+ d+ z/ ]- V% f( s" y" u( j( f -
6 M0 R- S3 ?) b: Q1 a$ N1 Q - tag_t master_form = NULLTAG;
% f3 g% [% P1 K7 ?- s - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);; D a6 B/ D3 f& M1 Z9 ^4 q1 w
- if((isNull == FALSE)&& (ifail == ITK_ok))) J* H% j) ~+ a5 Y# A' B
- {1 t+ `9 d# a( V! N8 n
- printf(" master_form: %u \n", master_form);! B. s5 p3 G" N, L
- }
8 d3 P1 f: Y6 d - ) C9 t+ {6 a$ {
- std::string item_id = "";7 H# s+ A m' g! N- z; w/ M6 S8 u1 P! B
- ifail = creInput->getString("item_id", item_id, isNull);6 I8 p7 p9 e* }6 J! l
- if((isNull == FALSE)&& (ifail == ITK_ok))
) ?0 k: I* W6 |7 u! i - {9 Z3 y* T& w) u$ Q+ a5 O7 l* k
- printf(" item_id: %s \n", item_id.c_str());7 _/ o. c4 l% a O, C& L! D
- }, \) |3 {1 K* P: s+ x" }; q. t
1 z- R0 d2 K) X% G* z/ P5 w8 D# I- std::string name = "";
1 D7 n4 c4 i+ M. r+ @& `- X; u - ifail = creInput->getString("object_name", name, isNull);( } R3 j# u2 g5 B, ]/ x9 K- i8 ], E
- if((isNull == FALSE)&& (ifail == ITK_ok))
, W0 j' v0 d! _% D# W7 D$ B - {: V& {7 D. v+ O$ w) j
- printf(" object_name: %s \n", name.c_str());
7 ~( Q: @4 r5 [6 s1 T - }
& A2 T' ^: `. A* P' y - $ W0 N9 k K D& H. V3 f/ c7 n. c
- return ifail;;
: X/ G. y0 } a - }
3 q0 Y1 x* n) x- n# ?
复制代码
& D3 |/ ~/ E( ~6 p
- l, t4 |; }% i9 S
: M; H+ c6 n' C2 S2 t5 L |
|