|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# P/ T0 K/ u( e1 |' u5 W; l; FTeamcenter二次开发源码分享:获取下一个Item ID的方法
9 g5 E4 F) I2 t5 G7 U4 c4 x8 @: v7 v: l2 P& v
[mw_shl_code=cpp,true]#include <iostream>+ `8 ~# G! O9 I3 \5 O
6 t1 k, w: \. g$ k8 A#include <property/nr.h>
, a# y. s2 {2 ]& _0 x9 M5 e! f#include <TC/tc.h>
/ u, `( `1 g/ Y# ~4 B#include <tc/tc_startup.h>
8 S+ E6 Y& ]6 V/ q: v; X9 X#include <tccore/item.h>
- M* M: H6 t- P/ s7 F5 z. u9 `. ~#include <tccore/tctype.h>
5 u I' b* h8 p! V6 ]#include <base_utils/IFail.hxx>" W$ D- |$ P* n1 B( j; j
#include <base_utils/TcResultStatus.hxx>
" ]2 ^0 Q2 ?/ S/ ]* {#include <mld/logging/TcMainLogger.hxx>
0 ?3 t: K! _5 B8 ^/ c7 I. w" [+ b- Z; Q8 W7 `2 O2 @7 K
using namespace std;
. I) c# E9 n% wusing Teamcenter::Main::logger;7 P+ ?( a2 G2 ]% P% `% S
3 W5 z0 ?& w, d
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)/ F- i3 ~" Q, B5 I' ?. P
{1 R; g! e% D; n9 M
int ifail = ITK_ok;4 J$ Y8 C9 o8 L# l' o" ]/ O
ResultStatus stat;& U; w- n3 I; V$ t2 l) w# D
try6 S1 {. F: O# U9 `( z. _
{
1 S) \8 Y( X+ a* A6 z3 d: d tag_t item_type_tag = NULLTAG;
, D/ q L0 j3 T& ^+ m1 Z( p! d stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
9 |) Y' q% W% Y2 ^% T, [9 A2 p. M$ Y h4 K& h" K% M
char *item_type_name = NULL;
: x0 C/ r L) z# v5 G0 n stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);2 e, W, I+ C6 D( c. O9 I3 c/ P! p
3 ` o( G0 R5 v0 N# }
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
5 \$ `7 p! K M6 d if (item_type_name) MEM_free(item_type_name);
1 E5 }7 D3 v% Z+ p% l3 {! r }0 U( [3 V- Y- x0 {0 B1 {
catch (const IFail &ex)- D. ]& F& b4 e7 o- A# F
{% Y& d0 \) F1 b4 f- R7 Y/ _4 }5 D
logger()->error(ex.ifail(), ex.getMessage());3 f6 j+ i( q7 z7 A# G: X. }
cout << ex.getMessage() << endl;
F! ^5 W2 {3 Y' g cout << "error " << ex.ifail() << endl;3 M9 T ?7 g" X! ]0 ~
}+ m9 Z0 B6 c- {/ f E1 d1 B
return ITK_ok;
S" [0 I, X" R' [, G}[/mw_shl_code]
2 f5 @5 C& C1 J% s9 ~ |
|