|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- @1 W* y% o e6 ]$ l* iTeamcenter二次开发源码分享:获取下一个Item ID的方法 D3 q: _. ]& L
) ^4 x, h: f; j, _
[mw_shl_code=cpp,true]#include <iostream>! F0 x9 m' U: I
7 ~" w0 S4 }+ x \#include <property/nr.h>
$ B4 @; z$ K2 [5 J8 A#include <TC/tc.h>; D" o. V9 W8 D# U
#include <tc/tc_startup.h>
# \5 ]6 m# g/ t' R! ]#include <tccore/item.h>. v/ |# C. C8 O
#include <tccore/tctype.h>6 O& u) d/ a2 j* P9 [" s( v: g
#include <base_utils/IFail.hxx>2 G7 F5 b( F: `7 \/ V0 M" q0 e
#include <base_utils/TcResultStatus.hxx>
" y: A+ q) w9 ~0 ?3 m o#include <mld/logging/TcMainLogger.hxx>* f# h; C9 v6 c7 g& j- p* S
( h. X; e( S: { \- q
using namespace std;
8 g' N- K$ j2 `9 R+ w1 Q) d7 Uusing Teamcenter::Main::logger;/ M( q! D: w$ c) {* z1 K5 U
- @% L a X' fint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)5 a# f- F* F" i& T
{
) Y/ T$ G$ ~* {* ]6 { int ifail = ITK_ok;
" E1 h0 Y$ r3 z. A ResultStatus stat;7 x: W. a; j" s; I) ~
try
8 r: S! k& W, Z5 A" k: g4 y: @: M {# s) A2 |, b3 i" n# T1 G+ X; ^
tag_t item_type_tag = NULLTAG;
; K* l9 K5 G/ o& N/ V1 { stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
/ \& A. ]# q3 @. ?. t
, G& [$ H0 Q/ h' e; U1 r1 a char *item_type_name = NULL;
) s2 c/ Y+ t9 i. {$ r% [) T7 }" L stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);5 M8 ~ X4 z5 G7 Q6 z9 J* u% {) v$ R
1 f" d! O8 c: R7 ^" u: H( a, P ` stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);( h% `6 u2 l* c" m
if (item_type_name) MEM_free(item_type_name);, c% x' T7 r" h0 G( g j+ @# q/ X
}0 j5 n9 Z- w! f6 |$ c& J
catch (const IFail &ex); W0 \8 a2 Y6 N
{
d$ n8 |2 r$ d+ l! ?1 ~/ V6 Z logger()->error(ex.ifail(), ex.getMessage());/ |( W4 W" h8 h* J% w% T
cout << ex.getMessage() << endl;
# D8 p0 g5 J0 U* A. S' g9 \ cout << "error " << ex.ifail() << endl;
! o3 Y& l# F* U2 a }! M! }. C0 I4 A; {6 ^
return ITK_ok;
. g# o8 m d7 O$ ~0 k}[/mw_shl_code]
/ |* ]% R, e O' L. N7 g |
|