|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 n) f, R1 \. w& g) WTeamcenter ITK二次开发源码分享: Item 创建 createpost操作8 I; b$ c. V7 h$ h5 P0 V3 f
- #include <stdarg.h>
4 g& t+ M2 P( T: V. n4 a5 E2 K - #include <stdio.h>3 K Z; q" ~! B: G7 W
- #include <stdlib.h>) \9 g, W1 e- V! v+ ]: N9 Y
- #include <string.h>+ ]+ I5 f1 ~8 M5 U# h* n4 s
- #include <UG_va_copy.h># [/ `( N6 [/ H
- #include <TC/emh.h>
! L' z- F. ], v7 b; o - #include <ict/ict_userservice.h>( G. l* W# z; ~! B# ~' @( i5 m
- #include <itk/bmf.h>
5 T/ m/ A7 m+ Y! O, ~+ e9 M' m - #include <tc/emh.h> g2 m8 D4 w8 `* Y8 h7 f" }. ]+ |
- #include <tc/tc.h> ~# Z" j$ b) z1 C, ?) A
- #include <tccore/item.h>9 M) m! r; E s" G3 \+ T5 H: t+ _
- #include <tccore/method.h>2 R1 x+ ~$ O- E; _( i
- #include <metaframework/CreateInput.hxx>
& S$ ]0 B& f5 V$ J1 V4 D q- D% i - ' `. K0 N0 r( V- [! X8 R5 y: n
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)+ C1 D1 x/ f7 @, @+ n
- {
# |, E+ f2 F7 Y$ b3 F A - printf("\n\n A2_gtac_extension_rule \n\n");; c0 V( r" o. k- M2 b7 ^1 b& N) ]$ D
: u) y1 N* O) D" g) [2 a- int ifail = ITK_ok;1 W! k! h5 w) s1 V
' S: x4 k! g* i' t: `- va_list largs;
N% r" ~$ k- ^- j$ `1 t - va_copy( largs, args );3 t5 v$ R1 w' e( W5 Z7 N/ H
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
) Z* U. ?5 [- I+ m, J) y - va_end( largs );
6 c* E$ D. u3 L% |6 X' j
1 l) b: k/ Z5 j- S- tag_t new_item = m->object_tag;
R) |5 H I: T2 Z @ - char *uid = NULL;/ [4 |# m/ _6 o+ i. G3 R8 d
- ITK__convert_tag_to_uid(new_item, &uid);' J& d P( {4 }6 z1 c7 M5 ^
- printf(" new_item: %s \n", uid);
6 K" J% X- G) ~) l5 a. {6 T: d; w - MEM_free(uid);
2 L1 y+ e' y' h2 A
- T4 j0 H. v0 `8 S6 R% b/ @# E4 b4 {/ b- H# x6 `. U/ {
- bool isNull = true;
6 S e# G0 J m7 L: L - tag_t new_rev = NULLTAG;: k* c" U# Z5 L
- ifail = creInput->getTag("revision", new_rev, isNull);
. [, g: U4 h( K- W( H Q - if((isNull == FALSE)&& (ifail == ITK_ok))
- t+ K4 t2 |9 w& e2 {9 E; a - {
6 z) a; @6 ? c% X E9 { H3 F - printf(" new_rev: %u \n", new_rev);% v9 [7 |$ t5 v- R- G
- }
. t: ^" z/ p4 B6 n - $ O. p+ q* ?$ ]' A( r( x( {
- tag_t master_form = NULLTAG;
8 U: t5 q! O% X, ~ - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);2 H! U/ d% w7 u8 ?& V# l# ^6 J
- if((isNull == FALSE)&& (ifail == ITK_ok))
5 B4 A6 v5 o# o - {5 _! l" M5 U \ a5 P' r
- printf(" master_form: %u \n", master_form);
7 b. k5 }& d! K! w' t - }
0 j" k& v+ Z0 g% q1 v: c8 X, N6 r( {- G - 3 t5 W$ L3 |: L
- std::string item_id = "";1 C' H5 f9 `0 m" K
- ifail = creInput->getString("item_id", item_id, isNull);
# W$ [. m# p# J* a6 [* Q; D+ L( @$ k - if((isNull == FALSE)&& (ifail == ITK_ok))# M, G6 a: w4 }% H- l. w
- {3 \) _8 A5 \* o8 J
- printf(" item_id: %s \n", item_id.c_str());
3 ]& A$ `" F4 a% c4 c8 n: J4 a1 S - }
# q/ }* |/ G F3 u% l+ j+ O
! T$ |0 d% h" c) ?0 x- std::string name = "";/ ?7 N l% k* A9 Z7 [+ L2 _
- ifail = creInput->getString("object_name", name, isNull);9 X' f4 n. G, n2 P# ^ ~
- if((isNull == FALSE)&& (ifail == ITK_ok))
2 S C Z8 w, E7 `, B1 m4 r - {
3 s+ w+ [7 `; w: K. e - printf(" object_name: %s \n", name.c_str());
' f3 |* j1 _9 h. n( H: Z - }
, g1 I5 L3 p8 D8 M
: H9 D+ @; O: M- return ifail;;, z9 m. a4 K- _1 M
- }
* w& C4 d9 S. ]
复制代码
" Y4 t: C/ n a% f7 ?3 y! b$ f& ?( c( A4 ]7 ?% v1 P( a- T! h! Z) |; K
7 [4 Y; _- P3 v( E- ~7 G* a
|
|