|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 h4 X9 S3 g& Y( I# v! R' X
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
t" p1 r) r& p0 c* n( i- #include <stdarg.h>
% \" p1 Q# H% S% M/ ^% R$ h# S - #include <stdio.h>$ ]$ z# p1 w4 |/ ?$ R0 ]! l3 N
- #include <stdlib.h>6 x" O; U0 S& G3 E) A
- #include <string.h>
5 C9 y( @6 F7 C7 m! j2 Z, L8 f2 | - #include <UG_va_copy.h>
9 O" m" h; \8 I- z5 {9 X0 I) i - #include <TC/emh.h>
3 q6 E- N) S! ?. H - #include <ict/ict_userservice.h>
6 A5 Q) m/ _, s0 U$ M+ n - #include <itk/bmf.h>
% e3 h( T: ~! {( n$ S - #include <tc/emh.h>
; j9 y* I8 e/ ?5 n) l* U5 d$ j, t - #include <tc/tc.h>
; |& X" R5 D& h1 b) |5 k - #include <tccore/item.h>
' [% U1 A0 o6 P0 {: A7 t; A/ w - #include <tccore/method.h>& @: F5 ~5 b7 D4 |9 W$ y) c
- #include <metaframework/CreateInput.hxx>" F; v) ?. f" T- d3 l: y
+ M4 o8 ~5 S2 M; n7 U4 U! q- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)2 a) E+ \2 e5 [6 {- ?
- {
& `' }" F, k5 M$ L: V& S - printf("\n\n A2_gtac_extension_rule \n\n");
4 _/ t" L' v2 s* S& S - 7 e; [4 l$ f5 F( T* |
- int ifail = ITK_ok;" `& B2 S9 b1 L Z' w
- 8 W; F5 I& Z/ s/ z+ S
- va_list largs;5 B( z: j& ^4 v7 V, e3 f4 y
- va_copy( largs, args );
* o8 L! |+ z. L9 w - Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
5 S: v- g1 y( X. c: J |8 z - va_end( largs );1 o0 W4 Z) R9 p& _6 w2 e% k- ]
- + F% e7 U2 J1 d% Y' o. c! }
- tag_t new_item = m->object_tag;
2 M' V/ q/ r7 G6 C2 C$ g - char *uid = NULL;
% k! L- P6 J# N, M% E/ W2 c - ITK__convert_tag_to_uid(new_item, &uid);
( N0 {1 ?( u! p% z$ n - printf(" new_item: %s \n", uid);
! C: Q; s" T) x3 e! f% B2 w, B0 p - MEM_free(uid);/ D, S( Z0 R' X1 Z
- ' Y. Z* K1 v3 l" c
- ! m! w3 J+ p! `6 b6 M& [( `
- bool isNull = true;4 q3 R; C1 o; y5 u) X
- tag_t new_rev = NULLTAG;
* o0 j% f7 T1 c - ifail = creInput->getTag("revision", new_rev, isNull);$ N2 O8 j, f9 p$ n7 k' f
- if((isNull == FALSE)&& (ifail == ITK_ok))( L! ]4 K7 \ D( t4 z$ ^! M& y
- {
2 w5 a+ E# P8 _3 _0 I3 u" q0 K7 U - printf(" new_rev: %u \n", new_rev);
: i" Z" Q/ I5 q6 \4 w - }2 C9 ?; b, @0 M2 h$ q
-
: w: \+ t) K9 e! l - tag_t master_form = NULLTAG;
% G! L1 D$ z; t. C$ o - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
. q" o9 {& L* b" O Y - if((isNull == FALSE)&& (ifail == ITK_ok))& t U6 ?$ v; f, O" l0 b1 X% V
- {
8 {( g) h) T2 g5 d - printf(" master_form: %u \n", master_form);
& q; f4 {! G8 d+ \/ u - }' o! `! S8 i7 [8 M9 U- H3 G' }
- 0 D b& Z: U' `* X }
- std::string item_id = "";6 S! e/ W, N6 M2 m- i
- ifail = creInput->getString("item_id", item_id, isNull);
5 o% o- y k8 x" e- {' W2 f v - if((isNull == FALSE)&& (ifail == ITK_ok))7 Q& Z9 D( t0 `# A( B* l6 m
- {9 G( N, R! _9 ~: g
- printf(" item_id: %s \n", item_id.c_str());3 `' h" Q8 e8 U, ]! D" ]
- }) d3 t! K. L, Y0 L) J6 C. \ e
- - s9 f& y0 J! i$ Q# T b
- std::string name = "";9 x5 a9 b& \* |6 p+ A' ~/ u
- ifail = creInput->getString("object_name", name, isNull);
7 N4 C. P; b" b' J7 B - if((isNull == FALSE)&& (ifail == ITK_ok))
5 K& {, ~4 a4 r) ] d - {& |- a$ H& f# b9 j
- printf(" object_name: %s \n", name.c_str());5 U! g5 G& w. {
- }" z8 ^( }! n- N# m6 [
4 W: t0 v; H$ _* a- S- return ifail;;$ K" g5 u4 s6 J8 w
- }
/ u+ O2 d6 R( h' c1 t; ?
复制代码
7 T+ m7 v6 l% z) h/ `. e. M+ a1 ~, V1 ]* p9 W+ `
/ W2 v- a5 k4 U2 A5 r" v2 u
|
|