|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 U' s" p$ w! X4 n: x. g* D+ D
Teamcenter二次开发源码分享:获取下一个Item ID的方法
- s q( x' V: I6 k0 {) D4 B8 K$ q" d: O% X1 A1 V. o
[mw_shl_code=cpp,true]#include <iostream>
& _5 m; s7 o5 O6 r) a# [8 H' `& s1 \& e
#include <property/nr.h>
4 F4 R3 {" R9 e, H$ L#include <TC/tc.h>
( e( n Z5 Z1 p; n9 f. M% r#include <tc/tc_startup.h> S' T. L6 B/ o. U6 c/ t& \8 x
#include <tccore/item.h>
6 G `! F2 N# |3 N' u- z# n8 P& g3 n#include <tccore/tctype.h>3 a9 b8 Y2 X5 h3 \+ S! s) C Y
#include <base_utils/IFail.hxx>
+ D- S* s+ l0 [+ ~8 B" ]#include <base_utils/TcResultStatus.hxx>
) Z( S( W# @" o#include <mld/logging/TcMainLogger.hxx>7 z0 u, b- T/ b/ i9 b, `0 `
E6 Y, U" p8 t5 t: x# u! I' l- p
using namespace std;
6 W. u, g3 f, m S( A3 Z2 Kusing Teamcenter::Main::logger;2 e3 h% F- ]9 \5 Q8 q
3 p6 h% L: u2 n6 K1 a) S0 f8 Eint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
: l p }7 Q1 t# R# W{
3 B) a5 C* l1 V1 `( W9 q. N int ifail = ITK_ok;
% W8 H, l& P& o4 r. x ResultStatus stat;5 N' P; O. O+ t
try
! L6 W, o1 t" ?3 g% U' ] {
/ v$ F$ f" } {% w tag_t item_type_tag = NULLTAG;
7 X [2 o0 k2 G! M1 [: G" I stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
) |5 x7 g4 O& K9 y9 p1 o. ^; y4 Q6 g. [6 Y2 V8 w9 j
char *item_type_name = NULL;' F% ~$ m2 J, p% _9 F
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
% C! z% A' l a3 x6 _# N5 V6 u. R2 }. s( y7 {8 ?
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);/ I8 ~4 X* m" @8 N; a& S
if (item_type_name) MEM_free(item_type_name);& N( M! @$ f: w+ M8 L" D6 ^
}( o" Q. I2 E4 n0 y
catch (const IFail &ex)3 Z& h3 z- w0 [4 \7 M8 d
{2 ~+ b' {; N E% B! f! `% n
logger()->error(ex.ifail(), ex.getMessage());5 u/ e$ R: {. J% ~& T4 y, H5 `
cout << ex.getMessage() << endl;, D b1 ]7 n4 l8 \' @2 i6 `
cout << "error " << ex.ifail() << endl;
: y5 G( o% d9 k5 K9 t' m8 G! y' G }% j8 i* p& {4 ^ m
return ITK_ok;
6 T# b: W2 M4 k. U' O}[/mw_shl_code]
1 k$ r: T A8 V p5 [/ T6 l |
|