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

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

[复制链接]

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

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

admin 楼主

2018-6-20 18:50:29

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

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

x

, D0 \5 {# f- u$ J9 ^NX二次开发源码分享: 创建 镜像 体
9 X+ \; w6 J& a5 T- ^4 T/ M7 Q* _1 u& A; V, W& V
默认的 JA 有个 bUG,这里看看怎么处理的!!
+ J2 `& ~% L+ [6 a4 f
: ?  {7 z9 F, t! |% F6 D3 ^" @1 U+ y1 i* _, H
int IR9027488::apply_cb()$ |# X7 Z; i4 h* `5 \( {8 }
{
* Y$ S/ C( Q# ?  f/ M    int errorCode = 0;/ T; |2 b2 ^. e4 l
    try  d$ Y" T9 ~# q# L( O
    {
3 `2 ~( g' m# E* l) a0 ]        // AIW - Begin
# ]* D# w6 t& w' A7 K) E% W% W        tag_t body = selection0->GetSelectedObjects()[0]->Tag();% t* Z1 h) q: K; X% t
        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);9 \5 {9 u. n- i: }! F& i+ ?$ k
/ ?. b2 k8 x; ~
        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
- l" D1 @$ y* }+ C# h4 E0 \        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;
# G0 ?( Q( R" R! }" d( s0 Z# r        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);
( u8 [) H# N6 p
+ t; R! d7 [; V! r, R" C1 f        NXOpen::Plane *plane1;
" r6 Q5 d7 n7 @# D3 B- r        plane1 = datumPlaneBuilder1->GetPlane();
0 ?$ I- m/ {& O1 P) l5 m3 J' v1 B1 k+ m* K
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1. k4 ?' g% s4 Y
        plane1->Evaluate();8 u5 g6 J5 g$ c. a: n

2 H9 H0 I4 z. ^5 A6 V        NXOpen::Features::Feature *feature1;5 @) Y0 R! ?/ x+ r, s
        feature1 = datumPlaneBuilder1->CommitFeature();  X: D* k7 I6 L: {0 i9 j& n
1 T6 }6 ~+ n- l* p: Q
        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
! @) l7 H% _: J# e! V! u' E        NXOpen::DatumPlane *datumPlane1;
9 q5 \6 K  h4 I+ `. y' K        datumPlane1 = datumPlaneFeature1->DatumPlane();
2 H0 u& E/ t9 Y8 F* z, b6 o
4 ^+ Z- ~' I6 a2 t/ ~9 s& R        tag_t mirror_feat;
$ b# t" @& P5 I6 t8 w/ ^. J$ `& t        errorCode = UF_initialize();  j( @0 F# Z; _) J
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
$ N6 W0 f4 T, y4 S7 A7 h0 D
: b4 o  O! U, B& h        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
. I, \) S. N# H# z" H        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
5 r) c0 R/ x) W0 b( e2 \        // AIW - End
% X" N% T7 A& |& c4 H$ A    }
; P; A" s4 q  `+ i& }* b0 f, g( `    caTCh(exception& ex)3 Z" b  f9 H- T2 m( l- s3 a
    {
4 Q! U) M6 m/ @        //---- Enter your exception handling code here -----
' {1 ]" M) F" |3 ~" V, n        errorCode = 1;9 L0 u% t4 c1 W) \7 N" `$ p8 H
        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
$ n# i& h* Y4 A8 L  D    }8 B8 U; h: l1 P2 `  ^: j1 U! E
    return errorCode;  y8 I4 S+ x& W
}. `, M% c5 R; W' R0 L, D0 M

2 Q3 u' h! v& c' I
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了