|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 C" f. s2 R0 G
Teamcenter ITK二次开发源码分享: Item 创建 createpost操作
/ ?; Q3 g1 [0 ^; g- #include <stdarg.h>/ ?4 {& \. C4 a1 N% _1 W
- #include <stdio.h>/ ]. _' y" G' B' n+ L3 i/ D$ \' X
- #include <stdlib.h>/ L0 {* y' w7 O, t
- #include <string.h>
2 M$ a- x/ F4 |/ h, B: m - #include <UG_va_copy.h>2 {. Q5 S- Y" |, V
- #include <TC/emh.h>6 \8 a4 ~ v2 H1 u+ j% c. N
- #include <ict/ict_userservice.h>6 ~5 V a4 Y* P
- #include <itk/bmf.h>; ]! W' p' X% K9 `. R
- #include <tc/emh.h>
, M( R, Y- q, ?* t) B& P - #include <tc/tc.h>
0 H4 C" d6 J6 ]" U" \+ P/ ~ - #include <tccore/item.h>% u+ C5 ^/ E/ X
- #include <tccore/method.h> v9 D; i1 c: X5 C6 C7 a1 V9 v
- #include <metaframework/CreateInput.hxx>7 N c8 l, [; t/ V
- ) |9 ] y B$ {" ]& g6 \
- extern "C" DLLAPI int A2_gtac_extension_rule(METHOD_message_t *m, va_list args)6 {9 u% e) u$ a
- {4 l5 I3 u9 i& Z4 E/ s/ k
- printf("\n\n A2_gtac_extension_rule \n\n");
& g) J) K7 J' | x - 0 u L6 }3 ~3 D4 v& @ k
- int ifail = ITK_ok;
% E0 X% E3 C _3 T% A# G - ) b6 ^: G: i% g9 z- }2 @
- va_list largs;
& D |$ {' y- D- I/ e/ z7 W1 J4 c9 v - va_copy( largs, args );; K5 O& m% j! Q6 J: M; @% P
- Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);% U& q( z* O9 r$ g& r3 S
- va_end( largs );$ \; Z& |6 N* y2 A% |
$ \, O3 v* E% _ q- tag_t new_item = m->object_tag; ( y5 c `. `' `9 t+ t: J
- char *uid = NULL;. d* r* p2 ~) |' Z/ c2 F- ~& S' O2 h
- ITK__convert_tag_to_uid(new_item, &uid);
# b/ S; e6 f% E' u - printf(" new_item: %s \n", uid);3 o1 W8 v8 [, Y5 M, K
- MEM_free(uid);7 R; Q( k) S2 N$ d5 f4 ?# _
- 9 I0 v" u3 q! Z
) m) D$ I% w8 z Z- bool isNull = true;0 f# }( j% d+ \6 {7 m
- tag_t new_rev = NULLTAG;
# Y) {7 T* d: j/ q1 k& l- q - ifail = creInput->getTag("revision", new_rev, isNull);' d; i# [. j$ Q, ^. s
- if((isNull == FALSE)&& (ifail == ITK_ok))/ A1 a: l4 E1 I! R$ D9 g
- {' ~; O) b0 E1 f: P) w% U6 ^
- printf(" new_rev: %u \n", new_rev);
6 D2 a I4 g2 e9 I - }
3 u5 \/ R' g' l' ~- X: K b - p/ H! ~6 \. q$ t0 u z$ Q
- tag_t master_form = NULLTAG;
6 z) s4 k# J! J% O/ n1 _: w - ifail = creInput->getTag("IMAN_master_form", master_form, isNull);+ C J/ l' ?% H: o4 n2 @ p/ w
- if((isNull == FALSE)&& (ifail == ITK_ok)). o5 M/ O4 Z! N. ]- j1 y; R1 }( J
- {6 d! p& I: _# E/ N, S
- printf(" master_form: %u \n", master_form);
! O* W/ x* A0 O' f' I) R" b - }4 k( d4 R4 x7 v2 v w0 u
- 9 ]6 U0 C! Y3 b: j4 I6 E
- std::string item_id = "";
5 s. Y) I0 J e" n0 e& } - ifail = creInput->getString("item_id", item_id, isNull);
2 t" h' r& ^5 v - if((isNull == FALSE)&& (ifail == ITK_ok))
$ H" A3 M1 a) o7 [4 M - {
6 d1 k; g3 G; Q1 |/ g# x - printf(" item_id: %s \n", item_id.c_str());
+ _: C" c% ~8 O) s X! G) G - }1 l( t: s5 t$ Y+ ]' I
$ o, Z- j9 n# ]+ s1 T+ M- std::string name = "";5 H% Q7 P, D) u' ^8 r# ]( t+ k
- ifail = creInput->getString("object_name", name, isNull);" v% _( a3 M/ P6 J9 E5 G; }
- if((isNull == FALSE)&& (ifail == ITK_ok))* a* _% @. w: E( n8 n+ f+ f% K
- {
3 C* b8 z3 r9 D& C7 A. B& y - printf(" object_name: %s \n", name.c_str());, |8 q7 \ D( c% V
- }
" S' @$ v+ k1 d% D6 f% B3 a
4 D! x7 A+ b/ l7 w- return ifail;;. a9 ` B/ N3 b. p# j
- }$ f8 A. X" c) i6 s* J! |5 p
复制代码
" A! t' d3 j. Q: u" `
6 ^, \ s% H3 U% Q/ }& N4 X/ N8 s: F/ Y e$ W
|
|