|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% q9 l9 f& {) O" W/ {, \Teamcenter二次开发源码分享:获取下一个Item ID的方法
5 U# M1 y+ `- }$ b/ _# p9 U/ j6 z+ U0 D
[mw_shl_code=cpp,true]#include <iostream>& v2 ~6 A1 d" c) D
# M7 \& E% T: T+ r8 l- E#include <property/nr.h>* I8 C, [/ j6 j
#include <TC/tc.h>6 \7 ]# @$ B1 o$ U+ Y4 s/ A9 Z
#include <tc/tc_startup.h>+ w( ]6 a+ C' f% A9 J z
#include <tccore/item.h>6 x- [" o+ c; {! H$ x, G8 E6 |
#include <tccore/tctype.h>6 E2 j# a6 F$ O! g+ X
#include <base_utils/IFail.hxx>+ N! V( {" x, s2 W# i- X% u
#include <base_utils/TcResultStatus.hxx>6 M4 X" k8 j" y# z- v1 X& m
#include <mld/logging/TcMainLogger.hxx>% m* {) ?( m9 h- B/ }6 F, w
1 i% `( o/ q% ausing namespace std;# l. C4 H3 r. j" L( o
using Teamcenter::Main::logger;! G# l# Z$ {( E5 O( _- S
+ o. f. H0 v) ^4 p( ]% k/ V/ ]: Q2 f4 N, V
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)) W; a' \6 m+ N/ G; j
{
0 \% i& X$ B2 l: X8 J& T int ifail = ITK_ok;
: y. y' y; w# D9 d6 L! ^ ResultStatus stat;( R$ N; ]2 K. y3 l& \5 C- U! Q
try4 s5 B5 [1 |: X& @
{
# Z% v% h2 ]. m. n% s tag_t item_type_tag = NULLTAG;
3 r( d. H! F5 J stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
4 W( Y/ w0 r' O4 A c7 z$ \9 C' Z) B A
char *item_type_name = NULL;
3 {3 C+ }2 ]. s- ~) r+ V. } stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);& T8 A5 t P# t) q/ A1 J
0 Y! _( ~1 N' p* T9 M( |" x stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
3 C4 |, V4 Y0 ?3 X. U if (item_type_name) MEM_free(item_type_name);1 W1 _+ n/ s- Y
}
! P8 |. f- I: D' M; P! Z ~ catch (const IFail &ex)4 n! [8 B; V2 K; r Z
{
# M& ` c; W$ \2 S logger()->error(ex.ifail(), ex.getMessage());' z9 S) M0 ~7 o$ L) ~
cout << ex.getMessage() << endl;
. F' r/ s" M& G, ~ cout << "error " << ex.ifail() << endl;0 Z0 |" l7 {* H
}
0 }2 V( @$ ?3 J1 e return ITK_ok;
; L. c! Y4 m' f s6 J: l6 \5 o4 V}[/mw_shl_code]2 `- V. _- _0 m5 F- E! T o
|
|