|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 V/ T& C t: xTeamcenter ITK二次开发源码分享: Item 创建 createpost操作
& j' k$ l/ b8 ]5 R) u# p. F8 o0 y* ~8 s- #include <stdarg.h>
+ M4 ^0 z# I/ z- o/ q7 V% z7 J - #include <stdio.h>
" }& q6 \6 F- ]$ J - #include <stdlib.h> t: X' h3 ^2 i8 k9 T/ ~8 F
- #include <string.h>9 v# Q) s9 E: y) J/ D @
- #include <UG_va_copy.h>- M+ o$ e+ n9 h$ I3 `, M
- #include <TC/emh.h>
& t0 y; I5 w5 a# ~ - #include <ict/ict_userservice.h>( u9 _8 C2 l4 Z" n. t2 p5 M# M
- #include <itk/bmf.h>
, A6 E/ \8 f, c6 [ - #include <tc/emh.h>* h+ g+ m; m9 {% _' \
- #include <tc/tc.h>( T! [8 e+ M2 u0 D& ^
- #include <tccore/item.h>
7 i) r6 K! A$ U: P& h+ J - #include <tccore/method.h>
; q% a. f# M9 C3 v1 C+ c, U - #include <metaframework/CreateInput.hxx>, Q4 o3 ?+ `+ t+ D. O
- 1 m" i P3 U; v* `
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)% B7 n4 P0 k# P \$ C5 m
- {
0 q9 T! x. W( S- ], R - printf("\n\n A2_gtac_extension_rule \n\n");9 B# C( ?7 `& a* F
, O4 o* z u( {9 C/ P9 @7 y) N5 ]- int ifail = ITK_ok;
; D! ~/ a1 h2 z! k1 _- s; ^
. Q) j9 B2 `* ]1 V# X; D- C% ^- va_list largs;1 [! Q! }8 [( W. i
- va_copy( largs, args );: e, B$ r. N' V# y i2 j3 @6 |8 p
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
1 V4 Z+ ]) u; J0 k, C - va_end( largs );! h9 }7 ?2 A' I" ^% B. W
- 6 c: j1 N R& A5 ]. O& e9 z# Q1 u
- tag_t new_item = m->object_tag;
6 v: L" F R6 U( J" P - char *uid = NULL;) K7 w# R* s4 q
- ITK__convert_tag_to_uid(new_item, &uid);" {- M/ E+ _8 E) K; a' \9 [
- printf(" new_item: %s \n", uid);% ]0 u0 g V9 j& J( ]0 n
- MEM_free(uid);( C7 K* o. m- E: [
- + b: y/ n. y. U& M0 w3 j& b
- / `1 Q4 f; L5 s
- bool isNull = true;
: f* l- R8 G0 R. ` - tag_t new_rev = NULLTAG;
9 l/ H- X; o' _ ^ - ifail = creInput->getTag("revision", new_rev, isNull);* }# T9 c8 C: l6 N
- if((isNull == FALSE)&& (ifail == ITK_ok))' b7 V/ R1 @9 ]4 }( F
- {' F# N% L3 I0 G) w: T5 Z
- printf(" new_rev: %u \n", new_rev);
5 e+ O2 W# w' C) S. o8 g1 O - }
5 ~. x/ A, T+ C- U/ F. o - 8 M% W2 K. K/ L$ k4 [" O
- tag_t master_form = NULLTAG;
( L7 z& b# D$ c& J% j w- P" V F - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);! t9 ]1 f; t z" P* P
- if((isNull == FALSE)&& (ifail == ITK_ok)): v9 B) e. x" w
- {
, O5 i. ]8 Q G+ } - printf(" master_form: %u \n", master_form);
; u/ T" l) X' G8 K! e2 L) x - }. W9 I" h- r; o0 \
- m- ]& i4 z' R: w
- std::string item_id = "";; ^5 r2 D; X }7 w1 I
- ifail = creInput->getString("item_id", item_id, isNull);. v! b9 M- f- Q8 P" b# X; N* Z- y
- if((isNull == FALSE)&& (ifail == ITK_ok))5 y8 M' {% d* ~, ^; `2 S7 U
- {0 x" j7 I" N! r) @& q
- printf(" item_id: %s \n", item_id.c_str());
* g$ z" F7 W, X) ~% C7 b - }
' W( ^, \3 J) d8 f2 _# }: E: O+ d - 7 Y2 C6 l: r5 C4 X2 ]& ?
- std::string name = "";4 j0 x0 x0 W: i/ W( }) }' B( k
- ifail = creInput->getString("object_name", name, isNull);' N- x2 A& g. U! f5 R! U
- if((isNull == FALSE)&& (ifail == ITK_ok))3 h3 f5 U1 T; q
- {6 d' E5 K& V) P
- printf(" object_name: %s \n", name.c_str());
* i2 l, |7 j# ~# W - }
( ?* t9 @: C* D2 R0 l; Z$ U# ] - 8 G4 e& J' [4 M* g3 g; H9 x
- return ifail;;* P8 {2 ^" L" U' I4 ^9 d3 Q
- }' }* r2 }* L( P; A2 m* r
复制代码
c, W7 l9 t' z8 @* E( O8 g+ r6 t( S+ h+ @# R. x
0 i i) h8 ^) {3 C2 n |
|