|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* ]2 l, Y5 N2 Y i9 f
Teamcenter二次开发源码分享:获取下一个Item ID的方法5 |; g2 W! W: y& m( ?4 y7 X$ A
* c" t/ }) g. s& V! F2 e[mw_shl_code=cpp,true]#include <iostream>4 C$ H9 J. j0 ^6 @5 v
; l1 [% T3 W# b$ o#include <property/nr.h>8 [# a- Y; j9 a3 U0 v- C( J
#include <TC/tc.h>
! d0 N: a% v, g#include <tc/tc_startup.h>
- q; Z9 U* }- [1 r* C7 ]#include <tccore/item.h>
0 C' y! m! }6 i' |4 X: Q5 G#include <tccore/tctype.h>4 N+ N8 d2 P0 A/ u T+ v
#include <base_utils/IFail.hxx>
* r! a* w+ b! }' D, Y#include <base_utils/TcResultStatus.hxx>9 t' m! [2 C( [
#include <mld/logging/TcMainLogger.hxx>
* p+ d2 I$ b+ \' N7 q N$ G2 f4 s, {) M: l; U" b. Q: Z: X
using namespace std;" e) o9 X$ B* d) F$ ^, l% N
using Teamcenter::Main::logger;
. Z6 ?" z. W2 o1 _; Y! {5 S+ T( }
8 B2 s0 n' ]5 Uint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
- D. X# `$ l) N; h{
: X" ^$ t6 R! K* B w, N' [, w int ifail = ITK_ok;9 ?& s6 W/ S/ J+ J
ResultStatus stat;
6 f& I3 h+ Y* P X$ @. f- y try
' k2 m. l0 j) w {# r, v) B. \: Z6 I* e$ ~
tag_t item_type_tag = NULLTAG;/ W; N, U9 \0 E$ @
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
6 p3 v- t$ S1 z, v9 x
2 H7 y. M2 x2 t8 C4 ~ char *item_type_name = NULL;& e& U- Y- @' K+ v; r
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
- D; R8 d9 u% u; f3 k5 j+ L" w2 I% z( L
4 }4 x9 |' N8 N/ m& M stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
0 n" T* X" x% [ i6 r: v if (item_type_name) MEM_free(item_type_name);' }8 F/ \' j% k
}6 c3 P! B- M6 d, f: x: O7 N1 @
catch (const IFail &ex)3 g3 S, l( @* ]: \( P, y5 s
{/ k& \. Z; @: X0 e; ]! Q
logger()->error(ex.ifail(), ex.getMessage());1 E; t' Z1 j. K
cout << ex.getMessage() << endl;$ n* p2 S F* @' O
cout << "error " << ex.ifail() << endl;' M1 n* M/ y: o+ ]( ^# v
}
8 K; `, j- P, P. O' i6 R return ITK_ok;
3 q/ S( V2 f" P* a R' }' d}[/mw_shl_code]
$ R2 L1 Z2 U/ K; Y) H p |
|