|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 {" F" W) y% k( l
Teamcenter二次开发源码分享:获取下一个Item ID的方法! {$ v# b. U' Q+ O$ s7 F7 M
: a. J+ d' g$ b; F6 `[mw_shl_code=cpp,true]#include <iostream>9 ^3 i( G# M8 B1 y& d
/ h$ y3 D4 G- @5 R
#include <property/nr.h>
# \( v v9 q* X/ H7 Q/ a#include <TC/tc.h>
7 @6 ^$ ?7 E2 M: ]/ r#include <tc/tc_startup.h>
9 B' A3 n$ C4 p* S# x: u1 T+ }#include <tccore/item.h>( @4 s, X* r; M
#include <tccore/tctype.h>
( F8 y1 D/ i+ R( ]% c#include <base_utils/IFail.hxx>$ x* ~6 ~( b3 c% w- u7 K5 |1 B) i
#include <base_utils/TcResultStatus.hxx>
% ~. O6 `1 Y1 k( l6 ]# R# d#include <mld/logging/TcMainLogger.hxx>1 ]: r% j1 q }) P9 l1 x* H
- |. Q) U3 F3 w3 c
using namespace std;
0 D1 G5 w/ u: d! z' Wusing Teamcenter::Main::logger;% r' H) |; @4 ^4 I
$ p; x Z( A0 }9 L( x& vint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id) i0 w/ r/ F2 `& t/ C4 L8 y$ J
{' O4 D. ]" J: [1 i* Z
int ifail = ITK_ok;
. D- Z, q& U# C6 z+ x ResultStatus stat;: \& f; H) k a* u) I
try
5 q- u) [, t% P8 p {) \( D1 ]) Y- I6 x# k# ^* P8 {- p- f
tag_t item_type_tag = NULLTAG;+ r* O; U0 h1 L- g
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);" h$ [' W3 B3 }2 y r
4 F! Q' ^* R2 `4 B char *item_type_name = NULL;) F C# O0 O5 T4 @
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);# c! a% b4 l+ y: P2 Q
8 ~5 v9 u- T: o/ [9 _: J stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
. M( y+ [. g, L N7 y if (item_type_name) MEM_free(item_type_name);, w9 q* P" }$ j- N& ?) v% C
}
$ `' [" j& X$ J9 t% Q6 @# K, n! Q catch (const IFail &ex)
: m+ C$ N4 O. z5 B9 s {) }2 Q+ H# _9 S. W% h
logger()->error(ex.ifail(), ex.getMessage());- v4 t ]1 v8 T% H
cout << ex.getMessage() << endl;
- H% w5 ]8 W# A# T cout << "error " << ex.ifail() << endl;3 @# T3 d9 ^) U3 |8 o
}
/ G% H( S, p* B5 w* M) c, } return ITK_ok;
% {4 ?0 s4 g+ P}[/mw_shl_code]
( m# F+ C1 p, _" D Q9 t |
|