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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x

7 u! ^; K2 W( xNX二次开发源码分享: 创建 镜像 体 4 t+ R  o5 K. W. }/ H

9 e: n: d9 [* A" Q默认的 JA 有个 bUG,这里看看怎么处理的!!
8 y4 x" d+ Y, P2 t7 f% Z3 u6 ?$ D0 P7 ~9 h& ]" \! `
! e  c- c' V5 _- ]7 t) b
int IR9027488::apply_cb()
# ?- M! ^- v$ x) h5 O{" B1 W* b( a' F  y
    int errorCode = 0;( r& t: B- S+ a( H2 `) W
    try0 c. X7 |% N2 K8 k5 d* v
    {- [5 f9 B5 B9 u4 R( J$ Y
        // AIW - Begin
# f3 s* }2 K1 }$ N  z' C, F        tag_t body = selection0->GetSelectedObjects()[0]->Tag();
3 ^  B5 x. z8 g7 d1 x, y2 }        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);
3 w6 l" f" O* ]- x" \* {& {5 A: w
/ A4 |: p0 H4 ^# i5 h  s4 c% M        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);6 _0 L# I& f) ]1 p' m0 e$ C
        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;2 e% W9 J2 w4 k: E
        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);
; ~; E% F" X4 f  i# ~1 I
# O. {+ K/ R. d" V6 x        NXOpen::Plane *plane1;+ f3 }: G* o5 {) Q, E
        plane1 = datumPlaneBuilder1->GetPlane();9 `! w/ I$ z& W: J& w
# `1 Q. ^$ l3 D2 A. _9 d
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1) n6 r1 o9 a) [; H$ g+ y! ]
        plane1->Evaluate();
7 p+ m& X9 Q3 _, }+ A% P' E
+ i, Y/ J2 R0 h        NXOpen::Features::Feature *feature1;2 i- ^8 G5 y& a5 ^
        feature1 = datumPlaneBuilder1->CommitFeature();$ B% ~- V" e4 q' l% T

" p& e& [* c0 l        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));  i3 G+ e9 D8 r5 a+ a: a% X& ]
        NXOpen::DatumPlane *datumPlane1;' Z+ \+ C9 `  s; T8 t2 m
        datumPlane1 = datumPlaneFeature1->DatumPlane();
2 D' e0 Z, p8 k7 g2 [
% H' G6 P" b& B* f( E/ o4 T7 _4 M        tag_t mirror_feat;
7 B' z+ Y+ v$ n' K( b+ E/ _        errorCode = UF_initialize();! u! t& P8 c, L+ {% P- t# e  N" T
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);/ S) j! t3 `/ G" d5 b- d
- K1 s# j# L# c& O
        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);0 ?) J3 Q; H/ H) T" T6 h7 n& I
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
1 G! Z2 E! v" ^. K" e3 A9 Y        // AIW - End
4 b  I$ }$ n" S: t    }# X! z( j: J+ S( c' W& c9 c
    caTCh(exception& ex)
, B# L8 l9 J$ V! {# k8 x# F    {
2 D1 r# o. P9 [        //---- Enter your exception handling code here -----/ l  f' [5 h8 ^0 D8 i
        errorCode = 1;7 _0 i0 V" t' e( n  p7 k. k
        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
4 t) M  Z' {1 f# v/ F% g! M( X    }
* T5 e) m! U  c    return errorCode;# Y# W2 L3 w8 y, i7 S; \( w8 U
}' X, q% G* e! E1 T" A

- K& J9 N3 e0 Y$ [& F: b
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

全部回复1

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
回复 支持 反对

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了