|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, ?4 P5 e( m, M6 S9 z, ]; C
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作* n9 {- G: [7 `
- #include <stdarg.h>5 p2 E7 L: P) r0 C3 m) X) `
- #include <stdio.h>) x2 @5 ? M" w0 E. f5 X- O
- #include <stdlib.h>
) x/ n% m" b# l' A- L* ? - #include <string.h>7 ] V1 g* L5 i, C
- #include <UG_va_copy.h>
- ?7 A- T. |) |- b9 @# T - #include <TC/emh.h>
/ K) r6 f/ O% f% R - #include <ict/ict_userservice.h>
$ B( v9 i7 n: X# y' ? - #include <itk/bmf.h>
$ T) w6 m( l0 P8 H6 l - #include <tc/emh.h>4 J+ k" X- P P8 y
- #include <tc/tc.h>3 S# [. u3 o5 a) N) i: T, T
- #include <tccore/item.h>
0 L1 t- z% j8 g/ n - #include <tccore/method.h>% d3 n7 u4 {% O: h4 K& z1 U k
- #include <metaframework/CreateInput.hxx>
/ @0 a) V }6 t D - 0 k6 @/ {& g: ~ x$ r3 f
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
) `; }$ t! Y! j8 E M4 [0 a( A0 h - {4 x! S! ]$ f6 U1 u
- printf("\n\n A2_gtac_extension_rule \n\n");
- y& r$ d* N7 @8 k, i6 K% a - ) W" Y: z7 B; Q6 e. O! x
- int ifail = ITK_ok;% c9 b \6 \$ s/ @- D. ]: B1 I7 M
- 4 z1 t1 Y( g" p: M& q I
- va_list largs;7 t. P: ^, {6 w7 A% X! H
- va_copy( largs, args );) m) S( H; z- b8 F: ?6 o
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);; O! Q- Q5 G; V
- va_end( largs );6 w- p7 Y+ U4 m, \, @' O8 {* V
- ' |- w8 b- \- E1 L# f
- tag_t new_item = m->object_tag; # ?# S9 M5 ^" B+ v
- char *uid = NULL;. j" M- u$ w# e" p5 A
- ITK__convert_tag_to_uid(new_item, &uid);* P% a: H W5 j6 }% \& e! [
- printf(" new_item: %s \n", uid);
8 @5 ]1 g1 `* n: d; n - MEM_free(uid);
$ x6 W, y5 T9 M" h; C4 A
7 A6 b; h2 x. j' g, _8 M
3 e6 X" U# J+ F% j% X- C, b- bool isNull = true;
. U- E: n. J) L0 d- }+ F5 Y/ J - tag_t new_rev = NULLTAG;
7 i5 ~- k7 w7 E0 t, g% G% \5 b) [ - ifail = creInput->getTag("revision", new_rev, isNull);3 k- I( ~7 l- L6 R
- if((isNull == FALSE)&& (ifail == ITK_ok)), @, E' o9 E4 F9 u; ]8 Q) z5 ^
- {
2 d; o' ?- w: Y- f5 o- H# X2 M - printf(" new_rev: %u \n", new_rev);
6 h7 g2 V) }5 z4 [ - }
, }$ j! [! u, b -
q. g# W# Q; I r; J7 v - tag_t master_form = NULLTAG;
+ M" ~) K" r/ x2 g* b- S - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
3 j9 h( _, k( a0 z$ g - if((isNull == FALSE)&& (ifail == ITK_ok))$ n7 o- U: F% y! z
- {
; p G. m p: B$ ^ _ - printf(" master_form: %u \n", master_form);
( c$ V) r9 U- z9 B - }
# K p* E# g) \( r5 }# _: X
# c/ r& ]) e! D+ A8 p/ a5 K5 v" {7 Q- o- std::string item_id = "";7 C: z; w) B4 s7 d
- ifail = creInput->getString("item_id", item_id, isNull);. S; Z" c: ?- ]+ R4 j Y% k% \
- if((isNull == FALSE)&& (ifail == ITK_ok))( K/ g; \/ K8 ]! _* d
- {; M" V# b) M: s/ N
- printf(" item_id: %s \n", item_id.c_str());8 E) y; X. S: Y0 a& p
- }2 f; C) b' r8 E! |1 ~: _7 ]
6 b: ~1 o7 y0 C/ z- std::string name = "";+ e: E( c3 Y( B5 X
- ifail = creInput->getString("object_name", name, isNull);2 m$ @& t8 f$ b9 V( m8 A
- if((isNull == FALSE)&& (ifail == ITK_ok))% o# H/ Y9 u y1 k# l) s
- {( q) j: _7 b! w; W8 q, b+ C
- printf(" object_name: %s \n", name.c_str());
! [" U D& \" p% t- i$ A) z - }
- l3 t/ r8 s3 n - " w! o6 H, e E* a a
- return ifail;;7 j. Q5 e# Q2 i5 F/ m g
- }4 J( D4 }0 Q: Z+ n' H# I
复制代码 - q' a4 J3 T3 T$ a: z5 M6 X( k
5 k' o! y4 l8 t1 W j2 ]
- \/ p+ g* E- H& A8 p, s |
|