|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 B7 y4 b9 F) J
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作+ T5 X0 p( {$ Q8 P' z3 H
- #include <stdarg.h>
5 o. ]8 L% b7 s. i - #include <stdio.h>
3 f/ ]( }+ b' j0 C6 ~4 k - #include <stdlib.h>" @* H( i# b7 T8 J/ S
- #include <string.h>
7 B4 \: k) B5 U; n - #include <UG_va_copy.h>
% l1 n0 n5 a/ l5 D - #include <TC/emh.h>( Q' H6 k) i) i$ o& m. I9 ]9 L
- #include <ict/ict_userservice.h>
3 n1 g, F8 t5 d; ^& ^8 ~ - #include <itk/bmf.h>7 Y! L, K5 U( e. ^2 S+ i! K
- #include <tc/emh.h>
/ B0 s+ e" k3 D+ }; V - #include <tc/tc.h>; Q* t* n/ e6 Q% _* l
- #include <tccore/item.h># [$ d F) k* J1 T0 X( x8 k. {2 I
- #include <tccore/method.h>
4 g. R& p* c8 f3 t" F7 S - #include <metaframework/CreateInput.hxx>
# D2 G# s0 L/ J1 i# W# G
# q3 T( O, v% h- \7 ]) k/ W- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
: H! ?2 R. e1 @/ x& @ - {
, p! {* r* W3 g4 i - printf("\n\n A2_gtac_extension_rule \n\n");4 ~! o8 v7 K5 C4 h, D9 p
- 5 h. I; g* j7 J6 i" l* m2 @
- int ifail = ITK_ok;# I2 _; ~8 T; M4 z9 j7 Y
- " N! L }$ W! `" P4 _
- va_list largs;
0 ?/ R/ R6 Z/ c6 { - va_copy( largs, args );8 X2 ^, t1 ]& ]; G: F! K9 d
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);( _; a3 \& _9 E1 d. t* a# v9 ^
- va_end( largs );" \: ~7 Q8 m* j. g
- ; z8 j& q2 O9 X
- tag_t new_item = m->object_tag; : F* [1 z$ u$ a) Y( }3 r1 p. _
- char *uid = NULL;
" L Z4 {( `& Z: j# _3 H - ITK__convert_tag_to_uid(new_item, &uid);
0 L4 B' }+ h7 o* O% V - printf(" new_item: %s \n", uid);
4 E% v' q) c5 j/ q - MEM_free(uid);
" o& T0 q& p- ^ f L: \
" R, U: W) l* w6 O8 P2 _
' ]. D% s9 @1 z; m r- bool isNull = true; N% k7 s4 e+ `' o
- tag_t new_rev = NULLTAG;9 g( u# g2 f C5 [1 o
- ifail = creInput->getTag("revision", new_rev, isNull);
1 R' S# N; v$ b' [/ b - if((isNull == FALSE)&& (ifail == ITK_ok))- Y; A2 O0 [) K
- {! y# r4 p5 j* i0 [
- printf(" new_rev: %u \n", new_rev);2 q! i7 ^) f8 E I
- }
' c& l# h- G5 ?5 ]- A) o2 u6 w4 ?! I2 s -
0 k6 o) A+ c% ?, J* { - tag_t master_form = NULLTAG;
/ F: E, Z3 |1 s" ^ - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);' _. |+ O2 w( Q$ {1 x
- if((isNull == FALSE)&& (ifail == ITK_ok))( N3 M! A# [* @: Y3 d0 y
- {
' f2 C# D0 H( A - printf(" master_form: %u \n", master_form);- Y& x; o u; Q0 s
- }
; ?5 W8 e/ f2 B$ l+ J+ \/ W
& M8 {9 `: `* Y2 X, t' e0 l- std::string item_id = "";% V+ `1 g& r) j
- ifail = creInput->getString("item_id", item_id, isNull);# o% V" p1 }1 i4 _
- if((isNull == FALSE)&& (ifail == ITK_ok))8 r2 @' R, a' R4 y" o4 y# `: P
- {
" @2 }3 ?, ~+ F5 t - printf(" item_id: %s \n", item_id.c_str());
0 T/ `* m5 W. D x" f - }
8 P- i4 d$ d* o7 D - # V& A9 `" h3 s2 x& C E
- std::string name = "";# T& k9 I- d* Y
- ifail = creInput->getString("object_name", name, isNull);
' Y6 I2 O5 d* s3 X6 B/ s - if((isNull == FALSE)&& (ifail == ITK_ok))0 F6 m A, q s
- { C. U" `, u) u% s3 z, e, L" U- x3 {
- printf(" object_name: %s \n", name.c_str());$ ?6 L$ e6 D) I# c
- }
: X3 g" V7 ~' `, B, F4 ?- i - & S: D$ J. C. H- t+ u
- return ifail;;
0 g' D% l* V+ X* i6 R4 J3 g* M. U - }% z; `, r8 y7 O m# [
复制代码 . O4 e4 }+ ~5 }2 J3 u6 l, w0 M5 f. t
& v3 Y' J! P$ O: Q
1 {/ l* h$ Y# {. F4 ]
|
|