PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2018-6-20 18:50:29

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

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

x

- `, r, B0 L0 }: \NX二次开发源码分享: 创建 镜像 体
3 ^+ J* T. x& l+ W3 v
. n/ ~6 u  l3 n- V0 a! X默认的 JA 有个 bUG,这里看看怎么处理的!!
4 K1 W8 x6 B# `/ R
6 n: r8 A  R: K, [) }. Z* W0 z. U( F+ C1 J' Y+ G, ?
int IR9027488::apply_cb()  J  h! g% N6 `% T+ H$ g+ ~
{0 _: g- n$ S8 f/ `8 t
    int errorCode = 0;. J( P- g* b! o1 c1 u2 c/ z
    try' d( j, f9 ^+ N, P* B
    {, [3 i$ \$ }/ d6 g
        // AIW - Begin, |3 X# O# n/ }
        tag_t body = selection0->GetSelectedObjects()[0]->Tag();/ O4 R3 w$ E* h
        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);/ w% U& g5 X7 X( }6 X1 M% K8 f
  a( [3 r: t0 Q, I
        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);9 i! C7 r+ q, [/ W4 s+ P
        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;9 z& W* p" T* A- e6 t+ R3 `; m6 E
        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);
/ F: p. o3 e# V0 m8 G! A: T- B# g2 B; p" N
        NXOpen::Plane *plane1;/ y6 d" V: V( q
        plane1 = datumPlaneBuilder1->GetPlane();! O4 ]( ]! X: n* d

' R; e$ Z1 b1 m2 B  L/ y7 `        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1
3 w$ f0 |% p/ v( M  j        plane1->Evaluate();
9 f, m  F2 f8 \+ C9 H$ t0 w8 `, a' r0 g+ F
        NXOpen::Features::Feature *feature1;
" G* V6 O: T+ w% |- s  ^        feature1 = datumPlaneBuilder1->CommitFeature();: y0 U& V9 [8 G; L: {) Z) J

# C  J. I; E# a- w8 ?9 L3 g+ h+ G        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
; i. B7 e4 I! S' r        NXOpen::DatumPlane *datumPlane1;
# j  ?4 H/ f) F# z4 E) o( j        datumPlane1 = datumPlaneFeature1->DatumPlane();
1 k' r, |, w0 |; p) c! o' z! E7 k- p& U% ~" W# M
        tag_t mirror_feat;$ J" O5 Y- ?6 F8 _$ g7 x# W0 o7 `
        errorCode = UF_initialize();
0 S6 ^" }, |& k        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);3 _1 X; n, I2 R9 f( k" X4 H% s

2 U' b. f! ~0 v0 w        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
9 O# n% l* N7 T" {- `7 @1 m        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
5 c# e3 j* f. N+ f5 a: Y        // AIW - End% m( a+ f9 N, o
    }
# w% `4 H+ Z1 K* s$ ?' ^    caTCh(exception& ex)
/ B! t; M1 e6 ^- r7 O' ?* w  D6 B    {
: W; k. o2 p8 D$ K3 V        //---- Enter your exception handling code here -----
& u. D& v* c7 {$ V& U3 I3 c4 v        errorCode = 1;
* ^% D: v/ ?( J, z" P        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());* M$ P- ~+ q7 s+ V
    }) X' b& _4 ?( o& G
    return errorCode;
; q; I6 T/ b8 Q9 b$ q6 U9 G; b}
% s3 W; U1 [* ~; S5 l6 V. @" {% ^" D
( N$ U- e3 Q# @
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了