|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ q _ Y: z6 d; ^# GTeamcenter二次开发源码分享:获取下一个Item ID的方法) c. A Z# Q' p G
8 j' c& `1 i3 D0 U9 i$ o
[mw_shl_code=cpp,true]#include <iostream>( C. h/ s- k1 O: G8 h
I+ P4 h! L5 {- M: c5 A% v
#include <property/nr.h>
( r D2 Z+ S- C/ X0 [#include <TC/tc.h>
6 G1 J3 g3 } F2 |( {#include <tc/tc_startup.h>
- h" q% n4 R9 a1 h( J1 @; m#include <tccore/item.h>
" U$ i0 m: }2 z) S1 p#include <tccore/tctype.h># X2 L6 Z7 u; u1 g; r
#include <base_utils/IFail.hxx>7 @$ Q7 t7 l4 ^8 }* c" q+ O$ x
#include <base_utils/TcResultStatus.hxx>
3 Z4 v; F% k/ }# F; N$ l#include <mld/logging/TcMainLogger.hxx>
1 p5 N# C; N7 U
. Z Z' d! {& o0 ^" {- e( {using namespace std;
. W8 ]( V- L3 [# |% xusing Teamcenter::Main::logger;
: S [4 N* _. i/ y" Z9 z- Z5 j, z1 _6 Q3 m; x7 R
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)4 ~. N, x) c( P7 D8 P) F$ _
{
) y- H* W2 ` m% m int ifail = ITK_ok;( I: r& b; B0 M1 _0 i
ResultStatus stat;
5 k, I4 J& `. C, t try
- |" P$ y! ?! u1 y$ `' U* G3 M, V. ^ {
2 L4 [9 R, r2 w: h& {- i5 M$ \ tag_t item_type_tag = NULLTAG;" d# {! ]: i# K/ n
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
0 u8 c; \' ^! a. C# d) U1 n( a0 S: H; s1 R* J* [0 o- z$ `
char *item_type_name = NULL;3 e( E1 w4 W w# R( [9 f9 ]
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);+ \; k+ A8 F# \* l7 B4 a
! ^% @8 f* u2 s, b7 f
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
. h# R' K7 ?1 W4 Y7 T2 I if (item_type_name) MEM_free(item_type_name);' g. f" k$ \: i: B* R+ K: ]9 v/ a9 W
}
2 o$ M4 r; \2 C% F5 \4 e catch (const IFail &ex)8 f/ A* t1 g3 P: z
{3 Z4 C3 a/ ?6 Y
logger()->error(ex.ifail(), ex.getMessage());
$ L. _6 ^1 \, s" F- y$ ^7 G cout << ex.getMessage() << endl;5 s3 @8 R* V( X% i1 M+ P4 a: d
cout << "error " << ex.ifail() << endl;: d2 k- z/ m E
}- [6 k0 S) \8 k. _
return ITK_ok;
0 z( e4 T* Q6 `/ C8 x. i}[/mw_shl_code]
! e( w- u# r$ w8 x |
|