|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# K s. A& i! ATeamcenter二次开发源码分享:获取下一个Item ID的方法1 R8 q- S( b2 \+ K( V8 M+ }, [
* q& k+ E: A' n& I( Z1 Z8 _[mw_shl_code=cpp,true]#include <iostream>
1 h4 p1 w! C, |) k, j
4 x+ t, p" A- Y9 C( ?: z7 a#include <property/nr.h>
# \8 _/ `2 A: C# a! s7 y/ z2 u#include <TC/tc.h>, n6 b4 l; h* p G+ p0 y
#include <tc/tc_startup.h>: J) l0 Y' x7 f' z
#include <tccore/item.h>3 i& V/ x2 ^9 o4 u$ {& ]
#include <tccore/tctype.h>
3 w( @$ E0 j( C' R, ~9 t#include <base_utils/IFail.hxx>/ `! v, Z q' x, s o
#include <base_utils/TcResultStatus.hxx>. u1 ?2 h6 S! }1 y' n9 r7 K: B* M
#include <mld/logging/TcMainLogger.hxx>
) h# m& }4 Z" A) c+ ]9 ]: {- e
6 _) N1 p. ^/ M2 K& F% k, Musing namespace std;
7 e1 z3 Y2 R0 k4 f, B! Rusing Teamcenter::Main::logger;& M+ R' a' }2 U% T p2 u4 I
, L5 `+ _ C4 z% dint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
* A9 _& Z/ p" F- `$ e3 q{8 r6 Z) ]3 [9 m# E0 X1 n" c3 P+ H
int ifail = ITK_ok;0 l: n. x! B1 u- d" o, z% P k
ResultStatus stat;
' t- `7 R. x: k/ q; j0 ] try: z& |' n2 n* G, }
{4 `* e% s2 o# F- }. v, p( O
tag_t item_type_tag = NULLTAG;% R6 a+ J6 q1 O1 \
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);/ k; S0 ?9 T& k0 [1 [
: u' m3 k l" K! C. t
char *item_type_name = NULL;* f1 G# \( c6 A ?' ^, d! q0 ]
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);7 B7 E. h3 |: @- \
2 m: {, A( j8 E: g# _9 V
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);) T# @0 L( i' U. M# Q0 M& H1 s
if (item_type_name) MEM_free(item_type_name);
1 m; R, V/ i/ j# e }5 } }0 K. ^* `
catch (const IFail &ex)* a+ q# F% }0 ~; h' w; m
{
) y9 q7 B9 y7 L1 J logger()->error(ex.ifail(), ex.getMessage());2 |9 W! e c! F( q0 |, I: E) B
cout << ex.getMessage() << endl;
1 A F; [3 _/ s" E V4 o cout << "error " << ex.ifail() << endl;% j4 Q U x: Y% H
}. {& f3 H! Q0 C# Y `; i' @- [0 N
return ITK_ok;2 f# {/ z1 Y% g1 R/ J |
}[/mw_shl_code]9 V. g9 O8 w* G" q1 ]: R
|
|