|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 V& b' }2 ?8 k* zTeamcenter二次开发源码分享:获取下一个Item ID的方法
/ a! B$ H$ s6 L( L# w ^, f* f9 D5 ?; K' s0 C5 p, N- Z# I
[mw_shl_code=cpp,true]#include <iostream>
" C. T1 R% N6 b/ v9 t
% P4 _+ s+ h @$ W2 ?. y#include <property/nr.h>/ {3 Y T& {# X I9 E
#include <TC/tc.h>
! a' n5 m0 I* c0 l5 J8 b8 {#include <tc/tc_startup.h>3 l1 f4 g* W- U' j* { I6 t0 B$ R
#include <tccore/item.h>
% s( G8 b3 ^+ w# Z B#include <tccore/tctype.h>
' B8 b+ t0 s4 N) m" F5 {4 r#include <base_utils/IFail.hxx>
0 m# S1 Q3 G9 r# D" w#include <base_utils/TcResultStatus.hxx>
" o- c4 e0 p2 d( Y( L6 G2 ~#include <mld/logging/TcMainLogger.hxx>
& a& X, V+ e' G
* P6 D7 I2 B+ f7 P/ R( b- a. tusing namespace std;/ D1 `5 W8 N( i
using Teamcenter::Main::logger;$ @5 Z/ a* T2 _
8 x9 q; ]4 F1 P1 u% w" y; vint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
4 [7 b% P4 N5 Q. P{
6 t. C9 O7 x0 x | int ifail = ITK_ok;
/ F$ P- } |- y# w! Y5 H ResultStatus stat;8 H/ s; m& T! m
try8 x2 N; e3 Y- ^* g0 G
{
# o/ |3 @0 j% M" g tag_t item_type_tag = NULLTAG;' ]" v2 U' h# m! I
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
b2 I: z2 P& K- A; X6 `! m% ]+ Q( e2 q. S! ]& x& r: B
char *item_type_name = NULL;8 E6 |) G. P) f3 r
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
; K2 o& Q- p; e6 b, V5 o. \3 D8 D
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);! i4 ]2 B) _) ]; I, {
if (item_type_name) MEM_free(item_type_name);! [; o) M0 V% ` n: \, v
}
( k1 ~: |* R( k5 b catch (const IFail &ex)3 o- h8 l8 M7 h4 c) G0 h
{
/ A7 `& H+ T4 Q6 E- }" n logger()->error(ex.ifail(), ex.getMessage());
8 h4 E( [' y! r/ U# R0 n cout << ex.getMessage() << endl;2 I" Q0 i7 s% @, C/ S& P) B
cout << "error " << ex.ifail() << endl;5 t% V- i( ~3 T% M
}
$ V6 s* U- P/ a return ITK_ok;
( F, G6 y+ ^4 c; a$ {7 Y}[/mw_shl_code]
) m, j4 q# f" f, k' O0 a |
|