|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 l7 A- U! [7 P' B" JTeamcenter二次开发源码分享:获取下一个Item ID的方法- A: ? \- u2 F% Q: X+ w: ]8 U" B
' }4 r+ z/ t- c) j[mw_shl_code=cpp,true]#include <iostream>
& M0 E5 [) y/ w# l1 V- D
- b4 D; g8 Y+ m \+ U2 R4 J) D! K#include <property/nr.h>
" m6 }( j7 i; k/ m' Y#include <TC/tc.h>
, a# U: s% Y2 G8 w) R; R( O* h+ O4 \6 r#include <tc/tc_startup.h>
1 i# A, e F0 H: b#include <tccore/item.h>2 Z, X9 j) L5 w' b
#include <tccore/tctype.h>
+ l0 u5 Q. f% r1 B: O7 L' O* n& |+ D$ v#include <base_utils/IFail.hxx>
' w. o. D5 ]8 P3 @8 v#include <base_utils/TcResultStatus.hxx>
! a7 a5 O& p: o#include <mld/logging/TcMainLogger.hxx>: g0 B$ |/ e+ |' B* F
* z" k# X7 j# b' E x |& H3 o
using namespace std;
/ z; k. y. |5 n3 pusing Teamcenter::Main::logger;7 Y9 u {* k7 Q5 @
2 B. a1 Z3 H" `, S9 u" \
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
" Y% \0 V; A" X2 C{( Y1 J6 `) V% ?! O
int ifail = ITK_ok;
] Y& {7 H* O, O* i- @ ResultStatus stat;; L/ R' L5 v! O) s; v! y6 c
try% R6 `0 I. o& r% f& \
{
% s$ C1 j# ]2 ?- Z+ a+ b& J% L' e1 ^ tag_t item_type_tag = NULLTAG;$ [2 `( ?# Q$ r) ~, H- g! F4 H/ G
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);* ]0 Y! |0 T+ ^( h( q9 G( Q5 G8 c
+ l' N1 j" r( U: x$ J' e
char *item_type_name = NULL;
6 [" \$ s, ?0 g stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
7 h, T# ?' M% \; j- I: u8 Y3 p& A- G3 @) W6 u
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
5 F5 `3 r# I u if (item_type_name) MEM_free(item_type_name);
, G" K- i( C$ ~" T$ U# z0 g; @ }
/ U" a X/ X) b4 U1 F0 G' _ catch (const IFail &ex)
: g3 e( \; e" A$ [ {, R3 d2 e, W6 t, Z/ L
logger()->error(ex.ifail(), ex.getMessage());
2 U6 q# {8 G2 Y- H cout << ex.getMessage() << endl;
8 `# N) K6 A9 N! P5 N1 ^8 g cout << "error " << ex.ifail() << endl;
) z n3 R- v$ U+ M }0 ?5 U) b9 w8 k8 n; Y" _
return ITK_ok;# C$ o& J4 a. a% H
}[/mw_shl_code]8 {' y+ ]! G& o+ T* t
|
|