查看: 2990|回复: 1

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

[复制链接]

4

主题

3

回帖

38

积分

管理员

积分
38
发表于 2018-6-20 18:50:29 | 显示全部楼层 |阅读模式

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

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

×
  y; _( i; p) ~. J
NX二次开发源码分享: 创建 镜像 体 / ]: s. p0 q* q- b
2 K0 L1 R1 {* b6 @! w9 F; U) c6 D, h* K. Z
默认的 JA 有个 bUG,这里看看怎么处理的!!" }2 Z. \$ O( Y6 Q  e; m. a
5 o- }  V& p: ]. Z$ N! E
" c. M; v& V4 v2 E0 ?; f( q, J
int IR9027488::apply_cb()
# T# X, h8 x+ T{* Y% n; G9 X% P9 z9 x5 \- y
    int errorCode = 0;. r2 ]( `0 M4 Y6 a: s& i
    try
# y+ i( v2 p/ [    {
' c9 v* W) y! ^5 I2 \4 G6 w        // AIW - Begin
% ~4 ]& C/ }$ d: b4 D. @! C        tag_t body = selection0->GetSelectedObjects()[0]->Tag();3 |0 m* H* C, Y
        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);/ I7 q) g/ t  W( m0 i8 J; w
9 N# ^! u3 k! u! w- b
        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);3 N2 J! E$ C0 k: K% V7 y# f  y
        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;
0 \7 B( t: e8 J' u# z9 ~        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);
: @3 k1 X# T  I
- ~4 v6 n5 g; g; `' d8 T7 d        NXOpen::Plane *plane1;
4 [' h% o+ B) b4 K9 q3 e, l        plane1 = datumPlaneBuilder1->GetPlane();
2 f; c+ c8 J) o, _
6 y3 K5 `3 R$ u. ?        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1. r% e' r3 b9 ]0 n* D4 y3 v9 E
        plane1->Evaluate();
8 w* j& O! D" d% ^& l5 t5 G6 W( [- u) u; p2 _0 \* y8 I6 l% [* }
        NXOpen::Features::Feature *feature1;8 G7 J* A9 y# ~4 M4 A- R: E
        feature1 = datumPlaneBuilder1->CommitFeature();, m) h$ M$ c; J+ k9 o* e2 n$ Z
& b6 x1 j0 L* H
        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));7 v5 \* p' S, b- ?
        NXOpen::DatumPlane *datumPlane1;6 m4 G; z6 _2 V) V0 a
        datumPlane1 = datumPlaneFeature1->DatumPlane();: h6 |- D  f$ f/ G, ?

& u% T& ~9 t( N6 f' i/ c3 H        tag_t mirror_feat;
2 O, e6 |0 t) B        errorCode = UF_initialize();
# s2 Z& ?7 }! A; u        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);: A) p& r  L, i, }4 x! b

. s+ J% O- [6 Z: o( J: `9 w        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
# u, ?9 {" b' z9 \        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);- H: k$ ^! a) P& |% i/ U
        // AIW - End
. C% E( ~/ G2 E    }
* V0 Z6 B2 g8 j2 [5 L( T5 m) m    caTCh(exception& ex)
3 [- d: E1 C# J, p/ K- c& [) ?    {
$ C8 D5 L- v& Z: l5 l        //---- Enter your exception handling code here ------ _3 f- V0 ~8 W$ d( R$ I/ F
        errorCode = 1;
% ?6 g. J( S+ r3 x# l        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());0 O6 Z( x  W. m0 L/ ~4 j, E/ H
    }) O- e9 Q7 p, g5 \4 T" X6 a
    return errorCode;
) U; L5 |: c6 T& B% i}
" h1 a5 D3 c! P' Z3 N4 a. k# [' H: V0 l) K1 l4 I
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

1

主题

45

回帖

203

积分

培训VIP会员

积分
203
发表于 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.doteam.tech
回复 支持 反对

使用道具 举报

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

本版积分规则

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