|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' ~5 H9 w. w2 P, I5 B2 K; x, h% aTeamcenter二次开发源码分享:获取下一个Item ID的方法8 \9 i$ q% m2 S- j
! f+ J% C. v( Y. n9 ]0 `[mw_shl_code=cpp,true]#include <iostream>
9 q1 b* u. X, D3 D. `2 n" I4 ^$ Y8 ^8 e; @$ S
#include <property/nr.h>' D% ]- s9 v: ?: X
#include <TC/tc.h>7 Q r( P' V7 T' _( M! X
#include <tc/tc_startup.h># V& e0 @: r% q# H! t
#include <tccore/item.h>
& v9 k& P8 P% ?* f9 H5 [, _4 a#include <tccore/tctype.h>
5 v( k# ^" L$ X3 d: }#include <base_utils/IFail.hxx> h" C6 S0 S) l! n' {
#include <base_utils/TcResultStatus.hxx>3 z8 f. m1 |. O5 H0 v% n. n, c
#include <mld/logging/TcMainLogger.hxx>
, B! ^5 j, M4 f% |9 [) L5 h3 c0 u( Z, e' q/ A; q6 _% f
using namespace std;5 i$ ^/ U# h6 ^! M4 W4 o8 W' X2 S
using Teamcenter::Main::logger;
6 Y6 u0 d+ v( s; M, G6 R B7 @$ Z% J. d8 A% ^% [
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)& D( \) G1 E, d6 Q' t) E( z7 i
{8 E7 U$ g* r2 [' }0 y% s* Y
int ifail = ITK_ok;8 ]" E1 z7 g! t4 }- k: p/ H
ResultStatus stat;& I$ ^& E* u* e: k* U d1 b$ Z
try6 Z. h! D3 d; _+ O
{
& o G$ T! _/ j/ p6 y tag_t item_type_tag = NULLTAG;
/ {; i; n9 r3 b- p0 m stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
6 d8 o' ^1 r: ^) y7 \2 h" y4 _- v5 E" ?3 }
char *item_type_name = NULL;* Y; b$ @) ~* i/ H
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name); H$ o8 d6 y9 I4 Z5 W. U1 q
6 J% G: d! B; G2 M s$ B stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);5 E' _% `/ t F' g
if (item_type_name) MEM_free(item_type_name);
- A# U7 a* E* ]8 c% F. ] }
9 O* ~" V% A! b1 S% ~( a catch (const IFail &ex)/ g3 L i, F q
{- R) a! e0 I. W& o. V$ E- A$ X# i
logger()->error(ex.ifail(), ex.getMessage());2 r. r$ z9 k$ Z# Z
cout << ex.getMessage() << endl;
2 z; S2 c3 _' c1 s cout << "error " << ex.ifail() << endl;
4 v: I% ]3 I4 K5 S& o. H- m9 E }" d( |7 P2 h( a7 [; F4 q* k
return ITK_ok;# Y/ n+ {- V2 i( F5 P4 Z: y
}[/mw_shl_code] w3 \- w8 O; ^/ g, w' L- F" T
|
|