|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, F0 y; ~% h2 r( F3 p
Teamcenter二次开发源码分享:获取下一个Item ID的方法1 H# H+ i/ p0 E' C- f; g5 |
: U, n$ R/ B: z& T0 Z. F0 X6 `[mw_shl_code=cpp,true]#include <iostream>. D8 W2 ~" {, {. e7 ?* u* ^ i& A
: i; I. h$ b/ k# A& `
#include <property/nr.h>
; I$ M; K4 V/ s$ o, j( A#include <TC/tc.h>
/ W1 Q+ z& I8 d" o* x" e1 M#include <tc/tc_startup.h>! _2 t. C! |2 N
#include <tccore/item.h>
7 J* w! A5 w. Q0 F9 V! D- v- @#include <tccore/tctype.h>+ ~( H, A6 W4 g
#include <base_utils/IFail.hxx>
* V0 \: Y C7 m9 s8 B; p* h#include <base_utils/TcResultStatus.hxx>0 F" s5 s$ p% P9 G- y# G* d$ ]/ `
#include <mld/logging/TcMainLogger.hxx>1 z" R5 P* _1 E3 n5 y
$ ]# ^# r1 M) s. }2 O4 |2 M
using namespace std;
# p! M- J; a# o6 i+ I% e+ Lusing Teamcenter::Main::logger;4 x) ]. E! z& [
$ ]( s( p8 d+ U% H9 i7 U
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)$ T0 R( C: M6 m% @$ \( O
{
& w% O$ K2 b" [4 i/ n int ifail = ITK_ok;
) W) T. {8 q% B- ~5 g ResultStatus stat;
* T ]1 S) ?2 P. l* D try4 [1 o) Q4 A9 g7 Q9 M J
{
* O) N9 K0 p6 D5 C! O; [# ]) P tag_t item_type_tag = NULLTAG;8 e$ E. p; b5 L, o. s. c5 k
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);/ W+ I* b% \# j) A L- _
3 `+ d- J& v5 v
char *item_type_name = NULL;
, U u" l$ x: p) A. O stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);& t% e1 V8 }6 a8 W! \
" y. l' p# s/ e! z8 D stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
, F) v( g3 U8 C. l. f if (item_type_name) MEM_free(item_type_name);
6 {0 B6 `& ]5 v. @ }6 O7 r+ v3 K0 C2 D2 p
catch (const IFail &ex)
% K! Y1 ~1 g% v4 b6 ~9 o {
* t& q7 p5 G& K$ m logger()->error(ex.ifail(), ex.getMessage());
. G+ q% [/ x' B! l: V cout << ex.getMessage() << endl;, l1 h; l* t) P9 f
cout << "error " << ex.ifail() << endl;
" K M) _1 V( B4 u+ v/ F: M }
% d. a1 J# @' C; {8 [ return ITK_ok;
9 K! a9 \0 f+ D& O}[/mw_shl_code]7 h) ^9 H) j( I$ ?0 b% A
|
|