|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 D0 K+ O9 l" _" P+ o
Teamcenter二次开发源码分享:获取下一个Item ID的方法& A: s f2 ?5 s9 ?: ~) ]( D+ `
5 [2 i4 O( l# _7 H# [6 U! y- Y
[mw_shl_code=cpp,true]#include <iostream>4 t, d' g7 d, G* C
; G7 q1 V; B0 y% L, D; P$ \: p
#include <property/nr.h>1 j4 o* n# H" {6 B; I/ L
#include <TC/tc.h>3 s; w* K' M* X# }* J
#include <tc/tc_startup.h>
5 L+ G$ d: z' g, ]- f#include <tccore/item.h>) S/ m2 B V0 c( q
#include <tccore/tctype.h>0 E8 E3 M5 j; E, u4 I
#include <base_utils/IFail.hxx>( U/ S! d% C% p' j( C c
#include <base_utils/TcResultStatus.hxx>
" Q/ S3 Y9 K' O( @3 G7 V8 I#include <mld/logging/TcMainLogger.hxx>
1 i% I" P i- S, w5 ~ \
% Z" k& z2 W+ [7 ?& z4 Y; [7 {- Gusing namespace std;
: y" I7 ~6 `# J) w) }& w" Pusing Teamcenter::Main::logger;
% O7 `! W4 `1 N9 L% k9 p: u
( ]. n- ^8 n9 E, ^0 Y+ d, fint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
- u, B- }& P6 t$ n; X/ n{
2 I+ [6 M! {$ F4 o# A int ifail = ITK_ok;: f/ S Q; D& B# L
ResultStatus stat;
4 s6 l7 R8 ~) m try7 j# Y) M" ^! q
{
2 m6 ^ { e6 Z! k tag_t item_type_tag = NULLTAG;, r9 |. a( M; d
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
" i. _3 z/ p3 T' n' T8 u' f. K# ^' X
char *item_type_name = NULL;. I* ~4 K; W _) D3 q0 M
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
) H+ l$ {* d. d6 S: `
. `+ y: e5 @# V3 L: }% u stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);, y, A6 `+ z1 ?, J
if (item_type_name) MEM_free(item_type_name);: r' c$ }8 _, W
}4 L8 p+ w6 n1 p. y
catch (const IFail &ex)
- @, e- O3 g4 z+ c- O6 D {
* a/ a) o0 l7 r9 _* A* u+ D& O J logger()->error(ex.ifail(), ex.getMessage());. P) Y. o8 K# G8 T& t
cout << ex.getMessage() << endl;! C3 q+ _6 _1 }6 K1 m" M: G
cout << "error " << ex.ifail() << endl;9 G2 A+ M) N7 n5 T# r# N
}
& K& R* M. q: G6 S' l- f return ITK_ok;
& X' }( b; t, P* w, ~- a# |. A}[/mw_shl_code]/ \( K/ }( E3 M3 D. K+ Z. k
|
|