|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) `! D5 ^7 ]/ C9 Q) K# Z* s
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
2 r+ N( j6 [2 W$ Q, m! ~& m- #include <stdarg.h>( q) ?/ E" V1 b, w$ ]% L: e
- #include <stdio.h>3 j# C6 P- y# G
- #include <stdlib.h> q3 B# g* f6 i/ z- g/ q% c9 n( b
- #include <string.h>; ?1 q3 @8 P1 o9 U4 k% r
- #include <UG_va_copy.h>
1 k! f J7 \6 t7 t! T8 o - #include <TC/emh.h>, H3 h5 D8 k) F8 P" L
- #include <ict/ict_userservice.h> {' M7 y, R# l, g0 u
- #include <itk/bmf.h>: j! Y7 H. d6 V- m$ {
- #include <tc/emh.h>; h, ~; s3 I& J2 Q9 c. v/ y
- #include <tc/tc.h>
`( H$ j5 i, f$ G5 J - #include <tccore/item.h>9 c, ?( Q0 v6 ~+ n+ |+ N
- #include <tccore/method.h>: S* g. x8 i0 \8 M5 y- s2 m
- #include <metaframework/CreateInput.hxx>
/ A1 D$ y$ x! _( ]# } - : M9 P3 A- A, M6 r# o' U: X
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)
2 e& z2 K5 E5 W7 J - {2 X& B1 C2 V: Z' M% b9 d
- printf("\n\n A2_gtac_extension_rule \n\n");/ i6 g4 g9 J9 H4 G5 v
- 8 O* j" y' b$ Z# r" n
- int ifail = ITK_ok;
8 j1 C0 G6 Q$ ?" D0 ?' l0 `4 S - # `" O' I) V0 o9 r) w' @9 I& A
- va_list largs;
+ S; q1 q5 y4 g6 N9 Z; q - va_copy( largs, args );1 h3 ^1 \, |- p5 ?/ f" ~+ r# ~ ]: a
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
& ]# O- M/ f2 ~% F1 B3 P7 s: O- v( b - va_end( largs );
7 f/ u! `, Y+ o _: u9 J# q
9 A* Y# R) G: _9 G8 e0 A- tag_t new_item = m->object_tag; . V# Y" m+ n% |
- char *uid = NULL;
3 `0 L3 `# n" J- r - ITK__convert_tag_to_uid(new_item, &uid);) Z- b+ ?2 B; a; G4 V! |" |6 _
- printf(" new_item: %s \n", uid);6 w4 @, Y% F% n2 w
- MEM_free(uid);( j+ v( |! ?: x9 Q, u3 x
- % f7 V7 W1 F1 V) O0 k
/ x; O. f q( [# }7 L- bool isNull = true;
( G- z" A" x0 n7 p - tag_t new_rev = NULLTAG;
* Z, K9 O B0 ]; o6 w% g - ifail = creInput->getTag("revision", new_rev, isNull);
9 C+ h. B3 U1 N& g& ?) } - if((isNull == FALSE)&& (ifail == ITK_ok))
. K+ n8 U# d2 o) y8 k - {
# |# c2 P( p0 F' y# U - printf(" new_rev: %u \n", new_rev);
4 L/ t+ T4 J1 G8 u: Q - }
- S1 x* d J u2 R, T - & j1 K7 @& `0 t3 V# T+ I* h7 Z) h
- tag_t master_form = NULLTAG;0 G" x. q; X, A4 k; H) i
- ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
6 ]) K4 H5 A2 ?2 F4 u. H. q% D - if((isNull == FALSE)&& (ifail == ITK_ok))
7 u, [6 s$ @9 h/ T - {
: ^. R {: t( M7 ` - printf(" master_form: %u \n", master_form);/ ~7 n) e# u$ c( M- {6 V
- }
. E7 {1 v( e0 V
% x# ?4 i7 P4 Z- std::string item_id = "";+ Q7 ^+ {, G( ~2 f
- ifail = creInput->getString("item_id", item_id, isNull);
( x* e; |& {4 F0 [ - if((isNull == FALSE)&& (ifail == ITK_ok))( H/ q9 E# X5 W5 {
- {7 B" g! |, P s [2 k
- printf(" item_id: %s \n", item_id.c_str());' [* `; A3 r ]. |* e8 l
- }
( H% v; n1 K8 S1 b# D4 ` - ' E' t) r1 r, j
- std::string name = "";
: J- N4 J8 u, O: A. w& i% C8 E { - ifail = creInput->getString("object_name", name, isNull);
+ Z- N) O; o, N8 N" i1 X7 | - if((isNull == FALSE)&& (ifail == ITK_ok))0 J3 p! W/ e0 x
- {: W v( T/ [% a
- printf(" object_name: %s \n", name.c_str());1 F d5 P, m. s# [
- }3 Q4 k4 w _$ ^$ {) I5 h7 z
- $ p0 j8 H5 Z; A4 K
- return ifail;;) C) X- A3 f3 B1 v
- } J% l) z+ m' R/ W
复制代码
2 w5 c2 R0 t0 V& g
. q6 D# J& l: g. z0 W* J1 d5 L5 M, C! a$ `" R Z
|
|