|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( { J0 m( z6 k$ h2 Z1 m2 D
Teamcenter二次开发源码分享:获取下一个Item ID的方法6 ]* B. K5 ?- V. H) s0 [- Z& F
6 L- ~8 j' z5 U" j' O* k[mw_shl_code=cpp,true]#include <iostream>
3 l' ?; J: v2 I) X9 g" z' Q) o4 H# y( w7 Y' q8 `/ T+ Z
#include <property/nr.h>5 c, D& @- C5 _$ Q
#include <TC/tc.h>
Z3 u: m( K8 r- `) F" A#include <tc/tc_startup.h>
1 W% a/ H. w4 D7 w! r#include <tccore/item.h>
4 c! C. D8 E' t& s- d& \# \#include <tccore/tctype.h>8 _% j% h J6 Q) U" a2 |* @( c
#include <base_utils/IFail.hxx> T& O- a) _: _7 ^5 ]
#include <base_utils/TcResultStatus.hxx>
7 D7 \1 g l' V* _* } N, I! P#include <mld/logging/TcMainLogger.hxx>5 P! Q0 n& v7 ^" E/ ?) s' q
! z# o4 {& \. H/ |+ A
using namespace std;
6 t, }0 n/ h- H fusing Teamcenter::Main::logger;
; l- u/ P( I& Z* ]7 \
/ ? O. M- T+ x3 g4 N& Dint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)1 \1 S" i# o& ~- g$ G4 s" K
{1 Z0 x2 K& T( k( u1 j+ `# g6 E X) t
int ifail = ITK_ok;
8 Z# J' l! F9 p6 T I& u. R ResultStatus stat;
9 o# N" F% _4 l try7 J4 S3 K4 e9 a( e
{
2 m+ P5 H1 a" B& O3 f tag_t item_type_tag = NULLTAG;
/ ~; I/ W. Z% @6 R v stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
+ L" @' _9 { l6 E$ k8 W, o7 D2 q+ R Y
char *item_type_name = NULL;$ }# F/ e2 p+ R3 N* m
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);3 R7 y3 \& v/ y4 q
( c9 J+ d. ?% U6 Y T! a
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);1 T. B l3 C+ R: Q) k0 s
if (item_type_name) MEM_free(item_type_name);4 a6 B) S: d' x1 ~
}8 M( H3 ?& ~" S- I" F! ?3 }( s
catch (const IFail &ex) z6 G/ p9 H! w# O3 r
{: B, Y0 c( Z2 ]8 q: ^
logger()->error(ex.ifail(), ex.getMessage());
' t5 v4 K- a5 q- H [ cout << ex.getMessage() << endl;5 Y3 S7 I! J# G8 z
cout << "error " << ex.ifail() << endl;! G1 r" e8 C* R+ Y5 \' F
}9 I a* J6 R8 u3 H: f
return ITK_ok;
: F9 D5 d% L5 j- f. g6 V}[/mw_shl_code]
# x/ S$ N+ P* S/ `8 k |
|