PLM之家PLMHome-工业软件与AI结合践行者

[二次开发源码] NX二次开发源码分享: 创建 镜像 体

[复制链接]

2020-9-26 21:49:38 2873 1

admin 发表于 2018-6-20 18:50:29 |阅读模式

admin 楼主

2018-6-20 18:50:29

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

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

x

4 f2 u: }; ~, y5 Z# YNX二次开发源码分享: 创建 镜像 体 3 |& ]0 F1 o) ]/ ]# X

: Y" G3 {1 l  a# ^3 [默认的 JA 有个 bUG,这里看看怎么处理的!!: O0 X4 h- e& f$ ?) C: D; v
3 K8 c. g  e6 ?! w% A# ?+ q

5 r9 w: a5 R# R) S8 G1 c/ Aint IR9027488::apply_cb()
" t. n; t( P8 u* q8 [+ I; r{
$ l( ~+ ~% r$ X2 h: U    int errorCode = 0;
* v  w8 s- ?# V3 m3 F" h/ v    try% \2 |; P; E# @3 e9 ]
    {; r* l: w! @9 T& v! O0 s9 R
        // AIW - Begin
. J! E  ^8 V+ W1 [+ V: R0 B' W        tag_t body = selection0->GetSelectedObjects()[0]->Tag();: U- B( P! l- K$ A$ x) r
        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);
5 m* b' T0 \1 w) `; F; Z; ~8 F
$ n6 ?* J; d0 x3 K/ D0 e        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);7 a& y( n% N. B
        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;
4 f( U4 P- G- _# D3 B8 d& t        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);, U9 }1 j1 F, z! S' m4 H# B

6 U. a- i# E2 N" M        NXOpen::Plane *plane1;
. p+ ]; q( C6 `" R1 M: o8 |        plane1 = datumPlaneBuilder1->GetPlane();
! s: B' S& G( r  r( B' f* ]4 G, s& s6 x( U
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1$ s2 {2 _6 Y/ @9 o
        plane1->Evaluate();
$ P$ {3 \. g5 }  |. g' b# \$ w: r3 R9 {- }
        NXOpen::Features::Feature *feature1;" N1 |- g, U5 K$ `
        feature1 = datumPlaneBuilder1->CommitFeature();
; \5 I& r; h% T, s
' G) {& G7 @# f2 U# C6 R0 o: G        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));: _: L/ f; ]3 t/ z" P( H5 Y
        NXOpen::DatumPlane *datumPlane1;/ ~  d0 Q/ U7 J% R; E* F% [
        datumPlane1 = datumPlaneFeature1->DatumPlane();
$ j' Q) @( {. m/ {5 `3 s7 x
+ r, O8 {# G- }* @; g; p* F! S7 t2 j        tag_t mirror_feat;
5 S# ~7 }+ \' V- U! C4 G        errorCode = UF_initialize();: U& ~9 S4 ^' f, M1 ?
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);+ Q  u! k, o* m, \% O2 h
4 E, V. b3 Y/ E  o4 x5 V( o, ]+ L
        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);$ o0 T2 h# }- D; O9 L7 ^
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);1 s. g! h4 |$ _" f. s
        // AIW - End
5 v: {  q  {3 I- q    }
! F( j: x, P' z    caTCh(exception& ex)0 {5 ]: k; D6 _9 k8 k: ]
    {5 O4 d/ [9 c+ p7 Q; B  F# c
        //---- Enter your exception handling code here -----
7 R5 u( i0 d( M( |; Q, N2 \+ C9 g( G/ O        errorCode = 1;
$ u6 a1 [- O$ w8 B        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());/ |: p0 Y/ W* E9 |, D! S) n
    }# Q/ j3 a$ q" f: l, H6 j  J/ G' V
    return errorCode;  z, R: X3 l- [7 x- z
}
( }6 J5 Q( v! i7 T0 \. w- y% U% @5 E0 p
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

全部回复1

licxsw 发表于 2020-9-26 21:49:38

licxsw 沙发

2020-9-26 21:49:38

为什么不能用OPEN 直接做镜像 需要赚UF呢?代码中OPen的作用是用来获取基准面吗?
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复 支持 反对

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了