PLM之家PLMHome-工业软件践行者

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

[复制链接]

2020-2-8 09:29:34 2372 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x

( \- b1 m% k/ E  t6 b  v# p" |+ jTeamcenter二次开发源码分享:获取下一个Item ID的方法7 k0 }1 ?! h% a, D& \
/ ~/ h& x& [# b7 F. U; G
[mw_shl_code=cpp,true]#include <iostream>
4 J1 f- ^9 q. [  B4 S2 I% i8 R9 y) L7 }2 c) N0 r
#include <property/nr.h>% e6 K( t- l" c' t4 P
#include <TC/tc.h>3 c9 P& K" n  J+ o
#include <tc/tc_startup.h>" V0 J: N1 x2 }  A  I
#include <tccore/item.h>: m7 f3 H7 G' I' T. [
#include <tccore/tctype.h>2 U, ^, X/ N5 s9 ^
#include <base_utils/IFail.hxx>
! y4 Y) ?2 b9 N& C" E* E# h2 m) z#include <base_utils/TcResultStatus.hxx>
  J# v& w& e: N' q* z0 \#include <mld/logging/TcMainLogger.hxx>+ Y+ d; B0 O. f5 Y$ c, Q% G, b
! i) Z% `2 N7 r1 b, K4 m% R
using namespace std;
8 @1 X6 Y; P7 Ousing Teamcenter::Main::logger;9 r1 t& g4 @7 ~
; @. ~" w9 c* F9 e9 f8 C0 x3 }
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id), {; h8 y, H9 g+ e: P% }
{% |- H2 g* `4 @
    int ifail = ITK_ok;& \" B& @8 G% {  Z5 B- [
    ResultStatus stat;
7 J. h: ?! @: ?& L    try
5 G7 C1 q* h' p% K( }    {- u  U% B3 m1 H! K' o
        tag_t item_type_tag = NULLTAG;1 j9 A+ S. j5 m3 f9 ^+ L3 W
        stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
5 T# ~/ b. t8 m3 x& D5 ^& q
4 u0 F% d' _& _% B        char *item_type_name = NULL;
& X. m. @# ], ]6 `$ ]  c        stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
& T; v* `" i8 J7 D2 f, O/ M, y6 E$ N& P6 o
        stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
+ w8 v, I& S" _/ b- I/ `2 r: N        if (item_type_name)  MEM_free(item_type_name);4 N* ?3 F) C3 i1 c6 V9 }
    }
( O( |# i/ b/ F" G5 @7 S: s7 v    catch (const IFail &ex)$ m: `' f8 z: K3 j
    {
  R1 E2 P  M1 r/ J9 [, k: M        logger()->error(ex.ifail(), ex.getMessage());
7 Y1 g2 ]0 p. z+ X        cout << ex.getMessage() << endl;
6 O# H8 {* P* y- E8 {3 L6 j        cout << "error " << ex.ifail() << endl;
. w3 A) l) c9 t    }
) i$ q, n" s4 g: Y. d$ p. ?- C    return ITK_ok;
& Z0 v/ e; P( P) [) ]8 G}[/mw_shl_code]
, r: ~( C! T; Z4 c2 y2 p6 |
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了