|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" z# o7 k& N- w: ~3 p( m& Z# U. \Teamcenter二次开发源码分享:获取下一个Item ID的方法$ s/ N7 R2 ?+ U" x W
6 A" w- M) ~8 ?; X6 c5 x2 J$ [[mw_shl_code=cpp,true]#include <iostream>
! p7 h; j6 c# c. z3 G8 v2 s* ]9 G0 Y, N1 d
#include <property/nr.h> N+ C5 _6 y- f7 {% A7 m
#include <TC/tc.h>& v5 \. ]. o3 K5 }, ]. t5 e
#include <tc/tc_startup.h>
9 Z8 a, x, B: J7 `, c9 Y5 N) f#include <tccore/item.h>) V6 t. a5 J Y5 z
#include <tccore/tctype.h>
; h0 V! d h, a#include <base_utils/IFail.hxx>
' `+ O3 i# l& O" @* `8 j#include <base_utils/TcResultStatus.hxx>
1 P' P/ N5 P4 B) S( `4 H+ C( A& T8 D#include <mld/logging/TcMainLogger.hxx>
1 \4 C$ {; }9 c N+ [- _3 r q3 f( ?' w
9 |8 Z4 r4 M, ]; l. M4 Lusing namespace std;2 ]3 S+ {, l0 ?5 t( c
using Teamcenter::Main::logger;
# K# b" s: Y5 O: S
9 Z/ m, j! R& k) w2 |- ^int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)' u4 }# m2 ], i; L. w
{
4 t3 `8 [7 S" F7 F int ifail = ITK_ok;1 n0 g4 ?% d* \9 d% g
ResultStatus stat;
) V9 u* c/ M; w$ q7 S e! g8 a try7 L+ K& D2 z9 v. q
{' Q6 J# W; I# J5 T+ M1 y/ i
tag_t item_type_tag = NULLTAG;" |2 F4 ~- G# w$ j$ Y
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);# j8 f6 }$ p0 z; k4 i) D
, T- w# ~- s3 l: p8 }+ v# _
char *item_type_name = NULL;
5 J( M+ Q5 L g/ J- v( }$ U) l stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);' U8 z x4 H- w1 j( h# ]- t
% [+ ]- \" d" u3 j3 A) z7 F" p+ i
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);: O2 h% Q3 k2 G. H
if (item_type_name) MEM_free(item_type_name);
, S, W% ^0 \ J }
! s9 m6 L8 X! g. N) S catch (const IFail &ex)
' P, W3 @8 W" w q {
& Y& P, |. K# y7 W6 @& m* v logger()->error(ex.ifail(), ex.getMessage());$ S+ v; q" I+ q+ D0 r' v
cout << ex.getMessage() << endl;
& V- |: Y* E* w4 o cout << "error " << ex.ifail() << endl;& k: @( ~! w) _$ o" ?
}
$ l2 y$ O/ M- q' V, C& P4 { return ITK_ok;9 e5 |4 M) A: A
}[/mw_shl_code]
/ @/ p- W8 `5 i" ]$ c: E) J! N |
|