|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) |6 x( w5 b0 @1 m
Teamcenter二次开发源码分享:获取下一个Item ID的方法; w* V5 C! t8 e/ `) Y* u
* }9 L) E" o! {
[mw_shl_code=cpp,true]#include <iostream>: J n% \! k: O z% _, Z
$ ?, ~+ @) J# O& a#include <property/nr.h>
5 Y2 [ x6 G: J2 y: j9 _" P' m# b" c#include <TC/tc.h>
% X. f9 w( A/ i8 s/ ]2 B; r" `7 N#include <tc/tc_startup.h>
: S. Z; H7 b( m& q. B& t2 ^3 ]#include <tccore/item.h>
: T( l0 s) y3 c; A#include <tccore/tctype.h>
' e8 B% ~0 g4 z; g#include <base_utils/IFail.hxx>8 O T1 j3 |9 P5 {
#include <base_utils/TcResultStatus.hxx>: O% P _" w* \
#include <mld/logging/TcMainLogger.hxx>4 e1 v4 K* C/ |
2 b/ {5 Z5 y) L1 M2 Susing namespace std;
5 u; P7 v, c6 T8 K8 rusing Teamcenter::Main::logger;- d) {0 M! A) x, S/ n# {5 R
$ k9 ?+ j3 r& |0 q1 o, O. q
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)/ \& O( Y) p2 t- ?. j
{) l$ q' k1 O/ j9 v7 q
int ifail = ITK_ok;
9 L" ]' X* D' |9 M& d* w* b& u- v8 a+ e ResultStatus stat;
, T( n" @8 K m1 Q( a4 ^: N! I try
( g6 h. {& N8 m% ], I# G1 t2 A# O {
8 f: Z: m' c( E" }: C tag_t item_type_tag = NULLTAG;
# i5 t9 H" I4 Y L5 n3 A/ z stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
5 d0 h6 l% F. ~; r( v7 F3 C+ f+ @
char *item_type_name = NULL;
" d7 B4 `3 v% S stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);6 E' M7 Q7 ~; [( q) S
L/ P# _ v% S. ^+ j3 J- r! n( r
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);' {7 R# G# M, L5 \* V. w" r- U! Y. q# g) F
if (item_type_name) MEM_free(item_type_name);
! m8 N) b# K" N- k( M2 R }
/ ?% c: U' L, r& L) _ catch (const IFail &ex)
$ C) w: u& D* l" F {+ \7 @/ o) i2 ^' G" _
logger()->error(ex.ifail(), ex.getMessage());
- H, V8 x( |! I. u, h( o6 r cout << ex.getMessage() << endl;
' h% r- Q# F+ ?% q cout << "error " << ex.ifail() << endl;
/ F, [/ X) a: Z8 m }
8 }7 E+ b4 n8 E: J& F% ?1 }& k return ITK_ok;6 }% ?1 z- {4 y/ V7 m" x- d
}[/mw_shl_code]5 `1 r6 {# T# B& A+ f! j
|
|