|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 C% V3 h2 l8 c% q: M
Teamcenter二次开发源码分享:获取下一个Item ID的方法
]% v3 {2 ?5 ?3 E( z2 R: p/ O6 @
) w% L1 ~- I M/ A! s3 l[mw_shl_code=cpp,true]#include <iostream>
; G$ c2 t& p% n" J
/ f n/ o( r8 A: U+ P#include <property/nr.h>: t* k& R9 l; O7 K- t
#include <TC/tc.h>
; p" b, Z& I& _' L& h+ m+ Q#include <tc/tc_startup.h>
3 v; a5 D% S) K0 A#include <tccore/item.h>
& b) \( D" j( [#include <tccore/tctype.h>
7 I0 k! Y+ D/ C7 w4 `#include <base_utils/IFail.hxx>( O* K: Q5 S1 f$ P* l7 G, }% d
#include <base_utils/TcResultStatus.hxx>
# w& @" P% d' |2 r#include <mld/logging/TcMainLogger.hxx>, x% z7 i- T1 |! L) K) A' @4 O
! n4 L6 Z3 \- X4 T/ gusing namespace std;
" r. u% p3 e) kusing Teamcenter::Main::logger;
( L" ]8 D0 |4 I9 V% F9 {. i
$ ~4 f8 L3 a4 i* G5 D9 u- dint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
3 ^# W* D" ]; M- Y% T{
' R8 M# Y* [( R, F: @ int ifail = ITK_ok;" t; L2 M3 {. P3 d( d. C2 J
ResultStatus stat;
7 }$ v; x: L, F' l1 {3 b+ E try, g# P) {& A/ p
{/ H1 R* F$ \4 }" }
tag_t item_type_tag = NULLTAG;2 @0 d. L4 ?( v6 i" e) w
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
\: e. d; ]. o8 e4 Q4 K" t
3 r" c+ x* \9 ~. b+ M char *item_type_name = NULL;
3 {: U ?; H6 ^3 q/ P) w( A& f stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
- k, Q9 ?0 |' v* I5 n0 H, ?& x7 P- _& E {6 D* Q8 J0 T7 @9 o
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
, ^: c6 j4 J3 p$ \+ \ if (item_type_name) MEM_free(item_type_name);, _! U+ k& a7 p9 e2 J( V5 l0 U6 g5 j
}# Z' i" A# \1 {5 F
catch (const IFail &ex)
9 q: s2 u$ A* r# `: q* D+ H. V {
/ M1 t4 Z* v* V logger()->error(ex.ifail(), ex.getMessage());
c' J/ [ }. s, e G# Q* ^ cout << ex.getMessage() << endl;
9 R2 x/ |; N" y( N; b* `% o3 j cout << "error " << ex.ifail() << endl;" @' ?0 \ N2 ~* D2 d
}/ [: R$ P% @: ~9 D# V+ g7 \
return ITK_ok;
/ P) h4 L4 p% _1 h z4 O}[/mw_shl_code]8 U' A6 x& w" e; r- U A0 _7 V6 m
|
|