查看: 2669|回复: 0

Teamcenter二次开发源码分享:获取下一个Item ID的方法

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

积分
82265
QQ
发表于 2020-2-8 09:29:34 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×

! r  \5 h- j: ~: m1 A9 uTeamcenter二次开发源码分享:获取下一个Item ID的方法
; Q5 x! l. w7 S
' P& Q# F" ?0 ]1 w8 x. r# Q[mw_shl_code=cpp,true]#include <iostream>' W/ J$ q$ c2 r/ q! D' v- X

4 z% r! R' B( B#include <property/nr.h>
, C3 ]6 e# U0 {5 a, T$ H) s#include <TC/tc.h>
5 p1 ~  V  j) \7 ~#include <tc/tc_startup.h>
7 T' x, v2 r( Q0 p: [% c) X1 {#include <tccore/item.h>+ K" {  G" k' e$ Q. g) k% o2 w0 \
#include <tccore/tctype.h>
  u+ q6 K) ?  l: m  X. ^$ `#include <base_utils/IFail.hxx>
, @2 @6 ?7 u) s2 o( J#include <base_utils/TcResultStatus.hxx>
  ?& x+ w8 m& d, B3 ~* m* w" g; x#include <mld/logging/TcMainLogger.hxx>
! `5 Q9 U+ G( D. s% E/ L) L' \4 C/ |1 J
using namespace std;' f) k! E$ _4 S
using Teamcenter::Main::logger;( V/ j/ e, I9 T. X, H4 A$ _
1 A+ t/ W1 L' b& ~8 H
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)0 j; ]9 D; L, B0 T4 L0 @4 m1 j
{
  W& I  j$ r8 _% y3 m' V1 H    int ifail = ITK_ok;
, P9 l8 E1 N( \* d$ y2 ?! v5 j3 M# o    ResultStatus stat;
! ]  i8 a. W) O3 S, {7 s* E. Q    try
  }2 X! d- @$ g( {& d  d# Q    {
& s* H; s: v. h# u        tag_t item_type_tag = NULLTAG;1 P) R# [4 L+ Q) U7 V; Q7 X3 C
        stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);! {3 v: Y! ^, W. N+ \0 d
6 U( c+ J) c4 S& U/ t/ j
        char *item_type_name = NULL;4 }5 v* A- E) G; u
        stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);8 f) j$ z4 ?1 d  h' l

  W: C: A5 w2 t6 U; Q' L$ r; b4 [        stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);/ G; {+ W% {" f  J5 d# G$ L
        if (item_type_name)  MEM_free(item_type_name);
8 t- H2 q* J. G* m! s    }
: W8 n, h$ E0 z8 H1 {# y    catch (const IFail &ex)# P6 V$ G  M- k. @# c- |. k  p; F
    {
; p6 F: \, w& o0 J        logger()->error(ex.ifail(), ex.getMessage());3 r6 |. W& e' F$ |
        cout << ex.getMessage() << endl;
0 X$ m5 F+ e( @0 ?8 X* ^        cout << "error " << ex.ifail() << endl;5 f1 ?" @  D- p/ P; s
    }
% O9 ~6 u; E/ i0 F# G    return ITK_ok;* E% G+ c6 O( W; ]  w8 r
}[/mw_shl_code]) _! g. d" \5 p) j9 q. S1 W
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部