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

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

[复制链接]

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

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

admin 楼主

2018-6-20 18:50:29

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

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

x
  x! w0 U7 }" _! D7 Y
NX二次开发源码分享: 创建 镜像 体
7 U& m4 j/ s- w2 Z- ~* k
9 @3 S& N' y7 G+ \, Z$ S默认的 JA 有个 bUG,这里看看怎么处理的!!( r4 m+ N7 @! T
' ?& K8 @- F5 L; I3 A& D
4 K! u- G+ Q) }  M, K' n: X" p  {
int IR9027488::apply_cb()
* q0 J; o. K1 ~, S% y: R/ A{( V! C. Q( e  Y' G3 d
    int errorCode = 0;
6 r& M- H  W1 t5 z  d& a    try  y3 [4 N' a9 Q* m" b$ t
    {
3 X+ l" b, C+ d% O! g        // AIW - Begin: b- B$ H4 z  H& X- e: ~6 u  S5 p; d# W& `
        tag_t body = selection0->GetSelectedObjects()[0]->Tag();
& t$ Z7 o7 p: D% V        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);
7 \2 P' i: b8 ^& F9 w  }) I/ s3 V' A
        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
; s# t# g( d1 Z% t8 P# B4 m        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;
+ p: U2 O! S( y' R        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);
# O& N  l2 ?  K+ \. K' C* S2 X4 l7 f5 F7 r
        NXOpen::Plane *plane1;9 {5 z! m, ?4 a; v1 ?* i
        plane1 = datumPlaneBuilder1->GetPlane();
4 v5 J% F! H  N# H* e/ o- A% j* c: ?  j+ f/ O! c# Z* m$ {# e
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1
& J0 m0 Z* Q, c! D4 x1 p        plane1->Evaluate();
0 R% `* d4 N. [$ k0 f  a3 Y$ n0 u: h3 G& p( k* H' M5 }
        NXOpen::Features::Feature *feature1;
/ V( o; t, e9 u/ L! g( ?' X6 L        feature1 = datumPlaneBuilder1->CommitFeature();
, Q- p& I4 M8 t" h$ L# M( b
( {2 r/ `7 i1 L        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
( W: q4 {+ d0 R: M! a3 Y        NXOpen::DatumPlane *datumPlane1;
" J% o" \$ m3 |2 ?/ h, @        datumPlane1 = datumPlaneFeature1->DatumPlane();+ m& q& c9 A5 W) M0 H- [! h

" U+ Q; I& {8 Q% j6 o+ V( z3 j        tag_t mirror_feat;
) V$ q! f$ G$ j" L        errorCode = UF_initialize();
1 ], s  D9 h( o+ O) `6 i' K, a5 H        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
# W8 q$ A/ q4 p) E. I( G; k8 V( _1 I/ ^
        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
8 {+ k1 g# M& R9 I  w4 B2 r# _7 {        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
: Q. [2 A! Z: ~        // AIW - End
0 E0 Z9 E: T/ v" r! k( o    }0 u2 g# t( j  Y8 ^
    caTCh(exception& ex)4 j0 R, A2 d/ B' o  R
    {: l4 N* B& n, D- `& ~. r4 X7 l
        //---- Enter your exception handling code here -----' _( i" u" J4 Y' t
        errorCode = 1;
5 b( c8 H4 u: Y) ?  J" T3 R4 N        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());! B# U/ {! \) y! k
    }' ~- Z# q. t7 s6 d" @! t6 y, ^3 ^
    return errorCode;
0 q' X; N8 o" M. @- v) L2 B5 |}
% U5 J3 d- L$ B, `) d7 b) M' ~  X0 G
2 n4 c1 i2 X8 J4 e9 y3 q$ M
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了